dhcp6-srv.xml 178 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
  4. <!ENTITY mdash "&#x2014;" >
  5. ]>
  6. <chapter id="dhcp6">
  7. <title>The DHCPv6 Server</title>
  8. <section id="dhcp6-start-stop">
  9. <title>Starting and Stopping the DHCPv6 Server</title>
  10. <para>
  11. It is recommended that the Kea DHCPv6 server be started and stopped
  12. using <command>keactrl</command> (described in <xref linkend="keactrl"/>).
  13. However, it is also possible to run the server directly: it accepts
  14. the following command-line switches:
  15. </para>
  16. <itemizedlist>
  17. <listitem>
  18. <simpara>
  19. <command>-c <replaceable>file</replaceable></command> -
  20. specifies the configuration file. This is the only mandatory
  21. switch.</simpara>
  22. </listitem>
  23. <listitem>
  24. <simpara>
  25. <command>-d</command> - specifies whether the server
  26. logging should be switched to verbose mode. In verbose mode,
  27. the logging severity and debuglevel specified in the configuration
  28. file are ignored and "debug" severity and the maximum debuglevel
  29. (99) are assumed. The flag is convenient, for temporarily
  30. switching the server into maximum verbosity, e.g. when
  31. debugging.</simpara>
  32. </listitem>
  33. <listitem>
  34. <simpara>
  35. <command>-p <replaceable>port</replaceable></command> -
  36. specifies UDP port on which the server will listen. This is only
  37. useful during testing, as a DHCPv6 server listening on
  38. ports other than the standard ones will not be able to
  39. handle regular DHCPv6 queries.</simpara>
  40. </listitem>
  41. <listitem>
  42. <simpara>
  43. <command>-t <replaceable>file</replaceable></command> -
  44. specifies the configuration file to be tested. Kea-dhcp6
  45. will attempt to load it, and will conduct sanity
  46. checks. Note that certain checks are possible only while
  47. running the actual server. The actual status is reported
  48. with exit code (0 = configuration looks ok, 1 = error
  49. encountered). Kea will print out log messages to standard
  50. output and error to standard error when testing
  51. configuration.</simpara>
  52. </listitem>
  53. <listitem>
  54. <simpara>
  55. <command>-v</command> - prints out the Kea version and exits.
  56. </simpara>
  57. </listitem>
  58. <listitem>
  59. <simpara>
  60. <command>-V</command> - prints out the Kea extended version with
  61. additional parameters and exits. The listing includes the versions
  62. of the libraries dynamically linked to Kea.
  63. </simpara>
  64. </listitem>
  65. <listitem>
  66. <simpara>
  67. <command>-W</command> - prints out the Kea configuration report
  68. and exits. The report is a copy of the
  69. <filename>config.report</filename> file produced by
  70. <userinput>./configure</userinput>: it is embedded in the
  71. executable binary.
  72. </simpara>
  73. </listitem>
  74. </itemizedlist>
  75. <para>
  76. The <filename>config.report</filename> may also be accessed more
  77. directly. The following command may be used to extract this
  78. information. The binary <userinput>path</userinput> may be found
  79. in the install directory or in the <filename>.libs</filename>
  80. subdirectory in the source tree. For example
  81. <filename>kea/src/bin/dhcp6/.libs/kea-dhcp6</filename>.
  82. <screen>
  83. strings <userinput>path</userinput>/kea-dhcp6 | sed -n 's/;;;; //p'
  84. </screen>
  85. </para>
  86. <para>
  87. On start-up, the server will detect available network interfaces
  88. and will attempt to open UDP sockets on all interfaces
  89. mentioned in the configuration file.
  90. Since the DHCPv6 server opens privileged ports, it requires root
  91. access. Make sure you run this daemon as root.
  92. </para>
  93. <para>
  94. During startup the server will attempt to create a PID file of the
  95. form: localstatedir]/[conf name].kea-dhcp6.pid where:
  96. <itemizedlist>
  97. <listitem>
  98. <simpara><command>localstatedir</command>: The value as passed into the
  99. build configure script. It defaults to "/usr/local/var". Note
  100. that this value may be overridden at run time by setting the environment
  101. variable KEA_PIDFILE_DIR. This is intended primarily for testing purposes.
  102. </simpara>
  103. </listitem>
  104. <listitem>
  105. <simpara><command>conf name</command>: The configuration file name
  106. used to start the server, minus all preceding path and file extension.
  107. For example, given a pathname of "/usr/local/etc/kea/myconf.txt", the
  108. portion used would be "myconf".
  109. </simpara>
  110. </listitem>
  111. </itemizedlist>
  112. If the file already exists and contains the PID of a live process,
  113. the server will issue a DHCP6_ALREADY_RUNNING log message and exit. It
  114. is possible, though unlikely, that the file is a remnant of a system crash
  115. and the process to which the PID belongs is unrelated to Kea. In such a
  116. case it would be necessary to manually delete the PID file.
  117. </para>
  118. <para>
  119. The server can be stopped using the <command>kill</command> command.
  120. When running in a console, the server can be shut down by
  121. pressing ctrl-c. It detects the key combination and shuts
  122. down gracefully.
  123. </para>
  124. </section>
  125. <section id="dhcp6-configuration">
  126. <title>DHCPv6 Server Configuration</title>
  127. <section>
  128. <title>Introduction</title>
  129. <para>
  130. This section explains how to configure the DHCPv6 server using the
  131. Kea configuration backend. (Kea configuration using any other
  132. backends is outside of scope of this document.) Before DHCPv6
  133. is started, its configuration file has to be created. The
  134. basic configuration is as follows:
  135. <screen>
  136. {
  137. # DHCPv6 configuration starts on the next line
  138. "Dhcp6": {
  139. # First we set up global values
  140. "valid-lifetime": 4000,
  141. "renew-timer": 1000,
  142. "rebind-timer": 2000,
  143. "preferred-lifetime": 3000,
  144. # Next we setup the interfaces to be used by the server.
  145. "interfaces-config": {
  146. "interfaces": [ "eth0" ]
  147. },
  148. # And we specify the type of lease database
  149. "lease-database": {
  150. "type": "memfile",
  151. "persist": true,
  152. "name": "/var/kea/dhcp6.leases"
  153. },
  154. # Finally, we list the subnets from which we will be leasing addresses.
  155. "subnet6": [
  156. {
  157. "subnet": "2001:db8:1::/64",
  158. "pools": [
  159. {
  160. "pool": "2001:db8:1::1-2001:db8:1::ffff"
  161. }
  162. ]
  163. }
  164. ]
  165. # DHCPv6 configuration ends with the next line
  166. }
  167. } </screen>
  168. </para>
  169. <para>The following paragraphs provide a brief overview of the parameters in
  170. the above example together with
  171. their format. Subsequent sections of this chapter go into much greater detail
  172. for these and other parameters.</para>
  173. <para>The lines starting with a hash (#) are comments and are ignored by
  174. the server; they do not impact its
  175. operation in any way.</para>
  176. <para>The configuration starts in the first line with the initial
  177. opening curly bracket (or brace). Each configuration consists of
  178. one or more objects. In this specific example, we have only one
  179. object, called Dhcp6. This is a simplified configuration, as usually
  180. there will be additional objects, like <command>Logging</command> or
  181. <command>DhcpDdns</command>, but we omit them now for clarity. The Dhcp6
  182. configuration starts with the <command>"Dhcp6": {</command> line
  183. and ends with the corresponding closing brace (in the above example,
  184. the brace after the last comment). Everything defined between those
  185. lines is considered to be the Dhcp6 configuration.</para>
  186. <para>In the general case, the order in which those parameters appear does not
  187. matter. There are two caveats here though. The first one is to remember that
  188. the configuration file must be well formed JSON. That means that parameters
  189. for any given scope must be separated by a comma and there must not be a comma
  190. after the last parameter. When reordering a configuration file, keep in mind that
  191. moving a parameter to or from the last position in a given scope may also require
  192. moving the comma. The second caveat is that it is uncommon &mdash; although
  193. legal JSON &mdash; to
  194. repeat the same parameter multiple times. If that happens, the last occurrence of a
  195. given parameter in a given scope is used while all previous instances are
  196. ignored. This is unlikely to cause any confusion as there are no real life
  197. reasons to keep multiple copies of the same parameter in your configuration
  198. file.</para>
  199. <para>Moving onto the DHCPv6 configuration elements, the very first few elements
  200. define some global parameters. <command>valid-lifetime</command>
  201. defines for how long the addresses (leases) given out by the server are valid. If
  202. nothing changes, a client that got an address is allowed to use it for 4000
  203. seconds. (Note that integer numbers are specified as is, without any quotes
  204. around them.) The address will become deprecated in 3000 seconds (clients are
  205. allowed to keep old connections, but can't use this address for creating new
  206. connections). <command>renew-timer</command> and
  207. <command> rebind-timer</command> are values that define T1 and T2 timers that
  208. govern when the client will begin the renewal and rebind procedures.</para>
  209. <para>The <command>interfaces-config</command> map specifies the server
  210. configuration concerning the network interfaces, on which the server should
  211. listen to the DHCP messages. The <command>interfaces</command> parameter
  212. specifies a list of network interfaces on which the server should listen.
  213. Lists are opened and closed with square brackets, with elements separated
  214. by commas. Had we wanted to listen on two interfaces, the
  215. <command>interfaces-config</command> would look like this:
  216. <screen>
  217. "interfaces-config": {
  218. "interfaces": [ "eth0", "eth1" ]
  219. },
  220. </screen>
  221. </para>
  222. <para>The next couple of lines define the lease database, the place where the server
  223. stores its lease information. This particular example tells the server to use
  224. <command>memfile</command>, which is the simplest (and fastest) database
  225. backend. It uses an in-memory database and stores leases on disk in a CSV
  226. file. This is a very simple configuration. Usually the lease database configuration
  227. is more extensive and contains additional parameters. Note that
  228. <command>lease-database</command>
  229. is an object and opens up a new scope, using an opening brace.
  230. Its parameters (just one in this example - <command>type</command>)
  231. follow. Had there been more than one, they would be separated by commas. This
  232. scope is closed with a closing brace. As more parameters for the Dhcp6 definition
  233. follow, a trailing comma is present.</para>
  234. <para>Finally, we need to define a list of IPv6 subnets. This is the
  235. most important DHCPv6 configuration structure as the server uses that
  236. information to process clients' requests. It defines all subnets from
  237. which the server is expected to receive DHCP requests. The subnets are
  238. specified with the <command>subnet6</command> parameter. It is a list,
  239. so it starts and ends with square brackets. Each subnet definition in
  240. the list has several attributes associated with it, so it is a structure
  241. and is opened and closed with braces. At minimum, a subnet definition
  242. has to have at least two parameters: <command>subnet</command> (that
  243. defines the whole subnet) and <command>pools</command> (which is a list of
  244. dynamically allocated pools that are governed by the DHCP server).</para>
  245. <para>The example contains a single subnet. Had more than one been defined,
  246. additional elements
  247. in the <command>subnet6</command> parameter would be specified and
  248. separated by commas. For example, to define two subnets, the following
  249. syntax would be used:
  250. <screen>
  251. "subnet6": [
  252. {
  253. "pools": [ { "pool": "2001:db8:1::/112" } ],
  254. "subnet": "2001:db8:1::/64"
  255. },
  256. {
  257. "pools": [ { "pool": "2001:db8:2::1-2001:db8:2::ffff" } ],
  258. "subnet": "2001:db8:2::/64"
  259. }
  260. ]
  261. </screen>
  262. Note that indentation is optional and is used for aesthetic purposes only.
  263. In some cases in may be preferable to use more compact notation.
  264. </para>
  265. <para>After all parameters are specified, we have two contexts open:
  266. global and Dhcp6, hence we need two closing curly brackets to close them.
  267. In a real life configuration file there most likely would be additional
  268. components defined such as Logging or DhcpDdns, so the closing brace would
  269. be followed by a comma and another object definition.</para>
  270. </section>
  271. <section>
  272. <title>Lease Storage</title>
  273. <para>All leases issued by the server are stored in the lease database.
  274. Currently there are four database backends available: memfile (which is the
  275. default backend), MySQL, PostgreSQL and Cassandra.</para>
  276. <section>
  277. <title>Memfile - Basic Storage for Leases</title>
  278. <para>The server is able to store lease data in different repositories. Larger
  279. deployments may elect to store leases in a database. <xref
  280. linkend="database-configuration6"/> describes this option. In typical
  281. smaller deployments though, the server will store lease information in a CSV file rather
  282. than a database. As well as requiring less administration, an
  283. advantage of using a file for storage is that it
  284. eliminates a dependency on third-party database software.</para>
  285. <para>The configuration of the file backend (Memfile) is controlled through
  286. the Dhcp6/lease-database parameters. The <command>type</command> parameter
  287. is mandatory and it specifies which storage for leases the server should use.
  288. The value of <userinput>"memfile"</userinput> indicates that the file should
  289. be used as the storage. The following list gives additional, optional,
  290. parameters that can be used to configure the Memfile backend.
  291. <itemizedlist>
  292. <listitem>
  293. <simpara><command>persist</command>: controls whether the new leases and
  294. updates to existing leases are written to the file. It is strongly
  295. recommended that the value of this parameter is set to
  296. <userinput>true</userinput> at all times, during the server's normal
  297. operation. Not writing leases to disk will mean that if a server is restarted
  298. (e.g. after a power failure), it will not know what addresses have been
  299. assigned. As a result, it may hand out addresses to new clients that are
  300. already in use. The value of <userinput>false</userinput> is mostly useful
  301. for performance testing purposes. The default value of the
  302. <command>persist</command> parameter is <userinput>true</userinput>,
  303. which enables writing lease updates
  304. to the lease file.
  305. </simpara>
  306. </listitem>
  307. <listitem>
  308. <simpara><command>name</command>: specifies an absolute location of the lease
  309. file in which new leases and lease updates will be recorded. The default value
  310. for this parameter is <userinput>"[kea-install-dir]/var/kea/kea-leases6.csv"
  311. </userinput>.</simpara>
  312. </listitem>
  313. <listitem>
  314. <simpara><command>lfc-interval</command>: specifies the interval in seconds, at
  315. which the server will perform a lease file cleanup (LFC). This
  316. removes redundant (historical) information from the lease file
  317. and effectively reduces the lease file size. The cleanup process is described
  318. in more detailed fashion further in this section. The default value of the
  319. <command>lfc-interval</command> is <userinput>0</userinput>, which disables
  320. the LFC.</simpara>
  321. </listitem>
  322. </itemizedlist>
  323. </para>
  324. <para>An example configuration of the Memfile backend is presented below:
  325. <screen>
  326. "Dhcp6": {
  327. "lease-database": {
  328. <userinput>"type": "memfile"</userinput>,
  329. <userinput>"persist": true</userinput>,
  330. <userinput>"name": "/tmp/kea-leases6.csv"</userinput>,
  331. <userinput>"lfc-interval": 1800</userinput>
  332. }
  333. }
  334. </screen>
  335. This configuration selects the <filename>/tmp/kea-leases6.csv</filename> as
  336. the storage for lease information and enables persistence (writing lease updates
  337. to this file). It also configures the backend perform the periodic cleanup
  338. of the lease files, executed every 30 minutes.
  339. </para>
  340. <para>It is important to know how the lease file contents are organized
  341. to understand why the periodic lease file cleanup is needed. Every time
  342. the server updates a lease or creates a new lease for the client, the new
  343. lease information must be recorded in the lease file. For performance reasons,
  344. the server does not update the existing client's lease in the file, as it would
  345. potentially require rewriting the entire file. Instead, it simply appends the new lease
  346. information to the end of the file: the previous lease entries for the
  347. client are not removed. When the server loads leases from the lease file, e.g.
  348. at the server startup, it assumes that the latest lease entry for the client
  349. is the valid one. The previous entries are discarded. This means that the
  350. server can re-construct the accurate information about the leases even though
  351. there may be many lease entries for each client. However, storing many entries
  352. for each client results in bloated lease file and impairs the performance of
  353. the server's startup and reconfiguration as it needs to process a larger number
  354. of lease entries.
  355. </para>
  356. <para>Lease file cleanup (LFC) removes all previous entries for each client and
  357. leaves only the latest ones. The interval at which the cleanup is performed
  358. is configurable, and it should be selected according to the frequency of lease
  359. renewals initiated by the clients. The more frequent the renewals, the smaller
  360. the value of <command>lfc-interval</command> should be. Note however, that the
  361. LFC takes time and thus it is possible (although unlikely) that new cleanup
  362. is started while the previous cleanup instance is still running, if the
  363. <command>lfc-interval</command> is too short. The server would recover from
  364. this by skipping the new cleanup when it detects that the previous cleanup
  365. is still in progress. But it implies that the actual cleanups will be
  366. triggered more rarely than configured. Moreover, triggering a new cleanup
  367. adds an overhead to the server which will not be able to respond to new
  368. requests for a short period of time when the new cleanup process is spawned.
  369. Therefore, it is recommended that the <command>lfc-interval</command> value
  370. is selected in a way that would allow for the LFC to complete the cleanup before a
  371. new cleanup is triggered.
  372. </para>
  373. <para>Lease file cleanup is performed by a separate process (in background) to avoid
  374. a performance impact on the server process. In order to avoid the conflicts
  375. between two processes both using the same lease files, the LFC process
  376. operates on the copy of the original lease file, rather than on the lease
  377. file used by the server to record lease updates. There are also other files
  378. being created as a side effect of the lease file cleanup. The detailed
  379. description of the LFC is located on the Kea wiki:
  380. <ulink url="http://kea.isc.org/wiki/LFCDesign"/>.
  381. </para>
  382. </section>
  383. <section id="database-configuration6">
  384. <title>Lease Database Configuration</title>
  385. <note>
  386. <para>Lease database access information must be configured for the DHCPv6 server,
  387. even if it has already been configured for the DHCPv4 server. The servers
  388. store their information independently, so each server can use a separate
  389. database or both servers can use the same database.</para>
  390. </note>
  391. <para>Lease database configuration is controlled through the
  392. Dhcp6/lease-database parameters. The type of the database must be set to
  393. "memfile", "mysql", "postgresql" or "cql", e.g.
  394. <screen>
  395. "Dhcp6": { "lease-database": { <userinput>"type": "mysql"</userinput>, ... }, ... }
  396. </screen>
  397. Next, the name of the database is to hold the leases must be set: this is the
  398. name used when the database was created
  399. (see <xref linkend="mysql-database-create"/>,
  400. <xref linkend="pgsql-database-create"/>
  401. or <xref linkend="cql-database-create"/>).
  402. <screen>
  403. "Dhcp6": { "lease-database": { <userinput>"name": "<replaceable>database-name</replaceable>" </userinput>, ... }, ... }
  404. </screen>
  405. If the database is located on a different system to the DHCPv6 server, the
  406. database host name must also be specified. (It should be noted that this
  407. configuration may have a severe impact on server performance.):
  408. <screen>
  409. "Dhcp6": { "lease-database": { <userinput>"host": <replaceable>remote-host-name</replaceable></userinput>, ... }, ... }
  410. </screen>
  411. The usual state of affairs will be to have the database on the same machine as
  412. the DHCPv6 server. In this case, set the value to the empty string:
  413. <screen>
  414. "Dhcp6": { "lease-database": { <userinput>"host" : ""</userinput>, ... }, ... }
  415. </screen>
  416. Should the database use a port different than default, it may be
  417. specified as well:
  418. <screen>
  419. "Dhcp4": { "lease-database": { <userinput>"port" : 12345</userinput>, ... }, ... }
  420. </screen>
  421. Should the database be located on a different system, you may need to specify a longer interval
  422. for the connection timeout:
  423. <screen>
  424. "Dhcp6": { "lease-database": { <userinput>"connect-timeout" : <replaceable>timeout-in-seconds</replaceable></userinput>, ... }, ... }
  425. </screen>
  426. The default value of five seconds should be more than adequate for local connections.
  427. If a timeout is given though, it should be an integer greater than zero.
  428. </para>
  429. <para>
  430. Note that host parameter is used by MySQL and PostgreSQL
  431. backends. Cassandra has a concept of contact points that could be
  432. used to contact the cluster, instead of a single IP or
  433. hostname. It takes a list of comma separated IP addresses. This may be specified as:
  434. <screen>
  435. "Dhcp4": { "lease-database": { <userinput>"contact-points" : "192.0.2.1,192.0.2.2"</userinput>, ... }, ... }
  436. </screen>
  437. </para>
  438. <para>Finally, the credentials of the account under which the server will
  439. access the database should be set:
  440. <screen>
  441. "Dhcp6": { "lease-database": { <userinput>"user": "<replaceable>user-name</replaceable>"</userinput>,
  442. <userinput>"password": "<replaceable>password</replaceable>"</userinput>,
  443. ... },
  444. ... }
  445. </screen>
  446. If there is no password to the account, set the password to the empty string
  447. "". (This is also the default.)</para>
  448. </section>
  449. </section>
  450. <section id="hosts6-storage">
  451. <title>Hosts Storage</title>
  452. <para>Kea is also able to store information about host reservations in the
  453. database. The hosts database configuration uses the same syntax as the lease
  454. database. In fact, a Kea server opens independent connections for each
  455. purpose, be it lease or hosts information. This arrangement gives the most
  456. flexibility. Kea can be used to keep leases and host reservations
  457. separately, but can also point to the same database. Currently the
  458. supported hosts database types are MySQL and PostgreSQL. The Cassandra
  459. backend does not support host reservations yet.</para>
  460. <para>Please note that usage of hosts storage is optional. A user can define
  461. all host reservations in the configuration file. That is the recommended way
  462. if the number of reservations is small. However, when the number of
  463. reservations grows it's more convenient to use host storage. Please note
  464. that both storage methods (configuration file and one of the supported databases)
  465. can be used together. If hosts are defined in both places, the definitions
  466. from the configuration file are checked first and external storage is checked
  467. later, if necessary.</para>
  468. <section id="hosts-database-configuration6">
  469. <title>DHCPv6 Hosts Database Configuration</title>
  470. <para>Hosts database configuration is controlled through the Dhcp6/hosts-database
  471. parameters. If enabled, the type of the database must be set to "mysql" or
  472. "postgresql". Other hosts backends may be added in later version of Kea.
  473. <screen>
  474. "Dhcp6": { "hosts-database": { <userinput>"type": "mysql"</userinput>, ... }, ... }
  475. </screen>
  476. Next, the name of the database to hold the reservations must be set: this is the
  477. name used when the database was created (see <xref linkend="supported-databases"/>
  478. for instructions how to setup desired database type).
  479. <screen>
  480. "Dhcp6": { "hosts-database": { <userinput>"name": "<replaceable>database-name</replaceable>" </userinput>, ... }, ... }
  481. </screen>
  482. If the database is located on a different system than the DHCPv6 server, the
  483. database host name must also be specified. (Again it should be noted that this
  484. configuration may have a severe impact on server performance):
  485. <screen>
  486. "Dhcp6": { "hosts-database": { <userinput>"host": <replaceable>remote-host-name</replaceable></userinput>, ... }, ... }
  487. </screen>
  488. The usual state of affairs will be to have the database on the same machine as
  489. the DHCPv6 server. In this case, set the value to the empty string:
  490. <screen>
  491. "Dhcp6": { "hosts-database": { <userinput>"host" : ""</userinput>, ... }, ... }
  492. </screen>
  493. <screen>
  494. "Dhcp4": { "hosts-database": { <userinput>"port" : 12345</userinput>, ... }, ... }
  495. </screen>
  496. </para>
  497. <para>Finally, the credentials of the account under which the server will
  498. access the database should be set:
  499. <screen>
  500. "Dhcp6": { "hosts-database": { <userinput>"user": "<replaceable>user-name</replaceable>"</userinput>,
  501. <userinput>"password": "<replaceable>password</replaceable>"</userinput>,
  502. ... },
  503. ... }
  504. </screen>
  505. If there is no password to the account, set the password to the empty string
  506. "". (This is also the default.)</para>
  507. </section>
  508. <section id="read-only-database-configuration6">
  509. <title>Using Read-Only Databases for Host Reservations</title>
  510. <para>
  511. In some deployments the database user whose name is specified in the database backend
  512. configuration may not have write privileges to the database. This is often
  513. required by the policy within a given network to secure the data from being
  514. unintentionally modified. In many cases administrators have inventory databases
  515. deployed, which contain substantially more information about the hosts than
  516. static reservations assigned to them. The inventory database can be used to create
  517. a view of a Kea hosts database and such view is often read only.
  518. </para>
  519. <para>
  520. Kea host database backends operate with an implicit configuration to both
  521. read from and write to the database. If the database user does not have
  522. write access to the host database, the backend will fail to start and the
  523. server will refuse to start (or reconfigure). However, if access to a read
  524. only host database is required for retrieving reservations for clients
  525. and/or assign specific addresses and options, it is possible to explicitly
  526. configure Kea to start in "read-only" mode. This is controlled by the
  527. <command>readonly</command> boolean parameter as follows:
  528. <screen>
  529. "Dhcp6": { "hosts-database": { <userinput>"readonly": true</userinput>, ... }, ... }
  530. </screen>
  531. Setting this parameter to <userinput>false</userinput> would configure the
  532. database backend to operate in "read-write" mode, which is also a default
  533. configuration if the parameter is not specified.
  534. </para>
  535. <note><para>The <command>readonly</command> parameter is currently only supported
  536. for MySQL and PostgreSQL databases.</para></note>
  537. </section>
  538. </section>
  539. <section id="dhcp6-interface-selection">
  540. <title>Interface Selection</title>
  541. <para>The DHCPv6 server has to be configured to listen on specific network
  542. interfaces. The simplest network interface configuration instructs the server to
  543. listen on all available interfaces:
  544. <screen>
  545. "Dhcp6": {
  546. "interfaces-config": {
  547. "interfaces": [ <userinput>"*"</userinput> ]
  548. }
  549. ...
  550. }
  551. </screen>
  552. The asterisk plays the role of a wildcard and means "listen on all interfaces".
  553. However, it is usually a good idea to explicitly specify interface names:
  554. <screen>
  555. "Dhcp6": {
  556. "interfaces-config": {
  557. "interfaces": [ <userinput>"eth1", "eth3"</userinput> ]
  558. },
  559. ...
  560. }
  561. </screen>
  562. </para>
  563. <para>It is possible to use wildcard interface name (asterisk) concurrently
  564. with the actual interface names:
  565. <screen>
  566. "Dhcp6": {
  567. "interfaces-config": {
  568. "interfaces": [ <userinput>"eth1", "eth3", "*"</userinput> ]
  569. },
  570. ...
  571. }
  572. </screen>
  573. It is anticipated that this will form of usage only be used where it is desired to
  574. temporarily override a list of interface names and listen on all interfaces.
  575. </para>
  576. </section>
  577. <section id="ipv6-subnet-id">
  578. <title>IPv6 Subnet Identifier</title>
  579. <para>
  580. The subnet identifier is a unique number associated with a particular subnet.
  581. In principle, it is used to associate clients' leases with their respective subnets.
  582. When a subnet identifier is not specified for a subnet being configured, it will
  583. be automatically assigned by the configuration mechanism. The identifiers
  584. are assigned from 1 and are monotonically increased for each subsequent
  585. subnet: 1, 2, 3 ....
  586. </para>
  587. <para>
  588. If there are multiple subnets configured with auto-generated identifiers and
  589. one of them is removed, the subnet identifiers may be renumbered. For example:
  590. if there are four subnets and the third is removed the last subnet will be assigned
  591. the identifier that the third subnet had before removal. As a result, the leases
  592. stored in the lease database for subnet 3 are now associated with
  593. subnet 4, something that may have unexpected consequences. It is planned
  594. to implement a mechanism to preserve auto-generated subnet ids in a
  595. future version of Kea. However, the only remedy for this issue
  596. at present is to
  597. manually specify a unique identifier for each subnet.
  598. </para>
  599. <para>
  600. The following configuration will assign the specified subnet
  601. identifier to the newly configured subnet:
  602. <screen>
  603. "Dhcp6": {
  604. "subnet6": [
  605. {
  606. "subnet": "2001:db8:1::/64",
  607. <userinput>"id": 1024</userinput>,
  608. ...
  609. }
  610. ]
  611. }
  612. </screen>
  613. This identifier will not change for this subnet unless the "id" parameter is
  614. removed or set to 0. The value of 0 forces auto-generation of the subnet
  615. identifier.
  616. </para>
  617. <!-- @todo: describe whether database needs to be updated after changing
  618. id -->
  619. </section>
  620. <section id="dhcp6-unicast">
  621. <title>Unicast Traffic Support</title>
  622. <para>
  623. When the DHCPv6 server starts, by default it listens to the DHCP traffic
  624. sent to multicast address ff02::1:2 on each interface that it is
  625. configured to listen on (see <xref linkend="dhcp6-interface-selection"/>).
  626. In some cases it is useful to configure a server to handle incoming
  627. traffic sent to the global unicast addresses as well. The most common
  628. reason for this is to have relays send their traffic to the server
  629. directly. To configure the server to listen on a specific unicast address,
  630. nn interface name can be
  631. optionally followed by a slash, followed by the global unicast address on which
  632. the server should listen. The server listens to this address in addition to normal
  633. link-local binding and listening on ff02::1:2 address. The sample configuration
  634. below shows how to listen on 2001:db8::1 (a global address)
  635. configured on the eth1 interface.
  636. </para>
  637. <para>
  638. <screen>
  639. "Dhcp6": {
  640. "interfaces-config": {
  641. "interfaces": [ <userinput>"eth1/2001:db8::1"</userinput> ]
  642. },
  643. ...
  644. "option-data": [
  645. {
  646. "name": "unicast",
  647. "data": "2001:db8::1"
  648. } ],
  649. ...
  650. }
  651. </screen>
  652. This configuration will cause the server to listen on
  653. eth1 on the link-local address, the multicast group (ff02::1:2) and 2001:db8::1.
  654. </para>
  655. <para>
  656. Usually unicast support is associated with a server unicast option
  657. which allows clients to send unicast messages to the server.
  658. The example above includes a server unicast option specification
  659. which will cause the client to send messages to the specified
  660. unicast address.
  661. </para>
  662. <para>
  663. It is possible to mix interface names, wildcards and interface name/addresses
  664. in the list of interfaces. It is not possible however to specify more than one
  665. unicast address on a given interface.
  666. </para>
  667. <para>
  668. Care should be taken to specify proper unicast addresses. The server will
  669. attempt to bind to the addresses specified without any additional checks.
  670. This approach has selected on purpose to allow the software to
  671. communicate over uncommon addresses if so desired.
  672. </para>
  673. </section>
  674. <section id="dhcp6-address-config">
  675. <title>Subnet and Address Pool</title>
  676. <para>
  677. The main role of a DHCPv6 server is address assignment. For this,
  678. the server has to be configured with at least one subnet and one pool of dynamic
  679. addresses to be managed. For example, assume that the server
  680. is connected to a network segment that uses the 2001:db8:1::/64
  681. prefix. The Administrator of that network has decided that addresses from range
  682. 2001:db8:1::1 to 2001:db8:1::ffff are going to be managed by the Dhcp6
  683. server. Such a configuration can be achieved in the following way:
  684. <screen>
  685. "Dhcp6": {
  686. <userinput>"subnet6": [
  687. {
  688. "subnet": "2001:db8:1::/64",
  689. "pools": [
  690. {
  691. "pool": "2001:db8:1::1-2001:db8:1::ffff"
  692. }
  693. ],
  694. ...
  695. }
  696. ]</userinput>
  697. }</screen>
  698. Note that <command>subnet</command> is defined as a simple string, but
  699. the <command>pools</command> parameter is actually a list of pools: for
  700. this reason, the pool definition is enclosed in square brackets, even
  701. though only one range of addresses is specified.</para>
  702. <para>Each <command>pool</command> is a structure that contains the
  703. parameters that describe a single pool. Currently there is only one
  704. parameter, <command>pool</command>, which gives the range of addresses
  705. in the pool. Additional parameters will be added in future releases of
  706. Kea.</para>
  707. <para>It is possible to define more than one pool in a
  708. subnet: continuing the previous example, further assume that
  709. 2001:db8:1:0:5::/80 should also be managed by the server. It could be written as
  710. 2001:db8:1:0:5:: to 2001:db8:1::5:ffff:ffff:ffff, but typing so many 'f's
  711. is cumbersome. It can be expressed more simply as 2001:db8:1:0:5::/80. Both
  712. formats are supported by Dhcp6 and can be mixed in the pool list.
  713. For example, one could define the following pools:
  714. <screen>
  715. "Dhcp6": {
  716. <userinput>"subnet6": [
  717. {
  718. "subnet": "2001:db8:1::/64",
  719. "pools": [
  720. { "pool": "2001:db8:1::1-2001:db8:1::ffff" },
  721. { "pool": "2001:db8:1:05::/80" }
  722. ]</userinput>,
  723. ...
  724. }
  725. ]
  726. }</screen>
  727. White space in pool definitions is ignored, so spaces before and after the hyphen are optional.
  728. They can be used to improve readability.
  729. </para>
  730. <para>
  731. The number of pools is not limited, but for performance reasons it is recommended to
  732. use as few as possible.
  733. </para>
  734. <para>
  735. The server may be configured to serve more than one subnet. To add a second subnet,
  736. use a command similar to the following:
  737. <screen>
  738. "Dhcp6": {
  739. <userinput>"subnet6": [
  740. {
  741. "subnet": "2001:db8:1::/64",
  742. "pools": [
  743. { "pool": "2001:db8:1::1-2001:db8:1::ffff" }
  744. ]
  745. },
  746. {
  747. "subnet": "2001:db8:2::/64",
  748. "pools": [
  749. { "pool": "2001:db8:2::/64" }
  750. ]
  751. },
  752. </userinput>
  753. ...
  754. ]
  755. }</screen>
  756. In this example, we allow the server to
  757. dynamically assign all addresses available in the whole subnet. Although
  758. rather wasteful, it is certainly a valid configuration to dedicate the
  759. whole /64 subnet for that purpose. Note that the Kea server does not preallocate
  760. the leases, so there is no danger in using gigantic address pools.
  761. </para>
  762. <para>
  763. When configuring a DHCPv6 server using prefix/length notation, please pay
  764. attention to the boundary values. When specifying that the server can use
  765. a given pool, it will also be able to allocate the first (typically network
  766. address) address from that pool. For example, for pool 2001:db8:2::/64 the
  767. 2001:db8:2:: address may be assigned as well. If you want to avoid this,
  768. use the "min-max" notation.
  769. </para>
  770. </section>
  771. <section>
  772. <title>Subnet and Prefix Delegation Pools</title>
  773. <para>
  774. Subnets may also be configured to delegate prefixes, as defined in
  775. <ulink url="http://tools.ietf.org/html/rfc3633">RFC 3633</ulink>. A
  776. subnet may have one or more prefix delegation pools. Each pool has a
  777. prefixed address, which is specified as a prefix
  778. (<command>prefix</command>) and a prefix length
  779. (<command>prefix-len</command>), as well as a delegated prefix length
  780. (<command>delegated-len</command>). The delegated length must not be
  781. shorter (that is it must be numerically greater or equal) than the
  782. prefix length. If both the delegated and prefix lengths are equal, the
  783. server will be able to delegate only one prefix. The delegated prefix
  784. does not have to match the subnet prefix.
  785. </para>
  786. <para> Below is a sample subnet configuration which enables prefix
  787. delegation for the subnet:
  788. <screen>
  789. "Dhcp6": {
  790. "subnet6": [
  791. {
  792. "subnet": "2001:d8b:1::/64",
  793. <userinput>"pd-pools": [
  794. {
  795. "prefix": "3000:1::",
  796. "prefix-len": 64,
  797. "delegated-len": 96
  798. }
  799. ]</userinput>
  800. }
  801. ],
  802. ...
  803. }</screen>
  804. </para>
  805. </section>
  806. <section id="pd-exclude-option">
  807. <title>Prefix Exclude Option</title>
  808. <para>
  809. For each delegated prefix the delegating router may choose to exclude
  810. a single prefix out of the delegated prefix as specified in the
  811. <ulink url="http://tools.ietf.org/html/rfc6603"> RFC 6603</ulink>.
  812. The requesting router must not assign the excluded prefix to any
  813. of its downstream interfaces and it is intended to be used on a
  814. link through which the delegating router exchanges DHCPv6 messages with
  815. the requesting router. The configuration example below demonstrates how
  816. to specify an excluded prefix within a prefix pool definition. The
  817. excluded prefix "2001:db8:1:babe:cafe:80::/72" will be sent to a
  818. requesting router which includes Prefix Exclude option in the ORO, and
  819. which is delegated a prefix from this pool.
  820. </para>
  821. <screen>
  822. "Dhcp6": {
  823. "subnet6": [
  824. {
  825. "subnet": "2001:db8:1::/48",
  826. "pd-pools": [
  827. {
  828. "prefix": "2001:db8:1:8000::",
  829. "prefix-len": 48,
  830. "delegated-len": 64,
  831. "excluded-prefix": "2001:db8:1:babe:cafe:80::",
  832. "excluded-prefix-len": 72
  833. }
  834. ]
  835. }
  836. ]
  837. }
  838. </screen>
  839. </section>
  840. <section id="dhcp6-std-options">
  841. <title>Standard DHCPv6 Options</title>
  842. <para>
  843. One of the major features of a DHCPv6 server is to provide configuration
  844. options to clients. Although there are several options that require
  845. special behavior, most options are sent by the server only if the client
  846. explicitly requests them. The following example shows how to
  847. configure DNS servers, one of the most frequently used
  848. options. Options specified in this way are considered
  849. global and apply to all configured subnets.
  850. <screen>
  851. "Dhcp6": {
  852. "option-data": [
  853. {
  854. <userinput>"name": "dns-servers",
  855. "code": 23,
  856. "space": "dhcp6",
  857. "csv-format": true,
  858. "data": "2001:db8::cafe, 2001:db8::babe"</userinput>
  859. },
  860. ...
  861. ]
  862. }
  863. </screen>
  864. </para>
  865. <para>
  866. The <command>option-data</command> line creates a new entry in
  867. the option-data table. This table contains
  868. information on all global options that the server is supposed to configure
  869. in all subnets. The <command>name</command> line specifies the option name.
  870. (For a complete list
  871. of currently supported names, see <xref
  872. linkend="dhcp6-std-options-list"/>.) The next line specifies the option code,
  873. which must match one of the values from that list. The line beginning with
  874. <command>space</command> specifies the option space, which must always be set
  875. to "dhcp6" as these are standard DHCPv6 options. For other name spaces,
  876. including custom option spaces, see <xref
  877. linkend="dhcp6-option-spaces"/>. The following line specifies the format in
  878. which the data will be entered: use of CSV (comma separated values) is
  879. recommended. Finally, the <command>data</command> line gives the actual value to be sent to
  880. clients. Data is specified as normal text, with values separated by
  881. commas if more than one value is allowed.
  882. </para>
  883. <para>
  884. Options can also be configured as hexadecimal values. If "csv-format" is
  885. set to false, the option data must be specified as a string of hexadecimal
  886. numbers. The
  887. following commands configure the DNS-SERVERS option for all
  888. subnets with the following addresses: 2001:db8:1::cafe and
  889. 2001:db8:1::babe.
  890. <screen>
  891. "Dhcp6": {
  892. "option-data": [
  893. {
  894. <userinput>"name": "dns-servers",
  895. "code": 23,
  896. "space": "dhcp6",
  897. "csv-format": false,
  898. "data": "2001 0DB8 0001 0000 0000 0000 0000 CAFE
  899. 2001 0DB8 0001 0000 0000 0000 0000 BABE"</userinput>
  900. },
  901. ...
  902. ]
  903. }
  904. </screen>
  905. </para>
  906. <note><para>
  907. The value for the setting of the "data" element is split across two
  908. lines in this example for clarity: when entering the command, the
  909. whole string should be entered on the same line.
  910. </para></note>
  911. <para>
  912. Care should be taken
  913. to use proper encoding when using hexadecimal format as Kea's ability
  914. to validate data correctness in hexadecimal is limited.
  915. </para>
  916. <para>
  917. Most of the parameters in the "option-data" structure are
  918. optional and can be omitted in some circumstances as discussed
  919. in the <xref linkend="dhcp6-option-data-defaults"/>. Only one
  920. of name or code is required, so you don't need to specify
  921. both. Space has a default value of "dhcp6", so you can skip
  922. this as well if you define a regular (not encapsulated) DHCPv6
  923. option. Finally, csv-format defaults to true, so it too can
  924. be skipped, unless you want to specify the option value as
  925. hexstring. Therefore the above example can be simplified to:
  926. <screen>
  927. "Dhcp4": {
  928. "option-data": [
  929. {
  930. <userinput>"name": "dns-servers",
  931. "data": "2001:db8::cafe, 2001:db8::babe"</userinput>
  932. },
  933. ...
  934. ]
  935. } </screen>
  936. </para>
  937. <para>
  938. It is possible to override options on a per-subnet basis. If
  939. clients connected to most of your subnets are expected to get the
  940. same values of a given option, you should use global options: you
  941. can then override specific values for a small number of subnets.
  942. On the other hand, if you use different values in each subnet,
  943. it does not make sense to specify global option values
  944. (Dhcp6/option-data), rather you should set only subnet-specific values
  945. (Dhcp6/subnet[X]/option-data[Y]).
  946. </para>
  947. <para>
  948. The following commands override the global
  949. DNS servers option for a particular subnet, setting a single DNS
  950. server with address 2001:db8:1::3.
  951. <screen>
  952. "Dhcp6": {
  953. "subnet6": [
  954. {
  955. <userinput>"option-data": [
  956. {
  957. "name": "dns-servers",
  958. "code": 23,
  959. "space": "dhcp6",
  960. "csv-format": true,
  961. "data": "2001:db8:1::3"
  962. },
  963. ...
  964. ]</userinput>,
  965. ...
  966. },
  967. ...
  968. ],
  969. ...
  970. }
  971. </screen>
  972. </para>
  973. <para>
  974. In some cases it is useful to associate some options with an
  975. address or prefix pool from which a client is assigned a lease. Pool
  976. specific option values override subnet specific and global option
  977. values. If the client is assigned multiple leases from different
  978. pools, the server will assign options from all pools from which the
  979. leases have been obtained. However, if the particular option is specified
  980. in multiple pools from which the client obtains the leases, only one
  981. instance of this option will be handed out to the client. The server's
  982. administrator must not try to prioritize assignment of pool specific
  983. options by trying to order pools declarations in the server
  984. configuration. Future Kea releases may change the order in which
  985. options are assigned from the pools without any notice.
  986. </para>
  987. <para>
  988. The following configuration snippet demonstrates how to specify the
  989. DNS servers option, which will be assigned to a client only if the
  990. client obtains an address from the given pool:
  991. <screen>
  992. "Dhcp6": {
  993. "subnet6": [
  994. {
  995. "pools": [
  996. {
  997. "pool": "2001:db8:1::100-2001:db8:1::300",
  998. <userinput>"option-data": [
  999. {
  1000. "name": "dns-servers",
  1001. "data": "2001:db8:1::10"
  1002. }
  1003. ]</userinput>
  1004. }
  1005. ]
  1006. },
  1007. ...
  1008. ],
  1009. ...
  1010. }
  1011. </screen>
  1012. </para>
  1013. <para>
  1014. The currently supported standard DHCPv6 options are
  1015. listed in <xref linkend="dhcp6-std-options-list"/>.
  1016. The "Name" and "Code"
  1017. are the values that should be used as a name in the option-data
  1018. structures. "Type" designates the format of the data: the meanings of
  1019. the various types is given in <xref linkend="dhcp-types"/>.
  1020. </para>
  1021. <para>
  1022. Experimental options (like standard options but with a code
  1023. which was not assigned by IANA) are listed in
  1024. <xref linkend="dhcp6-exp-options-list"/>.
  1025. </para>
  1026. <para>When a data field is a string, and that string contains
  1027. the comma (,; U+002C) character, the comma must be escaped with a
  1028. reverse solidus character (\; U+005C). This double escape is
  1029. required, because both the routine splitting CSV data into fields
  1030. and JSON use the same escape character: a single escape (\,) would
  1031. make the JSON invalid. For example, the string
  1032. &quot;EST5EDT4,M3.2.0/02:00,M11.1.0/02:00&quot; would be
  1033. represented as:
  1034. <screen>
  1035. "Dhcp6": {
  1036. "subnet6": [
  1037. {
  1038. "pools": [
  1039. {
  1040. <userinput>"option-data": [
  1041. {
  1042. "name": "new-posix-timezone",
  1043. "data": "EST5EDT4\,M3.2.0/02:00\,M11.1.0/02:00"
  1044. }
  1045. ]</userinput>
  1046. },
  1047. ...
  1048. ],
  1049. ...
  1050. },
  1051. ...
  1052. ],
  1053. ...
  1054. }
  1055. </screen>
  1056. </para>
  1057. <para>
  1058. Some options are designated as arrays, which means that more than one
  1059. value is allowed in such an option. For example the option dns-servers
  1060. allows the specification of more than one IPv6 address, allowing
  1061. clients to obtain the addresses of multiple DNS servers.
  1062. </para>
  1063. <!-- @todo: describe record types -->
  1064. <para>
  1065. The <xref linkend="dhcp6-custom-options"/> describes the configuration
  1066. syntax to create custom option definitions (formats). It is generally not
  1067. allowed to create custom definitions for standard options, even if the
  1068. definition being created matches the actual option format defined in the
  1069. RFCs. There is an exception from this rule for standard options for which
  1070. Kea does not yes provide a definition. In order to use such options,
  1071. a server administrator must create a definition as described in
  1072. <xref linkend="dhcp6-custom-options"/> in the 'dhcp6' option space. This
  1073. definition should match the option format described in the relevant
  1074. RFC but the configuration mechanism would allow any option format as it has
  1075. no means to validate the format at the moment.
  1076. </para>
  1077. <para>
  1078. <table frame="all" id="dhcp6-std-options-list">
  1079. <title>List of Standard DHCPv6 Options</title>
  1080. <tgroup cols='4'>
  1081. <colspec colname='name'/>
  1082. <colspec colname='code' align='center'/>
  1083. <colspec colname='type' align='center'/>
  1084. <colspec colname='array' align='center'/>
  1085. <thead>
  1086. <row><entry>Name</entry><entry>Code</entry><entry>Type</entry><entry>Array?</entry></row>
  1087. </thead>
  1088. <tbody>
  1089. <!-- Our engine uses those options on its own, admin must not configure them on his own
  1090. <row><entry>clientid</entry><entry>1</entry><entry>binary</entry><entry>false</entry></row>
  1091. <row><entry>serverid</entry><entry>2</entry><entry>binary</entry><entry>false</entry></row>
  1092. <row><entry>ia-na</entry><entry>3</entry><entry>record</entry><entry>false</entry></row>
  1093. <row><entry>ia-ta</entry><entry>4</entry><entry>uint32</entry><entry>false</entry></row>
  1094. <row><entry>iaaddr</entry><entry>5</entry><entry>record</entry><entry>false</entry></row>
  1095. <row><entry>oro</entry><entry>6</entry><entry>uint16</entry><entry>true</entry></row> -->
  1096. <row><entry>preference</entry><entry>7</entry><entry>uint8</entry><entry>false</entry></row>
  1097. <!-- Our engine uses those options on its own, admin must not configure them on his own
  1098. <row><entry>elapsed-time</entry><entry>8</entry><entry>uint16</entry><entry>false</entry></row>
  1099. <row><entry>relay-msg</entry><entry>9</entry><entry>binary</entry><entry>false</entry></row>
  1100. <row><entry>auth</entry><entry>11</entry><entry>binary</entry><entry>false</entry></row>
  1101. -->
  1102. <row><entry>unicast</entry><entry>12</entry><entry>ipv6-address</entry><entry>false</entry></row>
  1103. <!--
  1104. <row><entry>status-code</entry><entry>13</entry><entry>record</entry><entry>false</entry></row>
  1105. <row><entry>rapid-commit</entry><entry>14</entry><entry>empty</entry><entry>false</entry></row>
  1106. <row><entry>user-class</entry><entry>15</entry><entry>binary</entry><entry>false</entry></row>
  1107. <row><entry>vendor-class</entry><entry>16</entry><entry>record</entry><entry>false</entry></row>
  1108. -->
  1109. <!-- Vendor-specific Information is configurable by the administrator -->
  1110. <row><entry>vendor-opts</entry><entry>17</entry><entry>uint32</entry><entry>false</entry></row>
  1111. <!--
  1112. <row><entry>interface-id</entry><entry>18</entry><entry>binary</entry><entry>false</entry></row>
  1113. <row><entry>reconf-msg</entry><entry>19</entry><entry>uint8</entry><entry>false</entry></row>
  1114. <row><entry>reconf-accept</entry><entry>20</entry><entry>empty</entry><entry>false</entry></row> -->
  1115. -->
  1116. <row><entry>sip-server-dns</entry><entry>21</entry><entry>fqdn</entry><entry>true</entry></row>
  1117. <row><entry>sip-server-addr</entry><entry>22</entry><entry>ipv6-address</entry><entry>true</entry></row>
  1118. <row><entry>dns-servers</entry><entry>23</entry><entry>ipv6-address</entry><entry>true</entry></row>
  1119. <row><entry>domain-search</entry><entry>24</entry><entry>fqdn</entry><entry>true</entry></row>
  1120. <!-- <row><entry>ia-pd</entry><entry>25</entry><entry>record</entry><entry>false</entry></row> -->
  1121. <!-- <row><entry>iaprefix</entry><entry>26</entry><entry>record</entry><entry>false</entry></row> -->
  1122. <row><entry>nis-servers</entry><entry>27</entry><entry>ipv6-address</entry><entry>true</entry></row>
  1123. <row><entry>nisp-servers</entry><entry>28</entry><entry>ipv6-address</entry><entry>true</entry></row>
  1124. <row><entry>nis-domain-name</entry><entry>29</entry><entry>fqdn</entry><entry>true</entry></row>
  1125. <row><entry>nisp-domain-name</entry><entry>30</entry><entry>fqdn</entry><entry>true</entry></row>
  1126. <row><entry>sntp-servers</entry><entry>31</entry><entry>ipv6-address</entry><entry>true</entry></row>
  1127. <row><entry>information-refresh-time</entry><entry>32</entry><entry>uint32</entry><entry>false</entry></row>
  1128. <row><entry>bcmcs-server-dns</entry><entry>33</entry><entry>fqdn</entry><entry>true</entry></row>
  1129. <row><entry>bcmcs-server-addr</entry><entry>34</entry><entry>ipv6-address</entry><entry>true</entry></row>
  1130. <row><entry>geoconf-civic</entry><entry>36</entry><entry>record (uint8, uint16, binary)</entry><entry>false</entry></row>
  1131. <row><entry>remote-id</entry><entry>37</entry><entry>record (uint32, binary)</entry><entry>false</entry></row>
  1132. <row><entry>subscriber-id</entry><entry>38</entry><entry>binary</entry><entry>false</entry></row>
  1133. <row><entry>client-fqdn</entry><entry>39</entry><entry>record (uint8, fqdn)</entry><entry>false</entry></row>
  1134. <row><entry>pana-agent</entry><entry>40</entry><entry>ipv6-address</entry><entry>true</entry></row>
  1135. <row><entry>new-posix-timezone</entry><entry>41</entry><entry>string</entry><entry>false</entry></row>
  1136. <row><entry>new-tzdb-timezone</entry><entry>42</entry><entry>string</entry><entry>false</entry></row>
  1137. <row><entry>ero</entry><entry>43</entry><entry>uint16</entry><entry>true</entry></row>
  1138. <row><entry>lq-query</entry><entry>44</entry><entry>record (uint8, ipv6-address)</entry><entry>false</entry></row>
  1139. <row><entry>client-data</entry><entry>45</entry><entry>empty</entry><entry>false</entry></row>
  1140. <row><entry>clt-time</entry><entry>46</entry><entry>uint32</entry><entry>false</entry></row>
  1141. <row><entry>lq-relay-data</entry><entry>47</entry><entry>record (ipv6-address, binary)</entry><entry>false</entry></row>
  1142. <row><entry>lq-client-link</entry><entry>48</entry><entry>ipv6-address</entry><entry>true</entry></row>
  1143. <row><entry>bootfile-url</entry><entry>59</entry><entry>string</entry><entry>false</entry></row>
  1144. <row><entry>bootfile-param</entry><entry>60</entry><entry>tuple</entry><entry>true</entry></row>
  1145. <row><entry>client-arch-type</entry><entry>61</entry><entry>uint16</entry><entry>true</entry></row>
  1146. <row><entry>nii</entry><entry>62</entry><entry>record (uint8, uint8, uint8)</entry><entry>false</entry></row>
  1147. <row><entry>aftr-name</entry><entry>64</entry><entry>fqdn</entry><entry>false</entry></row>
  1148. <row><entry>erp-local-domain-name</entry><entry>65</entry><entry>fqdn</entry><entry>false</entry></row>
  1149. <row><entry>rsoo</entry><entry>66</entry><entry>empty</entry><entry>false</entry></row>
  1150. <row><entry>pd-exclude</entry><entry>67</entry><entry>binary</entry><entry>false</entry></row>
  1151. <row><entry>client-linklayer-addr</entry><entry>79</entry><entry>binary</entry><entry>false</entry></row>
  1152. <!-- <row><entry>dhcpv4-message</entry><entry>87</entry><entry>binary</entry><entry>false</entry></row> -->
  1153. <row><entry>dhcp4o6-server-addr</entry><entry>88</entry><entry>ipv6-address</entry><entry>true</entry></row>
  1154. </tbody>
  1155. </tgroup>
  1156. </table>
  1157. </para>
  1158. <para>
  1159. <table frame="all" id="dhcp6-exp-options-list">
  1160. <title>List of Experimental DHCPv6 Options</title>
  1161. <tgroup cols='4'>
  1162. <colspec colname='name'/>
  1163. <colspec colname='code' align='center'/>
  1164. <colspec colname='type' align='center'/>
  1165. <colspec colname='array' align='center'/>
  1166. <thead>
  1167. <row><entry>Name</entry><entry>Code</entry><entry>Type</entry><entry>Array?</entry></row>
  1168. </thead>
  1169. <tbody>
  1170. <row><entry>public-key</entry><entry>701</entry><entry>binary</entry><entry>false</entry></row>
  1171. <row><entry>certificate</entry><entry>702</entry><entry>binary</entry><entry>false</entry></row>
  1172. <row><entry>signature</entry><entry>703</entry><entry>record (uint8, uint8, binary)</entry><entry>false</entry></row>
  1173. <row><entry>timestamp</entry><entry>704</entry><entry>binary</entry><entry>false</entry></row>
  1174. </tbody>
  1175. </tgroup>
  1176. </table>
  1177. </para>
  1178. </section>
  1179. <section id="dhcp6-custom-options">
  1180. <title>Custom DHCPv6 Options</title>
  1181. <para>It is possible to define options in addition to the standard ones.
  1182. Assume that we want to define a new DHCPv6 option called "foo" which will have
  1183. code 100 and which will convey a single unsigned 32 bit integer value. We can define
  1184. such an option by using the following commands:
  1185. <screen>
  1186. "Dhcp6": {
  1187. "option-def": [
  1188. {
  1189. <userinput>"name": "foo",
  1190. "code": 100,
  1191. "type": "uint32",
  1192. "array": false,
  1193. "record-types": "",
  1194. "space": "dhcp6",
  1195. "encapsulate": ""</userinput>
  1196. }, ...
  1197. ],
  1198. ...
  1199. }
  1200. </screen>
  1201. The "false" value of the <command>array</command> parameter determines that the option does
  1202. NOT comprise an array of "uint32" values but rather a single value. Two
  1203. other parameters have been left blank: <command>record-types</command> and
  1204. <command>encapsulate</command>.
  1205. The former specifies the comma separated list of option data fields if the
  1206. option comprises a record of data fields. The <command>record-types</command> value should
  1207. be non-empty if the <command>type</command> is set to "record". Otherwise it must be left
  1208. blank. The latter parameter specifies the name of the option space being
  1209. encapsulated by the particular option. If the particular option does not
  1210. encapsulate any option space it should be left blank. Note that the above
  1211. example only defines the format of the new option, it does not set its
  1212. value(s).
  1213. </para>
  1214. <para>The <command>name</command>, <command>code</command> and
  1215. <command>type</command> parameters are required, all others are
  1216. optional. The <command>array</command> default value is
  1217. <command>false</command>. The <command>record-types</command>
  1218. and <command>encapsulate</command> default values are blank
  1219. (i.e. ""). The default <command>space</command> is "dhcp6".
  1220. </para>
  1221. <para>Once the new option format is defined, its value is set
  1222. in the same way as for a standard option. For example the following
  1223. commands set a global value that applies to all subnets.
  1224. <screen>
  1225. "Dhcp6": {
  1226. "option-data": [
  1227. {
  1228. <userinput>"name": "foo",
  1229. "code": 100,
  1230. "space": "dhcp6",
  1231. "csv-format": true,
  1232. "data": "12345"</userinput>
  1233. }, ...
  1234. ],
  1235. ...
  1236. }
  1237. </screen>
  1238. </para>
  1239. <para>New options can take more complex forms than simple use of
  1240. primitives (uint8, string, ipv6-address etc): it is possible to
  1241. define an option comprising a number of existing primitives.
  1242. </para>
  1243. <para>
  1244. For example, assume we want to define a new option that will consist of an IPv6
  1245. address, followed by an unsigned 16 bit integer, followed by a
  1246. boolean value, followed by a text string. Such an option could
  1247. be defined in the following way:
  1248. <screen>
  1249. "Dhcp6": {
  1250. "option-def": [
  1251. {
  1252. <userinput>"name": "bar",
  1253. "code": 101,
  1254. "space": "dhcp6",
  1255. "type": "record",
  1256. "array": false,
  1257. "record-types": "ipv6-address, uint16, boolean, string",
  1258. "encapsulate": ""</userinput>
  1259. }, ...
  1260. ],
  1261. ...
  1262. }
  1263. </screen>
  1264. The "type" is set to "record" to indicate that the option contains
  1265. multiple values of different types. These types are given as a comma-separated
  1266. list in the "record-types" field and should be those listed in <xref linkend="dhcp-types"/>.
  1267. </para>
  1268. <para>
  1269. The values of the option are set as follows:
  1270. <screen>
  1271. "Dhcp6": {
  1272. "option-data": [
  1273. {
  1274. <userinput>"name": "bar",
  1275. "space": "dhcp6",
  1276. "code": 101,
  1277. "csv-format": true,
  1278. "data": "2001:db8:1::10, 123, false, Hello World"</userinput>
  1279. }
  1280. ],
  1281. ...
  1282. }</screen>
  1283. <command>csv-format</command> is set <command>true</command> to indicate
  1284. that the <command>data</command> field comprises a command-separated list
  1285. of values. The values in the "data" must correspond to the types set in
  1286. the "record-types" field of the option definition.
  1287. </para>
  1288. <note>
  1289. <para>In the general case, boolean values are specified as <command>true</command> or
  1290. <command>false</command>, without quotes. Some specific boolean parameters may
  1291. accept also <command>"true"</command>, <command>"false"</command>,
  1292. <command>0</command>, <command>1</command>, <command>"0"</command> and
  1293. <command>"1"</command>. Future versions of Kea will accept all those values
  1294. for all boolean parameters.</para>
  1295. </note>
  1296. </section>
  1297. <section id="dhcp6-vendor-opts">
  1298. <title>DHCPv6 Vendor-Specific Options</title>
  1299. <para>
  1300. Currently there are two option spaces defined for the DHCPv6
  1301. daemon: "dhcp6" (for top level DHCPv6 options) and "vendor-opts-space",
  1302. which is empty by default, but in which options can be defined.
  1303. Those options will be carried in the Vendor-Specific
  1304. Information option (code 17). The following examples show how to
  1305. define an option "foo" with code 1 that consists of an IPv6 address,
  1306. an unsigned 16 bit integer and a string. The "foo" option is
  1307. conveyed in a Vendor-Specific Information option. This option
  1308. comprises a single uint32 value that is set to "12345".
  1309. The sub-option "foo" follows the data field holding this value.
  1310. <screen>
  1311. "Dhcp6": {
  1312. "option-def": [
  1313. {
  1314. <userinput>"name": "foo",
  1315. "code": 1,
  1316. "space": "vendor-opts-space",
  1317. "type": "record",
  1318. "array": false,
  1319. "record-types": "ipv6-address, uint16, string",
  1320. "encapsulate": ""</userinput>
  1321. }
  1322. ],
  1323. ...
  1324. }</screen>
  1325. (Note that the option space is set to <command>vendor-opts-space</command>.)
  1326. Once the option format is defined, the next step is to define actual values
  1327. for that option:
  1328. <screen>
  1329. "Dhcp6": {
  1330. "option-data": [
  1331. {
  1332. <userinput>"name": "foo",
  1333. "space": "vendor-opts-space",
  1334. "data": "2001:db8:1::10, 123, Hello World"</userinput>
  1335. },
  1336. ...
  1337. ],
  1338. ...
  1339. }</screen>
  1340. We should also define a value (enterprise-number) for the
  1341. Vendor-specific Information option, that conveys our option "foo".
  1342. <screen>
  1343. "Dhcp6": {
  1344. "option-data": [
  1345. ...,
  1346. {
  1347. <userinput>"name": "vendor-opts",
  1348. "data": "12345"</userinput>
  1349. }
  1350. ],
  1351. ...
  1352. }</screen>
  1353. Alternatively, the option can be specified using its code.
  1354. <screen>
  1355. "Dhcp6": {
  1356. "option-data": [
  1357. ...,
  1358. {
  1359. <userinput>"code": 17,
  1360. "data": "12345"</userinput>
  1361. }
  1362. ],
  1363. ...
  1364. }</screen>
  1365. </para>
  1366. </section>
  1367. <section id="dhcp6-option-spaces">
  1368. <title>Nested DHCPv6 Options (Custom Option Spaces)</title>
  1369. <para>It is sometimes useful to define completely new option
  1370. spaces. This is useful if the user wants their new option to
  1371. convey sub-options that use a separate numbering scheme, for
  1372. example sub-options with codes 1 and 2. Those option codes
  1373. conflict with standard DHCPv6 options, so a separate option
  1374. space must be defined.
  1375. </para>
  1376. <para>Note that it is not required to create a new option space when
  1377. defining sub-options for a standard option because it is
  1378. created by default if the standard option is meant to convey
  1379. any sub-options (see <xref linkend="dhcp6-vendor-opts"/>).
  1380. </para>
  1381. <para>
  1382. Assume that we want to have a DHCPv6 option called "container"
  1383. with code 102 that conveys two sub-options with codes 1 and 2.
  1384. First we need to define the new sub-options:
  1385. <screen>
  1386. "Dhcp6": {
  1387. "option-def": [
  1388. {
  1389. <userinput>"name": "subopt1",
  1390. "code": 1,
  1391. "space": "isc",
  1392. "type": "ipv6-address",
  1393. "record-types": "",
  1394. "array": false,
  1395. "encapsulate": ""</userinput>
  1396. },
  1397. {
  1398. <userinput>"name": "subopt2",
  1399. "code": 2,
  1400. "space": "isc",
  1401. "type": "string",
  1402. "record-types": "",
  1403. "array": false
  1404. "encapsulate": ""</userinput>
  1405. }
  1406. ],
  1407. ...
  1408. }</screen>
  1409. Note that we have defined the options to belong to a new option space
  1410. (in this case, "isc").
  1411. </para>
  1412. <para>
  1413. The next step is to define a regular DHCPv6 option and specify that it
  1414. should include options from the isc option space:
  1415. <screen>
  1416. "Dhcp6": {
  1417. "option-def": [
  1418. ...,
  1419. {
  1420. <userinput>"name": "container",
  1421. "code": 102,
  1422. "space": "dhcp6",
  1423. "type": "empty",
  1424. "array": false,
  1425. "record-types": "",
  1426. "encapsulate": "isc"</userinput>
  1427. }
  1428. ],
  1429. ...
  1430. }</screen>
  1431. The name of the option space in which the sub-options are defined is set in
  1432. the <command>encapsulate</command> field. The <command>type</command> field
  1433. is set to <command>empty</command> which limits this option to only carrying
  1434. data in sub-options.
  1435. </para>
  1436. <para>
  1437. Finally, we can set values for the new options:
  1438. <screen>
  1439. "Dhcp6": {
  1440. "option-data": [
  1441. {
  1442. <userinput>"name": "subopt1",
  1443. "code": 1,
  1444. "space": "isc",
  1445. "data": "2001:db8::abcd"</userinput>
  1446. },
  1447. }
  1448. <userinput>"name": "subopt2",
  1449. "code": 2,
  1450. "space": "isc",
  1451. "data": "Hello world"</userinput>
  1452. },
  1453. {
  1454. <userinput>"name": "container",
  1455. "code": 102,
  1456. "space": "dhcp6"</userinput>
  1457. }
  1458. ],
  1459. ...
  1460. }
  1461. </screen>
  1462. </para>
  1463. <para>Note that it is possible to create an option which carries some data
  1464. in addition to the sub-options defined in the encapsulated option space.
  1465. For example, if the "container" option from the previous example was
  1466. required to carry an uint16 value as well as the sub-options, the "type"
  1467. value would have to be set to "uint16" in the option definition. (Such an
  1468. option would then have the following data structure: DHCP header, uint16
  1469. value, sub-options.) The value specified with the "data" parameter &mdash; which
  1470. should be a valid integer enclosed in quotes, e.g. "123" &mdash; would then be
  1471. assigned to the uint16 field in the "container" option.
  1472. </para>
  1473. </section>
  1474. <section id="dhcp6-option-data-defaults">
  1475. <title>Unspecified Parameters for DHCPv6 Option Configuration</title>
  1476. <para>In many cases it is not required to specify all parameters for
  1477. an option configuration and the default values can be used. However, it is
  1478. important to understand the implications of not specifying some of them
  1479. as it may result in configuration errors. The list below explains
  1480. the behavior of the server when a particular parameter is not explicitly
  1481. specified:
  1482. <itemizedlist>
  1483. <listitem>
  1484. <simpara><command>name</command> - the server requires an option name or
  1485. option code to identify an option. If this parameter is unspecified, the
  1486. option code must be specified.
  1487. </simpara>
  1488. </listitem>
  1489. <listitem>
  1490. <simpara><command>code</command> - the server requires an option name or
  1491. option code to identify an option. This parameter may be left unspecified if
  1492. the <command>name</command> parameter is specified. However, this also
  1493. requires that the particular option has its definition (it is either a
  1494. standard option or an administrator created a definition for the option
  1495. using an 'option-def' structure), as the option definition associates an
  1496. option with a particular name. It is possible to configure an option
  1497. for which there is no definition (unspecified option format).
  1498. Configuration of such options requires the use of option code.
  1499. </simpara>
  1500. </listitem>
  1501. <listitem>
  1502. <simpara><command>space</command> - if the option space is unspecified it
  1503. will default to 'dhcp6' which is an option space holding DHCPv6 standard
  1504. options.
  1505. </simpara>
  1506. </listitem>
  1507. <listitem>
  1508. <simpara><command>data</command> - if the option data is unspecified it
  1509. defaults to an empty value. The empty value is mostly used for the
  1510. options which have no payload (boolean options), but it is legal to specify
  1511. empty values for some options which carry variable length data and which
  1512. spec allows for the length of 0. For such options, the data parameter
  1513. may be omitted in the configuration.</simpara>
  1514. </listitem>
  1515. <listitem>
  1516. <simpara><command>csv-format</command> - if this value is not
  1517. specified the server will assume that the option data is specified as
  1518. a list of comma separated values to be assigned to individual fields
  1519. of the DHCP option. This behavior has changed in Kea 1.2. Older
  1520. versions used additional logic to determine whether the csv-format
  1521. should be true or false. That is no longer the case.
  1522. </simpara>
  1523. </listitem>
  1524. </itemizedlist>
  1525. </para>
  1526. </section>
  1527. <section id="dhcp6-config-subnets">
  1528. <title>IPv6 Subnet Selection</title>
  1529. <para>
  1530. The DHCPv6 server may receive requests from local (connected to the
  1531. same subnet as the server) and remote (connecting via relays) clients.
  1532. As the server may have many subnet configurations defined, it must select
  1533. an appropriate subnet for a given request.
  1534. </para>
  1535. <para>
  1536. The server can not assume which of the configured subnets are local. In IPv4
  1537. it is possible as there is a reasonable expectation that the
  1538. server will have a (global) IPv4 address configured on the interface,
  1539. and can use that information to detect whether a subnet is local or
  1540. not. That assumption is not true in IPv6: the DHCPv6 server must be able
  1541. to operate while only using link-local addresses. Therefore an optional
  1542. <command>interface</command> parameter is available within a subnet definition
  1543. to designate that a given subnet is local, i.e. reachable directly over
  1544. the specified interface. For example the server that is intended to serve
  1545. a local subnet over eth0 may be configured as follows:
  1546. <screen>
  1547. "Dhcp6": {
  1548. "subnet6": [
  1549. {
  1550. "subnet": "2001:db8:beef::/48",
  1551. "pools": [
  1552. {
  1553. "pool": "2001:db8:beef::/48"
  1554. }
  1555. ],
  1556. <userinput>"interface": "eth0"</userinput>
  1557. }
  1558. ],
  1559. ...
  1560. }
  1561. </screen>
  1562. </para>
  1563. </section>
  1564. <section id="dhcp6-rapid-commit">
  1565. <title>Rapid Commit</title>
  1566. <para>The Rapid Commit option, described in
  1567. <ulink url="http://tools.ietf.org/html/rfc3315">RFC 3315</ulink>, is supported
  1568. by the Kea DHCPv6 server. However, support is disabled by default for
  1569. all subnets. It can be enabled for a particular subnet using the
  1570. <command>rapid-commit</command> parameter as shown below:
  1571. <screen>
  1572. "Dhcp6": {
  1573. "subnet6": [
  1574. {
  1575. "subnet": "2001:db8:beef::/48",
  1576. <userinput>"rapid-commit": true</userinput>,
  1577. "pools": [
  1578. {
  1579. "pool": "2001:db8:beef::1-2001:db8:beef::10"
  1580. }
  1581. ],
  1582. }
  1583. ],
  1584. ...
  1585. }
  1586. </screen>
  1587. </para>
  1588. <para>
  1589. This setting only affects the subnet for which the
  1590. <command>rapid-commit</command> is set to <command>true</command>.
  1591. For clients connected to other subnets, the server will ignore the
  1592. Rapid Commit option sent by the client and will follow the 4-way
  1593. exchange procedure, i.e. respond with an Advertise for a Solicit
  1594. containing a Rapid Commit option.
  1595. </para>
  1596. </section>
  1597. <section id="dhcp6-relays">
  1598. <title>DHCPv6 Relays</title>
  1599. <para>
  1600. A DHCPv6 server with multiple subnets defined must select the
  1601. appropriate subnet when it receives a request from a client. For clients
  1602. connected via relays, two mechanisms are used:
  1603. </para>
  1604. <para>
  1605. The first uses the linkaddr field in the RELAY_FORW message. The name
  1606. of this field is somewhat misleading in that it does not contain a link-layer
  1607. address: instead, it holds an address (typically a global address) that is
  1608. used to identify a link. The DHCPv6 server checks if the address belongs
  1609. to a defined subnet and, if it does, that subnet is selected for the client's
  1610. request.
  1611. </para>
  1612. <para>
  1613. The second mechanism is based on interface-id options. While forwarding a client's
  1614. message, relays may insert an interface-id option into the message that
  1615. identifies the interface on the relay that received the message. (Some
  1616. relays allow configuration of that parameter, but it is sometimes
  1617. hardcoded and may range from the very simple (e.g. "vlan100") to the very cryptic:
  1618. one example seen on real hardware was "ISAM144|299|ipv6|nt:vp:1:110"). The
  1619. server can use this information to select the appropriate subnet.
  1620. The information is also returned to the relay which then knows the
  1621. interface to use to transmit the response to the client. In order for
  1622. this to work successfully, the relay interface IDs must be unique within
  1623. the network and the server configuration must match those values.
  1624. </para>
  1625. <para>
  1626. When configuring the DHCPv6 server, it should be noted that two
  1627. similarly-named parameters can be configured for a subnet:
  1628. <itemizedlist>
  1629. <listitem><simpara>
  1630. <command>interface</command> defines which local network interface can be used
  1631. to access a given subnet.
  1632. </simpara></listitem>
  1633. <listitem><simpara>
  1634. <command>interface-id</command> specifies the content of the interface-id option
  1635. used by relays to identify the interface on the relay to which
  1636. the response packet is sent.
  1637. </simpara></listitem>
  1638. </itemizedlist>
  1639. The two are mutually exclusive: a subnet cannot be both reachable locally
  1640. (direct traffic) and via relays (remote traffic). Specifying both is a
  1641. configuration error and the DHCPv6 server will refuse such a configuration.
  1642. </para>
  1643. <para>
  1644. The following example configuration shows how to specify an interface-id with
  1645. a value of "vlan123".
  1646. <screen>
  1647. "Dhcp6": {
  1648. "subnet6": [
  1649. {
  1650. "subnet": "2001:db8:beef::/48",
  1651. "pools": [
  1652. {
  1653. "pool": "2001:db8:beef::/48"
  1654. }
  1655. ],
  1656. <userinput>"interface-id": "vlan123"</userinput>
  1657. }
  1658. ],
  1659. ...
  1660. }
  1661. </screen>
  1662. </para>
  1663. </section>
  1664. <section id="dhcp6-rsoo">
  1665. <title>Relay-Supplied Options</title>
  1666. <para><ulink url="http://tools.ietf.org/html/rfc6422">RFC 6422</ulink>
  1667. defines a mechanism called Relay-Supplied DHCP Options. In certain cases relay
  1668. agents are the only entities that may have specific information. They can
  1669. insert options when relaying messages from the client to the server. The
  1670. server will then do certain checks and copy those options to the response
  1671. that will be sent to the client.</para>
  1672. <para>There are certain conditions that must be met for the option to be
  1673. included. First, the server must not provide the option itself. In
  1674. other words, if both relay and server provide an option, the server always
  1675. takes precedence. Second, the option must be RSOO-enabled. IANA maintains a
  1676. list of RSOO-enabled options <ulink url="http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml#options-relay-supplied">here</ulink>.
  1677. However, there may be cases when system administrators want to echo other
  1678. options. Kea can be instructed to treat other options as RSOO-enabled.
  1679. For example, to mark options 110, 120 and 130 as RSOO-enabled, the following
  1680. syntax should be used:
  1681. <screen>
  1682. "Dhcp6": {
  1683. <userinput>"relay-supplied-options": [ "110", "120", "130" ],</userinput>
  1684. ...
  1685. }
  1686. </screen>
  1687. </para>
  1688. <para>As of March 2015, only option 65 is RSOO-enabled by IANA. This
  1689. option will always be treated as such and there's no need to explicitly
  1690. mark it. Also, when enabling standard options, it is possible to use their
  1691. names, rather than option code, e.g. (e.g. use
  1692. <command>dns-servers</command> instead of <command>23</command>). See
  1693. <xref linkend="dhcp6-std-options-list" /> for the names. In certain cases
  1694. it could also work for custom options, but due to the nature of the parser
  1695. code this may be unreliable and should be avoided.
  1696. </para>
  1697. </section>
  1698. <section id="dhcp6-client-classifier">
  1699. <title>Client Classification in DHCPv6</title>
  1700. <para>
  1701. The DHCPv6 server includes support for client classification. For a deeper
  1702. discussion of the classification process see <xref linkend="classify"/>.
  1703. </para>
  1704. <para>
  1705. In certain cases it is useful to differentiate between different types
  1706. of clients and treat them accordingly. It is envisaged that client
  1707. classification will be used for changing the behavior of almost any part of
  1708. the DHCP message processing, including the assignment of leases from different
  1709. pools, the assignment of different options (or different values of the same
  1710. options) etc. In the current release of the software however, there are
  1711. only two mechanisms that take advantage of client classification:
  1712. subnet selection and assignment of different options.
  1713. </para>
  1714. <para>
  1715. Kea can be instructed to limit access to given subnets based on class information.
  1716. This is particularly useful for cases where two types of devices share the
  1717. same link and are expected to be served from two different subnets. The
  1718. primary use case for such a scenario is cable networks. Here, there are two
  1719. classes of devices: the cable modem itself, which should be handed a lease
  1720. from subnet A and all other devices behind the modem that should get a lease
  1721. from subnet B. That segregation is essential to prevent overly curious
  1722. users from playing with their cable modems. For details on how to set up
  1723. class restrictions on subnets, see <xref linkend="classification-subnets"/>.
  1724. </para>
  1725. <para>
  1726. The process of doing classification is conducted in three steps. The first step
  1727. is to assess an incoming packet and assign it to zero or more classes. The
  1728. second step is to choose a subnet, possibly based on the class information.
  1729. The third step is to assign options again possibly based on the class
  1730. information.
  1731. </para>
  1732. <para>
  1733. There are two methods of doing classification. The first is automatic and relies
  1734. on examining the values in the vendor class options. Information from these
  1735. options is extracted and a class name is constructed from it and added to
  1736. the class list for the packet. The second allows you to specify an expression
  1737. that is evaluated for each packet. If the result is true the packet is
  1738. a member of the class.
  1739. </para>
  1740. <note><para>
  1741. Care should be taken with client classification as it is easy for
  1742. clients that do not meet class criteria to be denied any service altogether.
  1743. </para></note>
  1744. <section>
  1745. <title>Defining and Using Custom Classes</title>
  1746. <para>
  1747. The following example shows how to configure a class using an expression
  1748. and a subnet making use of that class. This configuration defines the
  1749. class named &quot;Client_enterprise&quot;. It is comprised
  1750. of all clients whose client identifiers start with the given hex string (which
  1751. would indicate a DUID based on an enterprise id of 0xAABBCCDD).
  1752. They will be given an address from 2001:db8:1::0 to 2001:db8:1::FFFF and
  1753. the addresses of their DNS servers set to 2001:db8:0::1 and 2001:db8:2::1.
  1754. <screen>
  1755. "Dhcp6": {
  1756. "client-classes": [
  1757. {<userinput>
  1758. "name": "Client_enterprise",
  1759. "test": "substring(option[1].hex,0,6) == 0x0002AABBCCDD'",
  1760. "option-data": [
  1761. {
  1762. "name": "dns-servers",
  1763. "code": 23,
  1764. "space": "dhcp6",
  1765. "csv-format": true,
  1766. "data": "2001:db8:0::1, 2001:db8:2::1"
  1767. }
  1768. ]</userinput>
  1769. },
  1770. ...
  1771. ],
  1772. "subnet6": [
  1773. {
  1774. "subnet": "2001:db8:1::/64",
  1775. "pools": [ { "pool": "2001:db8:1::-2001:db8:1::ffff" } ],
  1776. <userinput>"client-class": "Client_enterprise"</userinput>
  1777. }
  1778. ],
  1779. ...
  1780. }</screen>
  1781. </para>
  1782. <para>
  1783. This example shows a configuration using an automatically generated
  1784. "VENDOR_CLASS_" class. The Administrator of the network has
  1785. decided that addresses from range 2001:db8:1::1 to 2001:db8:1::ffff are
  1786. going to be managed by the Dhcp6 server and only clients belonging to the
  1787. eRouter1.0 client class are allowed to use that pool.
  1788. <screen>
  1789. "Dhcp6": {
  1790. "subnet6": [
  1791. {
  1792. "subnet": "2001:db8:1::/64",
  1793. "pools": [
  1794. {
  1795. "pool": "2001:db8:1::-2001:db8:1::ffff"
  1796. }
  1797. ],
  1798. <userinput>"client-class": "VENDOR_CLASS_eRouter1.0"</userinput>
  1799. }
  1800. ],
  1801. ...
  1802. }
  1803. </screen>
  1804. </para>
  1805. </section>
  1806. </section>
  1807. <section id="dhcp6-ddns-config">
  1808. <title>DDNS for DHCPv6</title>
  1809. <para>
  1810. As mentioned earlier, kea-dhcp6 can be configured to generate requests to
  1811. the DHCP-DDNS server (referred to here as "D2") to update
  1812. DNS entries. These requests are known as NameChangeRequests or NCRs.
  1813. Each NCR contains the following information:
  1814. <orderedlist>
  1815. <listitem><para>
  1816. Whether it is a request to add (update) or remove DNS entries
  1817. </para></listitem>
  1818. <listitem><para>
  1819. Whether the change requests forward DNS updates (AAAA records), reverse
  1820. DNS updates (PTR records), or both.
  1821. </para></listitem>
  1822. <listitem><para>
  1823. The FQDN, lease address, and DHCID
  1824. </para></listitem>
  1825. </orderedlist>
  1826. The parameters controlling the generation of NCRs for submission to D2
  1827. are contained in the <command>dhcp-ddns</command> section of the kea-dhcp6
  1828. configuration. The mandatory parameters for the DHCP DDNS configuration
  1829. are <command>enable-updates</command> which is unconditionally
  1830. required, and <command>qualifying-suffix</command> which has no
  1831. default value and is required when <command>enable-updates</command>
  1832. is set to <command>true</command>.
  1833. The two (disabled and enabled) minimal DHCP DDNS configurations are:
  1834. <screen>
  1835. "Dhcp6": {
  1836. "dhcp-ddns": {
  1837. <userinput>"enable-updates": false</userinput>
  1838. },
  1839. ...
  1840. }
  1841. </screen>
  1842. and for example:
  1843. <screen>
  1844. "Dhcp6": {
  1845. "dhcp-ddns": {
  1846. <userinput>"enable-updates": true,
  1847. "qualifying-suffix": "example."</userinput>
  1848. },
  1849. ...
  1850. }
  1851. </screen>
  1852. The default values for the "dhcp-ddns" section are as follows:
  1853. <itemizedlist>
  1854. <listitem><simpara>
  1855. <command>"server-ip": "127.0.0.1"</command>
  1856. </simpara></listitem>
  1857. <listitem><simpara>
  1858. <command>"server-port": 53001</command>
  1859. </simpara></listitem>
  1860. <listitem><simpara>
  1861. <command>"sender-ip": ""</command>
  1862. </simpara></listitem>
  1863. <listitem><simpara>
  1864. <command>"sender-port": 0</command>
  1865. </simpara></listitem>
  1866. <listitem><simpara>
  1867. <command>"max-queue-size": 1024</command>
  1868. </simpara></listitem>
  1869. <listitem><simpara>
  1870. <command>"ncr-protocol": "UDP"</command>
  1871. </simpara></listitem>
  1872. <listitem><simpara>
  1873. <command>"ncr-format": "JSON"</command>
  1874. </simpara></listitem>
  1875. <listitem><simpara>
  1876. <command>"override-no-update": false</command>
  1877. </simpara></listitem>
  1878. <listitem><simpara>
  1879. <command>"override-client-update": false</command>
  1880. </simpara></listitem>
  1881. <listitem><simpara>
  1882. <command>"replace-client-name": "never"</command>
  1883. </simpara></listitem>
  1884. <listitem><simpara>
  1885. <command>"generated-prefix": "myhost"</command>
  1886. </simpara></listitem>
  1887. </itemizedlist>
  1888. </para>
  1889. <section id="dhcpv6-d2-io-config">
  1890. <title>DHCP-DDNS Server Connectivity</title>
  1891. <para>
  1892. In order for NCRs to reach the D2 server, kea-dhcp6 must be able
  1893. to communicate with it. kea-dhcp6 uses the following configuration
  1894. parameters to control this communication:
  1895. <itemizedlist>
  1896. <listitem><simpara>
  1897. <command>enable-updates</command> - determines whether or not kea-dhcp6 will
  1898. generate NCRs. If missing, this value is assumed to be false hence DDNS updates
  1899. are disabled. To enable DDNS updates set this value to true:
  1900. </simpara></listitem>
  1901. <listitem><simpara>
  1902. <command>server-ip</command> - IP address on which D2 listens for requests. The default is
  1903. the local loopback interface at address 127.0.0.1. You may specify
  1904. either an IPv4 or IPv6 address.
  1905. </simpara></listitem>
  1906. <listitem><simpara>
  1907. <command>server-port</command> - port on which D2 listens for requests. The default value
  1908. is 53001.
  1909. </simpara></listitem>
  1910. <listitem><simpara>
  1911. <command>sender-ip</command> - IP address which kea-dhcp6 should use to send requests to D2.
  1912. The default value is blank which instructs kea-dhcp6 to select a suitable
  1913. address.
  1914. </simpara></listitem>
  1915. <listitem><simpara>
  1916. <command>sender-port</command> - port which kea-dhcp6 should use to send requests to D2. The
  1917. default value of 0 instructs kea-dhcp6 to select a suitable port.
  1918. </simpara></listitem>
  1919. <listitem><simpara>
  1920. <command>max-queue-size</command> - maximum number of requests allowed to queue waiting to
  1921. be sent to D2. This value guards against requests accumulating
  1922. uncontrollably if they are being generated faster than they can be
  1923. delivered. If the number of requests queued for transmission reaches
  1924. this value, DDNS updating will be turned off until the queue backlog has
  1925. been sufficiently reduced. The intent is to allow kea-dhcp6 to
  1926. continue lease operations. The default value is 1024.
  1927. </simpara></listitem>
  1928. <listitem><simpara>
  1929. <command>ncr-protocol</command> - socket protocol use when sending requests to D2. Currently
  1930. only UDP is supported. TCP may be available in an upcoming release.
  1931. </simpara></listitem>
  1932. <listitem><simpara>
  1933. <command>ncr-format</command> - packet format to use when sending requests to D2.
  1934. Currently only JSON format is supported. Other formats may be available
  1935. in future releases.
  1936. </simpara></listitem>
  1937. </itemizedlist>
  1938. By default, kea-dhcp-ddns is assumed to running on the same machine as kea-dhcp6, and
  1939. all of the default values mentioned above should be sufficient.
  1940. If, however, D2 has been configured to listen on a different address or
  1941. port, these values must altered accordingly. For example, if D2 has been
  1942. configured to listen on 2001:db8::5 port 900, the following configuration
  1943. would be required:
  1944. <screen>
  1945. "Dhcp6": {
  1946. "dhcp-ddns": {
  1947. <userinput>"server-ip": "2001:db8::5",
  1948. "server-port": 900</userinput>,
  1949. ...
  1950. },
  1951. ...
  1952. }
  1953. </screen>
  1954. </para>
  1955. </section>
  1956. <section id="dhcpv6-d2-rules-config">
  1957. <title>When Does kea-dhcp6 Generate a DDNS Request?</title>
  1958. <para>kea-dhcp6 follows the behavior prescribed for DHCP servers in
  1959. <ulink url="http://tools.ietf.org/html/rfc4704">RFC 4704</ulink>.
  1960. It is important to keep in mind that kea-dhcp6 provides the initial
  1961. decision making of when and what to update and forwards that
  1962. information to D2 in the form of NCRs. Carrying out the actual
  1963. DNS updates and dealing with such things as conflict resolution
  1964. are within the purview of D2 itself (<xref linkend="dhcp-ddns-server"/>).
  1965. This section describes when kea-dhcp6 will generate NCRs and the
  1966. configuration parameters that can be used to influence this decision.
  1967. It assumes that the <command>enable-updates</command> parameter is true.
  1968. </para>
  1969. <note>
  1970. <para>
  1971. Currently the interface between kea-dhcp6 and D2 only supports requests
  1972. which update DNS entries for a single IP address. If a lease grants
  1973. more than one address, kea-dhcp6 will create the DDNS update request for
  1974. only the first of these addresses. Support for multiple address
  1975. mappings may be provided in a future release.
  1976. </para>
  1977. </note>
  1978. <para>
  1979. In general, kea-dhcp6 will generate DDNS update requests when:
  1980. <orderedlist>
  1981. <listitem><para>
  1982. A new lease is granted in response to a REQUEST
  1983. </para></listitem>
  1984. <listitem><para>
  1985. An existing lease is renewed but the FQDN associated with it has
  1986. changed.
  1987. </para></listitem>
  1988. <listitem><para>
  1989. An existing lease is released in response to a RELEASE
  1990. </para></listitem>
  1991. </orderedlist>
  1992. In the second case, lease renewal, two DDNS requests will be issued: one
  1993. request to remove entries for the previous FQDN and a second request to
  1994. add entries for the new FQDN. In the last case, a lease release, a
  1995. single DDNS request to remove its entries will be made.
  1996. </para>
  1997. <para>
  1998. The decision making involved when granting a new lease the first case) is more
  1999. involved. When a new lease is granted, kea-dhcp6 will generate a DDNS
  2000. update request only if the REQUEST contains the FQDN option (code 39).
  2001. By default kea-dhcp6 will respect the FQDN N and S flags specified by the client
  2002. as shown in the following table:
  2003. </para>
  2004. <table id="dhcp6-fqdn-flag-table">
  2005. <title>Default FQDN Flag Behavior</title>
  2006. <tgroup cols='4' align='left'>
  2007. <colspec colname='cflags'/>
  2008. <colspec colname='meaning'/>
  2009. <colspec colname='response'/>
  2010. <colspec colname='sflags'/>
  2011. <thead>
  2012. <row>
  2013. <entry>Client Flags:N-S</entry>
  2014. <entry>Client Intent</entry>
  2015. <entry>Server Response</entry>
  2016. <entry>Server Flags:N-S-O</entry>
  2017. </row>
  2018. </thead>
  2019. <tbody>
  2020. <row>
  2021. <entry>0-0</entry>
  2022. <entry>
  2023. Client wants to do forward updates, server should do reverse updates
  2024. </entry>
  2025. <entry>Server generates reverse-only request</entry>
  2026. <entry>1-0-0</entry>
  2027. </row>
  2028. <row>
  2029. <entry>0-1</entry>
  2030. <entry>Server should do both forward and reverse updates</entry>
  2031. <entry>Server generates request to update both directions</entry>
  2032. <entry>0-1-0</entry>
  2033. </row>
  2034. <row>
  2035. <entry>1-0</entry>
  2036. <entry>Client wants no updates done</entry>
  2037. <entry>Server does not generate a request</entry>
  2038. <entry>1-0-0</entry>
  2039. </row>
  2040. </tbody>
  2041. </tgroup>
  2042. </table>
  2043. <para>
  2044. The first row in the table above represents "client delegation". Here
  2045. the DHCP client states that it intends to do the forward DNS updates and
  2046. the server should do the reverse updates. By default, kea-dhcp6 will honor
  2047. the client's wishes and generate a DDNS request to D2 to update only
  2048. reverse DNS data. The parameter, <command>override-client-update</command>, can be used
  2049. to instruct the server to override client delegation requests. When
  2050. this parameter is true, kea-dhcp6 will disregard requests for client
  2051. delegation and generate a DDNS request to update both forward and
  2052. reverse DNS data. In this case, the N-S-O flags in the server's
  2053. response to the client will be 0-1-1 respectively.
  2054. </para>
  2055. <para>
  2056. (Note that the flag combination N=1, S=1 is prohibited according to
  2057. <ulink url="http://tools.ietf.org/html/rfc4702">RFC 4702</ulink>. If such a
  2058. combination is received from the client, the packet will be dropped by kea-dhcp6.)
  2059. </para>
  2060. <para>
  2061. To override client delegation, set the following values in the configuration:
  2062. </para>
  2063. <screen>
  2064. "Dhcp6": {
  2065. "dhcp-ddns": {
  2066. <userinput>"override-client-update": true</userinput>,
  2067. ...
  2068. },
  2069. ...
  2070. }
  2071. </screen>
  2072. <para>
  2073. The third row in the table above describes the case in which the client
  2074. requests that no DNS updates be done. The parameter, <command>override-no-update</command>,
  2075. can be used to instruct the server to disregard the client's wishes. When
  2076. this parameter is true, kea-dhcp6 will generate DDNS update requests to
  2077. kea-dhcp-ddns even if the client requests no updates be done. The N-S-O
  2078. flags in the server's response to the client will be 0-1-1.
  2079. </para>
  2080. <para>
  2081. To override client delegation, issue the following commands:
  2082. </para>
  2083. <screen>
  2084. "Dhcp6": {
  2085. "dhcp-ddns": {
  2086. <userinput>"override-no-update": true</userinput>,
  2087. ...
  2088. },
  2089. ...
  2090. }
  2091. </screen>
  2092. </section>
  2093. <section id="dhcpv6-fqdn-name-generation">
  2094. <title>kea-dhcp6 Name Generation for DDNS Update Requests</title>
  2095. <para>Each NameChangeRequest must of course include the fully qualified
  2096. domain name whose DNS entries are to be affected. kea-dhcp6 can be
  2097. configured to supply a portion or all of that name based upon what it
  2098. receives from the client.</para>
  2099. <para>
  2100. The default rules for constructing the FQDN that will be used for DNS
  2101. entries are:
  2102. <orderedlist>
  2103. <listitem><para>
  2104. If the DHCPREQUEST contains the client FQDN option, the candidate name
  2105. is taken from there.
  2106. </para></listitem>
  2107. <listitem><para>
  2108. If the candidate name is a partial (i.e. unqualified) name then add a
  2109. configurable suffix to the name and use the result as the FQDN.
  2110. </para></listitem>
  2111. <listitem><para>
  2112. If the candidate name provided is empty, generate an FQDN using a
  2113. configurable prefix and suffix.
  2114. </para></listitem>
  2115. <listitem><para>
  2116. If the client provided neither option, then no DNS action will be taken.
  2117. </para></listitem>
  2118. </orderedlist>
  2119. These rules can amended by setting the
  2120. <command>replace-client-name</command> parameter which provides the
  2121. following modes of behavior:
  2122. <itemizedlist>
  2123. <listitem><para>
  2124. <command>never</command> - Use the name the client sent. If the client
  2125. sent no name, do not generate one. This is the default mode.
  2126. </para></listitem>
  2127. <listitem><para>
  2128. <command>always</command> - Replace the name the client sent. If the
  2129. client sent no name, generate one for the client.
  2130. </para></listitem>
  2131. <listitem><para>
  2132. <command>when-present</command> - Replace the name the client sent.
  2133. If the client sent no name, do not generate one.
  2134. </para></listitem>
  2135. <listitem><para>
  2136. <command>when-not-present</command> - Use the name the client sent.
  2137. If the client sent no name, generate one for the client.
  2138. </para></listitem>
  2139. </itemizedlist>
  2140. <note>
  2141. Note that formerly, this parameter was a boolean and permitted only values
  2142. of <command>true</command> and <command>false</command>. Boolean values
  2143. have been deprecated and are no longer accepted. If you are currently using
  2144. booleans, you must replace them with the desired mode name. A value of
  2145. <command>true</command> maps to <command>"when-present"</command>, while
  2146. <command>false</command> maps to <command>"never"</command>.
  2147. </note>
  2148. For example, To instruct kea-dhcp6 to always generate the FQDN for a
  2149. client, set the parameter <command>replace-client-name</command> to
  2150. <command>always</command> as follows:
  2151. </para>
  2152. <screen>
  2153. "Dhcp6": {
  2154. "dhcp-ddns": {
  2155. <userinput>"replace-client-name": "always"</userinput>,
  2156. ...
  2157. },
  2158. ...
  2159. }
  2160. </screen>
  2161. <para>
  2162. The prefix used in the generation of an FQDN is specified by the
  2163. <command>generated-prefix</command> parameter. The default value is "myhost". To alter
  2164. its value, simply set it to the desired string:
  2165. </para>
  2166. <screen>
  2167. "Dhcp6": {
  2168. "dhcp-ddns": {
  2169. <userinput>"generated-prefix": "another.host"</userinput>,
  2170. ...
  2171. },
  2172. ...
  2173. }
  2174. </screen>
  2175. <para>
  2176. The suffix used when generating an FQDN or when qualifying a
  2177. partial name is specified by
  2178. the <command>qualifying-suffix</command> parameter. This
  2179. parameter has no default value, thus it is mandatory when
  2180. DDNS updates are enabled.
  2181. To set its value simply set it to the desired string:
  2182. </para>
  2183. <screen>
  2184. "Dhcp6": {
  2185. "dhcp-ddns": {
  2186. <userinput>"qualifying-suffix": "foo.example.org"</userinput>,
  2187. ...
  2188. },
  2189. ...
  2190. }
  2191. </screen>
  2192. </section>
  2193. <para>
  2194. When qualifying a partial name, kea-dhcp6 will construct a name with the
  2195. format:
  2196. </para>
  2197. <para>
  2198. [candidate-name].[qualifying-suffix].
  2199. </para>
  2200. <para>
  2201. where candidate-name is the partial name supplied in the REQUEST.
  2202. For example, if FQDN domain name value was "some-computer" and
  2203. qualifying-suffix "example.com", the generated FQDN would be:
  2204. </para>
  2205. <para>
  2206. some-computer.example.com.
  2207. </para>
  2208. <para>
  2209. When generating the entire name, kea-dhcp6 will construct name of the
  2210. format:
  2211. </para>
  2212. <para>
  2213. [generated-prefix]-[address-text].[qualifying-suffix].
  2214. </para>
  2215. <para>
  2216. where address-text is simply the lease IP address converted to a
  2217. hyphenated string. For example, if lease address is 3001:1::70E,
  2218. the qualifying suffix "example.com", and the default value is used for
  2219. <command>generated-prefix</command>, the generated FQDN would be:
  2220. </para>
  2221. <para>
  2222. myhost-3001-1--70E.example.com.
  2223. </para>
  2224. </section>
  2225. <section id="dhcp6-dhcp4o6-config">
  2226. <title>DHCPv4-over-DHCPv6: DHCPv6 Side</title>
  2227. <para>
  2228. The support of DHCPv4-over-DHCPv6 transport is described in
  2229. <ulink url="http://tools.ietf.org/html/rfc7341">RFC 7341</ulink>
  2230. and is implemented using cooperating DHCPv4 and DHCPv6 servers.
  2231. This section is about the configuration of the DHCPv6 side
  2232. (the DHCPv4 side is described in <xref linkend="dhcp4-dhcp4o6-config"/>).
  2233. </para>
  2234. <note>
  2235. DHCPv4-over-DHCPv6 support is experimental and the details of
  2236. the inter-process communication can change: both the
  2237. DHCPv4 and DHCPv6 sides should be running the same version of Kea.
  2238. </note>
  2239. <para>
  2240. There is only one specific parameter for the DHCPv6 side:
  2241. <command>dhcp4o6-port</command> which specifies the first of the
  2242. two consecutive ports of the UDP sockets used for the communication
  2243. between the DHCPv6 and DHCPv4 servers (the DHCPv6 server is bound
  2244. to ::1 on <command>port</command> and connected to ::1 on
  2245. <command>port</command> + 1).
  2246. </para>
  2247. <para>
  2248. Two other configuration entries are in general required: unicast traffic
  2249. support (see <xref linkend="dhcp6-unicast"/>) and DHCP 4o6 server
  2250. address option (name "dhcp4o6-server-addr", code 88).
  2251. </para>
  2252. <para>
  2253. The following configuration was used during some tests:
  2254. <screen>
  2255. {
  2256. # DHCPv6 conf
  2257. "Dhcp6": {
  2258. "interfaces-config": {
  2259. "interfaces": [ "eno33554984/2001:db8:1:1::1" ]
  2260. },
  2261. "lease-database": {
  2262. "type": "memfile",
  2263. "name": "leases6"
  2264. },
  2265. "preferred-lifetime": 3000,
  2266. "valid-lifetime": 4000,
  2267. "renew-timer": 1000,
  2268. "rebind-timer": 2000,
  2269. "subnet6": [ {
  2270. "subnet": "2001:db8:1:1::/64",
  2271. "interface": "eno33554984",
  2272. "pools": [ { "pool": "2001:db8:1:1::1:0/112" } ]
  2273. } ],
  2274. <userinput>"dhcp4o6-port": 6767,
  2275. "option-data": [ {
  2276. "name": "dhcp4o6-server-addr",
  2277. "code": 88,
  2278. "space": "dhcp6",
  2279. "csv-format": true,
  2280. "data": "2001:db8:1:1::1"
  2281. } ]
  2282. </userinput>
  2283. },
  2284. "Logging": {
  2285. "loggers": [ {
  2286. "name": "kea-dhcp6",
  2287. "output_options": [ {
  2288. "output": "/tmp/kea-dhcp6.log"
  2289. } ],
  2290. "severity": "DEBUG",
  2291. "debuglevel": 0
  2292. } ]
  2293. }
  2294. }
  2295. </screen>
  2296. </para>
  2297. <note>
  2298. Relayed DHCPv4-QUERY DHCPv6 messages are not yet supported.
  2299. </note>
  2300. </section>
  2301. </section>
  2302. <!-- Host reservation is a large topic. There will be many subsections,
  2303. so it should be a section on its own. -->
  2304. <section id="host-reservation-v6">
  2305. <title>Host Reservation in DHCPv6</title>
  2306. <para>There are many cases where it is useful to provide a configuration on
  2307. a per host basis. The most obvious one is to reserve specific, static IPv6
  2308. address or/and prefix for exclusive use by a given client (host) &dash; returning
  2309. client will get the same address or/and prefix every time and other clients will
  2310. never get that address. Note that there may be cases when the
  2311. new reservation has been made for the client for the address or prefix being
  2312. currently in use by another client. We call this situation a "conflict". The
  2313. conflicts get resolved automatically over time as described in the subsequent
  2314. sections. Once conflict is resolved, the client will keep receiving the reserved
  2315. configuration when it renews.</para>
  2316. <para>Another example when the host reservations are applicable is when a host
  2317. has specific requirements, e.g. a printer that needs additional DHCP options
  2318. or a cable modem needs specific parameters. Yet another possible use case for
  2319. host reservation is to define unique names for hosts.</para>
  2320. <para>Hosts reservations are defined as parameters for each subnet. Each host
  2321. can be identified by either DUID or its hardware/MAC address. See
  2322. <xref linkend="mac-in-dhcpv6"/> for details. There is an optional
  2323. <command>reservations</command> array in the
  2324. <command>subnet6</command> structure. Each element in that array
  2325. is a structure, that holds information about a single host. In
  2326. particular, the structure has an identifier that
  2327. uniquely identifies a host. In the DHCPv6 context, such an identifier
  2328. is usually a DUID, but can also be a hardware or MAC address. Also,
  2329. either one or more addresses or prefixes may be specified. It is
  2330. possible to specify a hostname and DHCPv6 options for a given host.</para>
  2331. <para>The following example shows how to reserve addresses and prefixes
  2332. for specific hosts:
  2333. <screen>
  2334. "subnet6": [
  2335. {
  2336. "subnet": "2001:db8:1::/48",
  2337. "pools": [ { "pool": "2001:db8:1::/80" } ],
  2338. "pd-pools": [
  2339. {
  2340. "prefix": "2001:db8:1:8000::",
  2341. "prefix-len": 48,
  2342. "delegated-len": 64
  2343. }
  2344. ],
  2345. <userinput>"reservations": [
  2346. {
  2347. "duid": "01:02:03:04:05:0A:0B:0C:0D:0E",
  2348. "ip-addresses": [ "2001:db8:1::100" ]
  2349. },
  2350. {
  2351. "hw-address": "00:01:02:03:04:05",
  2352. "ip-addresses": [ "2001:db8:1::101", "2001:db8:1::102" ]
  2353. },
  2354. {
  2355. "duid": "01:02:03:04:05:06:07:08:09:0A",
  2356. "ip-addresses": [ "2001:db8:1::103" ],
  2357. "prefixes": [ "2001:db8:2:abcd::/64" ],
  2358. "hostname": "foo.example.com"
  2359. }
  2360. ]</userinput>
  2361. }
  2362. ]
  2363. </screen>
  2364. This example includes reservations for three different clients. The first reservation
  2365. is made for the address 2001:db8:1::100 for a client using DUID
  2366. 01:02:03:04:05:0A:0B:0C:0D:0E. The second reservation is made for two addresses
  2367. 2001:db8:1::101 and 2001:db8:1::102 for a client using MAC address
  2368. 00:01:02:03:04:05. Lastly, address 2001:db8:1::103 and prefix 2001:db8:2:abcd::/64
  2369. are reserved for a client using DUID 01:02:03:04:05:06:07:08:09:0A. The
  2370. last reservation also assigns a hostname to this client.
  2371. </para>
  2372. <para>Note that DHCPv6 allows for a single client to lease multiple addresses
  2373. and multiple prefixes at the same time. Therefore <command>ip-addresses</command>
  2374. and <command>prefixes</command> are plural and are actually arrays.
  2375. When the client sends multiple IA options (IA_NA or IA_PD), each reserved
  2376. address or prefix is assigned to an individual IA of the appropriate type. If
  2377. the number of IAs of specific type is lower than the number of reservations
  2378. of that type, the number of reserved addresses or prefixes assigned to the
  2379. client is equal to the number of IA_NAs or IA_PDs sent by the client, i.e.
  2380. some reserved addresses or prefixes are not assigned. However,
  2381. they still remain reserved for this client and the server will not assign
  2382. them to any other client. If the number of IAs of specific type sent by the
  2383. client is greater than the number of reserved addresses or prefixes, the
  2384. server will try to assign all reserved addresses or prefixes to the individual
  2385. IAs and dynamically allocate addresses or prefixes to remaining IAs. If the
  2386. server cannot assign a reserved address or prefix because it is in use,
  2387. the server will select the next reserved address or prefix and try to assign it to
  2388. the client. If the server subsequently finds that there are no more reservations
  2389. that can be assigned to the client at the moment, the server will try to
  2390. assign leases dynamically.
  2391. </para>
  2392. <para>Making a reservation for a mobile host that may visit multiple subnets
  2393. requires a separate host definition in each subnet it is expected to visit.
  2394. It is not allowed to define multiple host definitions with the same hardware
  2395. address in a single subnet. Multiple host definitions with the same hardware
  2396. address are valid if each is in a different subnet. The reservation for a given host
  2397. should include only one identifier, either DUID or hardware address. Defining
  2398. both for the same host is considered a configuration error, but as of 1.1.0,
  2399. it is not rejected.
  2400. </para>
  2401. <para>Adding host reservation incurs a performance penalty. In principle,
  2402. when a server that does not support host reservation responds to a query,
  2403. it needs to check whether there is a lease for a given address being
  2404. considered for allocation or renewal. The server that also supports host
  2405. reservation, has to perform additional checks: not only if the address is
  2406. currently used (i.e. if there is a lease for it), but also whether the address
  2407. could be used by someone else (i.e. if there is a reservation for it). That
  2408. additional check incurs additional overhead.</para>
  2409. <section id="reservation6-types">
  2410. <title>Address/Prefix Reservation Types</title>
  2411. <para>In a typical scenario there is an IPv6 subnet defined with a certain
  2412. part of it dedicated for dynamic address allocation by the DHCPv6
  2413. server. There may be an additional address space defined for prefix
  2414. delegation. Those dynamic parts are referred to as dynamic pools, address
  2415. and prefix pools or simply pools. In principle, the host reservation can
  2416. reserve any address or prefix that belongs to the subnet. The reservations
  2417. that specify an address that belongs to configured pools are called
  2418. "in-pool reservations". In contrast, those that do not
  2419. belong to dynamic pools are called "out-of-pool
  2420. reservations". There is no formal difference in the reservation
  2421. syntax and both reservation types are handled
  2422. uniformly. However, upcoming releases may offer improved performance if
  2423. there are only out-of-pool reservations as the server will be able to skip
  2424. reservation checks when dealing with existing leases. Therefore, system
  2425. administrators are encouraged to use out-of-pool reservations if
  2426. possible.</para>
  2427. </section>
  2428. <section id="reservation6-conflict">
  2429. <title>Conflicts in DHCPv6 Reservations</title>
  2430. <para>As reservations and lease information are stored separately,
  2431. conflicts may arise. Consider the following series of events. The server
  2432. has configured the dynamic pool of addresses from the range of 2001:db8::10
  2433. to 2001:db8::20. Host A requests an address and gets 2001:db8::10. Now the
  2434. system administrator decides to reserve address 2001:db8::10 for Host B.
  2435. In general, reserving an address
  2436. that is currently assigned to someone else is not recommended, but there
  2437. are valid use cases where such an operation is warranted.</para>
  2438. <para>The server now has a conflict to resolve. Let's analyze the
  2439. situation here. If Host B boots up and request an address, the server is
  2440. not able to assign the reserved address 2001:db8::10. A naive approach
  2441. would to be immediately remove the lease for Host A and create a new one
  2442. for Host B. That would not solve the problem, though, because as soon as
  2443. Host B get the address, it will detect that the address is already in use
  2444. by someone else (Host A) and would send a Decline message. Therefore in this
  2445. situation, the server has to temporarily assign a different address from the
  2446. dynamic pool (not matching what has been reserved) to Host B.</para>
  2447. <para>When Host A renews its address, the server will discover that
  2448. the address being renewed is now reserved for someone else (Host
  2449. B). Therefore the server will remove the lease for 2001:db8::10, select
  2450. a new address and create a new lease for it. It will send two
  2451. addresses in its response: the old address with lifetime set to 0 to
  2452. explicitly indicate that it is no longer valid and the new address with a
  2453. non-zero lifetime. When Host B renews its temporarily assigned
  2454. address, the server will detect that the existing lease does not match
  2455. reservation, so it will release the current address Host B has and will
  2456. create a new lease matching the reservation. Similar as before, the server
  2457. will send two addresses: the temporarily assigned one with zeroed
  2458. lifetimes, and the new one that matches reservation with proper lifetimes
  2459. set.</para>
  2460. <para>This recovery will succeed, even if other hosts will attempt to get
  2461. the reserved address. Had Host C requested address 2001:db8::10 after
  2462. the reservation was made, the server will propose a different address.</para>
  2463. <para>This recovery mechanism allows the server to fully recover from a
  2464. case where reservations conflict with existing leases. This procedure
  2465. takes time and will roughly take as long as renew-timer value specified.
  2466. The best way to avoid such recovery is to not define new reservations that
  2467. conflict with existing leases. Another recommendation is to use
  2468. out-of-pool reservations. If the reserved address does not belong to a
  2469. pool, there is no way that other clients could get this address.
  2470. </para>
  2471. </section>
  2472. <section id="reservation6-hostname">
  2473. <title>Reserving a Hostname</title>
  2474. <para>When the reservation for the client includes the <command>hostname</command>,
  2475. the server will assign this hostname to the client and send
  2476. it back in the Client FQDN, if the client sent the FQDN option to the
  2477. server. The reserved hostname always takes precedence over the hostname
  2478. supplied by the client (via the FQDN option) or the autogenerated
  2479. (from the IPv6 address) hostname.</para>
  2480. <para>The server qualifies the reserved hostname with the value
  2481. of the <command>qualifying-suffix</command> parameter. For example, the
  2482. following subnet configuration:
  2483. <screen>
  2484. "subnet6": [
  2485. {
  2486. "subnet": "2001:db8:1::/48",
  2487. "pools": [ { "pool": "2001:db8:1::/80" } ],
  2488. "reservations": [
  2489. {
  2490. "duid": "01:02:03:04:05:0A:0B:0C:0D:0E",
  2491. "ip-addresses": [ "2001:db8:1::100" ]
  2492. "hostname": "alice-laptop"
  2493. }
  2494. ]
  2495. }
  2496. ],
  2497. "dhcp-ddns": {
  2498. "enable-updates": true,
  2499. "qualifying-suffix": "example.isc.org."
  2500. }
  2501. </screen>
  2502. will result in assigning the "alice-laptop.example.isc.org." hostname to the
  2503. client using the DUID "01:02:03:04:05:0A:0B:0C:0D:0E". If the <command>qualifying-suffix
  2504. </command> is not specified, the default (empty) value will be used, and
  2505. in this case the value specified as a <command>hostname</command> will
  2506. be treated as fully qualified name. Thus, by leaving the
  2507. <command>qualifying-suffix</command> empty it is possible to qualify
  2508. hostnames for the different clients with different domain names:
  2509. <screen>
  2510. "subnet6": [
  2511. {
  2512. "subnet": "2001:db8:1::/48",
  2513. "pools": [ { "pool": "2001:db8:1::/80" } ],
  2514. "reservations": [
  2515. {
  2516. "duid": "01:02:03:04:05:0A:0B:0C:0D:0E",
  2517. "ip-addresses": [ "2001:db8:1::100" ]
  2518. "hostname": "mark-desktop.example.org."
  2519. }
  2520. ]
  2521. }
  2522. ],
  2523. "dhcp-ddns": {
  2524. "enable-updates": true,
  2525. }
  2526. </screen>
  2527. The above example results in the assignment of the "mark-desktop.example.org." hostname to the
  2528. client using the DUID "01:02:03:04:05:0A:0B:0C:0D:0E".
  2529. </para>
  2530. </section>
  2531. <section id="reservation6-options">
  2532. <title>Including Specific DHCPv6 Options in Reservations</title>
  2533. <para>Kea 1.1.0 introduced the ability to specify options on a
  2534. per host basis. The options follow the same rules as any other
  2535. options. These can be standard options (see <xref
  2536. linkend="dhcp6-std-options" />), custom options (see <xref
  2537. linkend="dhcp6-custom-options"/>) or vendor specific options
  2538. (see <xref linkend="dhcp6-vendor-opts" />). The following
  2539. example demonstrates how standard options can be defined.</para>
  2540. <screen>
  2541. "reservations": [
  2542. {
  2543. "duid": "01:02:03:05:06:07:08",
  2544. "ip-addresses": [ "2001:db8:1::2" ],
  2545. <userinput>"option-data": [
  2546. {
  2547. "option-data": [ {
  2548. "name": "dns-servers",
  2549. "data": "3000:1::234"
  2550. },
  2551. {
  2552. "name": "nis-servers",
  2553. "data": "3000:1::234"
  2554. }
  2555. } ]</userinput>
  2556. } ]</screen>
  2557. <para>Vendor specific options can be reserved in a similar manner:</para>
  2558. <screen>
  2559. "reservations": [
  2560. {
  2561. "duid": "aa:bb:cc:dd:ee:ff",
  2562. "ip-addresses": [ "2001:db8::1" ],
  2563. <userinput>"option-data": [
  2564. {
  2565. "name": "vendor-opts",
  2566. "data": 4491
  2567. },
  2568. {
  2569. "name": "tftp-servers",
  2570. "space": "vendor-4491",
  2571. "data": "3000:1::234"
  2572. } ]</userinput>
  2573. } ]</screen>
  2574. <para>
  2575. Options defined on host level have the highest priority. In other words,
  2576. if there are options defined with the same type on global, subnet, class and
  2577. host level, the host specific values will be used.
  2578. </para>
  2579. </section>
  2580. <section id="reservation6-client-classes">
  2581. <title>Reserving Client Classes in DHCPv6</title>
  2582. <para>The <xref linkend="classification-using-expressions"/> explains how
  2583. to configure the server to assign classes to a client based on the content
  2584. of the options that this client sends to the server. Host reservations
  2585. mechanisms also allow for the static assignment of classes to clients.
  2586. The definitions of these classes are placed in the Kea
  2587. configuration. The following configuration snippet shows how to specify
  2588. that the client belongs to classes <command>reserved-class1</command>
  2589. and <command>reserved-class2</command>. Those classes are associated with
  2590. specific options being sent to the clients which belong to them.
  2591. </para>
  2592. <screen>
  2593. {
  2594. "client-classes": [
  2595. {
  2596. "name": "reserved-class1",
  2597. "option-data": [
  2598. {
  2599. "name": "dns-servers",
  2600. "data": "2001:db8:1::50"
  2601. }
  2602. ]
  2603. },
  2604. {
  2605. "name": "reserved-class2",
  2606. "option-data": [
  2607. {
  2608. "name": "nis-servers",
  2609. "data": "2001:db8:1::100"
  2610. }
  2611. ]
  2612. }
  2613. ],
  2614. "subnet6": [
  2615. { "pools": [ { "pool": "2001:db8:1::/64" } ],
  2616. "subnet": "2001:db8:1::/48",
  2617. "reservations": [
  2618. {
  2619. "duid": "01:02:03:04:05:06:07:08",
  2620. <userinput>
  2621. "client-classes": [ "reserved-class1", "reserved-class2" ]
  2622. </userinput>
  2623. } ]
  2624. } ]
  2625. }
  2626. </screen>
  2627. <para>Static class assignments, as shown above, can be used in conjunction
  2628. with classification using expressions.</para>
  2629. </section>
  2630. <section id="reservations6-mysql-pgsql">
  2631. <title>Storing Host Reservations in MySQL or PostgreSQL</title>
  2632. <para>
  2633. It is possible to store host reservations in MySQL or PostgreSQL. See <xref
  2634. linkend="hosts6-storage" /> for information on how to configure Kea to use
  2635. reservations stored in MySQL or PostgreSQL. Kea does not provide any dedicated
  2636. tools for managing reservations in a database. The Kea wiki <ulink
  2637. url="http://kea.isc.org/wiki/HostReservationsHowTo" /> provides detailed
  2638. information and examples of how reservations can be inserted into the
  2639. database.
  2640. </para>
  2641. <note><simpara>In Kea 1.1.0 maximum length of an option specified per host is
  2642. arbitrarily set to 4096 bytes.</simpara></note>
  2643. </section>
  2644. <section id="reservations6-cql">
  2645. <title>Storing Host Reservations in CQL (Cassandra)</title>
  2646. <para>Kea currently does not support storing reservations in
  2647. Cassandra (CQL).</para>
  2648. </section>
  2649. <section id="reservations6-tuning">
  2650. <title>Fine Tuning DHCPv6 Host Reservation</title>
  2651. <para>The host reservation capability introduces additional restrictions for the
  2652. allocation engine (the component of Kea that selects an address for a client)
  2653. during lease selection and renewal. In particular, three
  2654. major checks are necessary. First, when selecting a new lease, it is not
  2655. sufficient for a candidate lease to not be used by another DHCP client. It
  2656. also must not be reserved for another client. Second, when renewing a lease,
  2657. additional check must be performed whether the address being renewed is not
  2658. reserved for another client. Finally, when a host renews an address or a
  2659. prefix, the server has to check whether there is a reservation for this host,
  2660. so the existing (dynamically allocated) address should be revoked and the
  2661. reserved one be used instead.</para>
  2662. <para>Some of those checks may be unnecessary in certain deployments and not
  2663. performing them may improve performance. The Kea server provides the
  2664. <command>reservation-mode</command> configuration parameter to select the
  2665. types of reservations allowed for the particular subnet. Each reservation
  2666. type has different constraints for the checks to be performed by the
  2667. server when allocating or renewing a lease for the client.
  2668. Allowed values are:
  2669. <itemizedlist>
  2670. <listitem><simpara> <command>all</command> - enables all host reservation
  2671. types. This is the default value. This setting is the safest and the most
  2672. flexible. It allows in-pool and out-of-pool reservations. As all checks
  2673. are conducted, it is also the slowest.
  2674. </simpara></listitem>
  2675. <listitem><simpara> <command>out-of-pool</command> - allows only out of
  2676. pool host reservations. With this setting in place, the server may assume
  2677. that all host reservations are for addresses that do not belong to the
  2678. dynamic pool. Therefore it can skip the reservation checks when dealing
  2679. with in-pool addresses, thus improving performance. Do not use this mode
  2680. if any of your reservations use in-pool address. Caution is advised when
  2681. using this setting. Kea 1.1.0 does not sanity check the reservations against
  2682. <command>reservation-mode</command> and misconfiguration may cause problems.
  2683. </simpara></listitem>
  2684. <listitem><simpara>
  2685. <command>disabled</command> - host reservation support is disabled. As there
  2686. are no reservations, the server will skip all checks. Any reservations defined
  2687. will be completely ignored. As the checks are skipped, the server may
  2688. operate faster in this mode.
  2689. </simpara></listitem>
  2690. </itemizedlist>
  2691. </para>
  2692. <para>
  2693. An example configuration that disables reservation looks like follows:
  2694. <screen>
  2695. "Dhcp6": {
  2696. "subnet6": [
  2697. {
  2698. "subnet": "2001:db8:1::/64",
  2699. <userinput>"reservation-mode": "disabled"</userinput>,
  2700. ...
  2701. }
  2702. ]
  2703. }
  2704. </screen>
  2705. </para>
  2706. <para>Another aspect of the host reservations are different types of
  2707. identifiers. Kea 1.1.0 supports two types of identifiers
  2708. in DHCPv6: hw-address and duid, but more identifier types
  2709. are likely to be added in the future. This is beneficial from a
  2710. usability perspective. However, there is a drawback. For each incoming
  2711. packet Kea has to to extract each identifier type and then query the
  2712. database to see if there is a reservation done by this particular
  2713. identifier. If nothing is found, the next identifier is extracted and next
  2714. query is issued. This process continues until either a reservation is
  2715. found or all identifier types have been checked. Over time with an increasing
  2716. number of supported identifier types, Kea would become slower and
  2717. slower.</para>
  2718. <para>To address this problem, a parameter called
  2719. <command>host-reservation-identifiers</command> has been introduced. It
  2720. takes a list of identifier types as a parameter. Kea will check only those
  2721. identifier types enumerated in host-reservation-identifiers. From a
  2722. performance perspective the number of identifier types should be kept to
  2723. minimum, ideally limited to one. If your deployment uses several
  2724. reservation types, please enumerate them from most to least frequently
  2725. used as this increases the chances of Kea finding the reservation using the
  2726. fewest number of queries. An example of host reservation identifiers looks
  2727. as follows:
  2728. <screen>
  2729. <userinput>"host-reservation-identifiers": [ "duid", "hw-address" ],</userinput>
  2730. "subnet6": [
  2731. {
  2732. "subnet": "2001:db8:1::/64",
  2733. ...
  2734. }
  2735. ]</screen>
  2736. </para>
  2737. <para>
  2738. If not specified, the default value is:
  2739. <screen>
  2740. <userinput>"host-reservation-identifiers": [ "hw-address", "duid" ]</userinput>
  2741. </screen>
  2742. </para>
  2743. <!-- see CfgHostOperations::createConfig6() in
  2744. src/lib/dhcpsrv/cfg_host_operations.cc -->
  2745. </section>
  2746. <!-- @todo: add support for per IA reservation (that specifies IAID in
  2747. the ip-addresses and prefixes) -->
  2748. </section>
  2749. <!-- end of host reservations section -->
  2750. <section id="dhcp6-serverid">
  2751. <title>Server Identifier in DHCPv6</title>
  2752. <para>The DHCPv6 protocol uses a "server identifier" (also known
  2753. as a DUID) for clients to be able to discriminate between several
  2754. servers present on the same link.
  2755. <ulink url="http://tools.ietf.org/html/rfc3315">RFC 3315</ulink>
  2756. defines three DUID types: DUID-LLT, DUID-EN and DUID-LL.
  2757. <ulink url="http://tools.ietf.org/html/rfc6355">RFC 6355</ulink>
  2758. also defines DUID-UUID. Future specifications may introduce new
  2759. DUID types.</para>
  2760. <para>The Kea DHCPv6 server generates a server identifier once, upon
  2761. the first startup, and stores it in a file. This identifier isn't
  2762. modified across restarts of the server and so is a stable identifier.</para>
  2763. <para>Kea follows recommendation from
  2764. <ulink url="http://tools.ietf.org/html/rfc3315">RFC 3315</ulink>
  2765. to use DUID-LLT as the default server identifier. However, we have
  2766. received reports that some deployments require different DUID
  2767. types, and there is a need to administratively select both DUID
  2768. type and/or its contents.</para>
  2769. <para>The server identifier can be configured using parameters
  2770. within the <command>server-id</command> map element in the global
  2771. scope of the Kea configuration file. The following example
  2772. demonstrates how to select DUID-EN as a server identifier:
  2773. <screen>
  2774. "Dhcp6": {
  2775. "server-id": {
  2776. "type": "EN"
  2777. },
  2778. ...
  2779. }
  2780. </screen>
  2781. </para>
  2782. <para>Currently supported values for <command>type</command>
  2783. parameter are: "LLT", "EN" and "LL", for DUID-LLT, DUID-EN and
  2784. DUID-LL respectively.</para>
  2785. <para>When a new DUID type is selected the server will generate its
  2786. value and replace any existing DUID in the file. The server will then
  2787. use the new server identifier in all future interactions with the
  2788. clients.</para>
  2789. <note><para>If the new server identifier is created after some clients
  2790. have obtained their leases, the clients using the old identifier will not
  2791. be able to renew the leases: the server will ignore messages
  2792. containing the old server identifier. Clients will continue sending
  2793. Renew until they transition to the rebinding state. In this state they
  2794. will start sending Rebind messages to multicast address without
  2795. a server identifier. The server will respond to the Rebind messages
  2796. with a new server identifier and the clients will associate the
  2797. new server identifier with their leases. Although the clients will
  2798. be able to keep their leases and will eventually learn the new server
  2799. identifier, this will be at the cost of increased number of renewals
  2800. and multicast traffic due to a need to rebind. Therefore it is
  2801. recommended that modification of the server identifier type
  2802. and value is avoided if the server has already assigned leases and these
  2803. leases are still valid.</para></note>
  2804. <para>There are cases when an administrator needs to explicitly
  2805. specify a DUID value rather than allow the server to generate it.
  2806. The following example demonstrates how to explicitly set all
  2807. components of a DUID-LLT.
  2808. <screen>
  2809. "Dhcp6": {
  2810. "server-id": {
  2811. "type": "LLT",
  2812. "htype": 8,
  2813. "identifier": "A65DC7410F05",
  2814. "time": 2518920166
  2815. },
  2816. ...
  2817. }
  2818. </screen>
  2819. where:
  2820. <itemizedlist>
  2821. <listitem><simpara><command>htype</command> is a 16-bit unsigned value
  2822. specifying hardware type,</simpara></listitem>
  2823. <listitem><simpara><command>identifier</command> is a link layer
  2824. address, specified as a string of hexadecimal digits,</simpara>
  2825. </listitem>
  2826. <listitem><simpara><command>time</command> is a 32-bit unsigned
  2827. time value.</simpara></listitem>
  2828. </itemizedlist>
  2829. </para>
  2830. <para>The hexadecimal representation of the DUID generated as a result
  2831. of the configuration specified above will be:
  2832. <screen>
  2833. 00:01:00:08:96:23:AB:E6:A6:5D:C7:41:0F:05
  2834. |type |htype| time | identifier |
  2835. </screen>
  2836. </para>
  2837. <para>It is allowed to use special value of 0 for "htype" and "time",
  2838. which indicates that the server should use ANY value for these
  2839. components. If the server already uses a DUID-LLT it will use the
  2840. values from this DUID. If the server uses a DUID of a different type
  2841. or doesn't use any DUID yet, it will generate these values.
  2842. Similarly, if the "identifier" is assigned an empty string, the
  2843. value of the identifier will be generated. Omitting any of these
  2844. parameters is equivalent to setting them to those special values.
  2845. </para>
  2846. <para>For example, the following configuration:
  2847. <screen>
  2848. "Dhcp6": {
  2849. "server-id": {
  2850. "type": "LLT",
  2851. "htype": 0,
  2852. "identifier": "",
  2853. "time": 2518920166
  2854. },
  2855. ...
  2856. }
  2857. </screen>
  2858. indicates that the server should use ANY link layer address and
  2859. hardware type. If the server is already using DUID-LLT it will
  2860. use the link layer address and hardware type from the existing DUID.
  2861. If the server is not using any DUID yet, it will use link layer
  2862. address and hardware type from one of the available network
  2863. interfaces. The server will use an explicit value of time. If it
  2864. is different than a time value present in the currently used
  2865. DUID, that value will be replaced, effectively causing
  2866. modification of the current server identifier.
  2867. </para>
  2868. <para>
  2869. The following example demonstrates an explicit configuration of
  2870. a DUID-EN:
  2871. <screen>
  2872. "Dhcp6": {
  2873. "server-id": {
  2874. "type": "EN",
  2875. "enterprise-id": 2495,
  2876. "identifier": "87ABEF7A5BB545"
  2877. },
  2878. ...
  2879. }
  2880. </screen>
  2881. where:
  2882. <itemizedlist>
  2883. <listitem><simpara><command>enterprise-id</command> is a 32-bit
  2884. unsigned value holding enterprise number,</simpara></listitem>
  2885. <listitem><simpara><command>identifier</command> is a variable
  2886. length identifier within DUID-EN.</simpara></listitem>
  2887. </itemizedlist>
  2888. </para>
  2889. <para>
  2890. The hexadecimal representation of the DUID-EN created according to
  2891. the configuration above is:
  2892. <screen>
  2893. 00:02:00:00:09:BF:87:AB:EF:7A:5B:B5:45
  2894. |type | ent-id | identifier |
  2895. </screen>
  2896. </para>
  2897. <para>As in the case of the DUID-LLT, special values can be used for the
  2898. configuration of the DUID-EN. If <command>enterprise-id</command> is 0, the server
  2899. will use a value from the existing DUID-EN. If the server is not using
  2900. any DUID or the existing DUID has a different type, the ISC enterprise
  2901. id will be used. When an empty string is used for <command>identifier</command>, the
  2902. identifier from the existing DUID-EN will be used. If the server is
  2903. not using any DUID-EN the new 6-bytes long identifier will be generated.
  2904. </para>
  2905. <para>DUID-LL is configured in the same way as DUID-LLT with an exception
  2906. that the <command>time</command> parameter has no effect for DUID-LL,
  2907. because this DUID type only comprises a hardware type and link layer
  2908. address. The following example demonstrates how to configure DUID-LL:
  2909. <screen>
  2910. "Dhcp6": {
  2911. "server-id": {
  2912. "type": "LL",
  2913. "htype": 8,
  2914. "identifier": "A65DC7410F05"
  2915. },
  2916. ...
  2917. }
  2918. </screen>
  2919. </para>
  2920. <para>
  2921. which will result in the following server identifier:
  2922. <screen>
  2923. 00:03:00:08:A6:5D:C7:41:0F:05
  2924. |type |htype| identifier |
  2925. </screen>
  2926. </para>
  2927. <para>The server stores the generated server identifier in the following
  2928. location: [kea-install-dir]/var/kea/kea-dhcp6-serverid.
  2929. </para>
  2930. <para>In some uncommon deployments where no stable storage is
  2931. available, the server should be configured not to try to
  2932. store the server identifier. This choice is controlled
  2933. by the value of <command>persist</command> boolean parameter:
  2934. <screen>
  2935. "Dhcp6": {
  2936. "server-id": {
  2937. "type": "EN",
  2938. "enterprise-id": 2495,
  2939. "identifier": "87ABEF7A5BB545",
  2940. "persist": false
  2941. },
  2942. ...
  2943. }
  2944. </screen>
  2945. </para>
  2946. <para>The default value of the "persist" parameter is
  2947. <command>true</command> which configures the server to store the
  2948. server identifier on a disk.</para>
  2949. <para>In the example above, the server is configured to not store
  2950. the generated server identifier on a disk. But, if the server
  2951. identifier is not modified in the configuration the same value
  2952. will be used after server restart, because entire server
  2953. identifier is explicitly specified in the configuration.</para>
  2954. </section>
  2955. <section id="stateless-dhcp6">
  2956. <title>Stateless DHCPv6 (Information-Request Message)</title>
  2957. <para>Typically DHCPv6 is used to assign both addresses and options. These
  2958. assignments (leases) have state that changes over time, hence
  2959. their name, stateful. DHCPv6 also supports a stateless mode,
  2960. where clients request configuration options only. This mode is
  2961. considered lightweight from the server perspective as it does not require
  2962. any state tracking; hence its name.</para>
  2963. <para>The Kea server supports stateless mode. Clients can send
  2964. Information-Request messages and the server will send back
  2965. answers with the requested options (providing the options are
  2966. available in the server configuration). The server will attempt to
  2967. use per-subnet options first. If that fails - for whatever reason - it
  2968. will then try to provide options defined in the global scope.</para>
  2969. <para>Stateless and stateful mode can be used together. No special
  2970. configuration directives are required to handle this. Simply use the
  2971. configuration for stateful clients and the stateless clients will get
  2972. just options they requested.</para>
  2973. <para>This usage of global options allows for an interesting case.
  2974. It is possible to run a server that provides just options and no
  2975. addresses or prefixes. If the options have the same value in each
  2976. subnet, the configuration can define required options in the global
  2977. scope and skip subnet definitions altogether. Here's a simple example of
  2978. such a configuration:
  2979. <screen>
  2980. "Dhcp6": {
  2981. "interfaces-config": {
  2982. "interfaces": [ "ethX" ]
  2983. },
  2984. <userinput>"option-data": [ {
  2985. "name": "dns-servers",
  2986. "data": "2001:db8::1, 2001:db8::2"
  2987. } ]</userinput>,
  2988. "lease-database": { "type": "memfile" }
  2989. }
  2990. </screen>
  2991. This very simple configuration will provide DNS server information
  2992. to all clients in the network, regardless of their location. Note the
  2993. specification of the memfile lease database: this is needed as
  2994. Kea requires a lease database to be specified
  2995. even if it is not used.</para>
  2996. </section>
  2997. <section id="dhcp6-rfc7550">
  2998. <title>Support for RFC 7550</title>
  2999. <para>The <ulink url="http://tools.ietf.org/html/rfc7550">RFC 7550</ulink>
  3000. introduced some changes to the DHCPv6 protocol to resolve a few issues
  3001. with the coexistence of multiple stateful options in the messages sent
  3002. between the clients and servers.</para>
  3003. <para>The typical example is when the client, such as a requesting
  3004. router, requests an allocation of both addresses and prefixes when
  3005. it performs the 4-way (SARR) exchange with the server. If the
  3006. server is not configured to allocate any prefixes but it can allocate
  3007. some addresses, it will respond with the IA_NA(s) containing allocated
  3008. addresses and the IA_PD(s) containing the NoPrefixAvail status code. If
  3009. the client can operate without prefixes it may transition to the
  3010. 'bound' state when it sends Renew/Rebind messages to the server,
  3011. according to the T1 and T2 times, to extend the lifetimes of the
  3012. allocated addresses. If the client is still interested in obtaining
  3013. prefixes from the server it may also include an IA_PD in the Renew/Rebind
  3014. to request allocation of the prefixes. If the server still cannot
  3015. allocate the prefixes, it will respond with the IA_PD(s) containing
  3016. NoPrefixAvail status code. However, if the server can now allocate
  3017. the prefixes it will do so, and send them in the IA_PD(s) to the client.
  3018. Allocation of leases during the Renew/Rebind was not supported in the
  3019. <ulink url="http://tools.ietf.org/html/rfc3315">RFC 3315</ulink>
  3020. and <ulink url="http://tools.ietf.org/html/rfc3633">RFC 3633</ulink>,
  3021. and has been introduced in
  3022. <ulink url="http://tools.ietf.org/html/rfc7550">RFC 7550</ulink>.
  3023. Kea supports this new behavior and it doesn't provide any configuration
  3024. mechanisms to disable it.
  3025. </para>
  3026. <para>
  3027. The following are the other behaviors specified in the
  3028. <ulink url="http://tools.ietf.org/html/rfc7550">RFC 7550</ulink>
  3029. supported by the Kea DHCPv6 server:
  3030. <itemizedlist>
  3031. <listitem><simpara>Set T1/T2 timers to the same value for all
  3032. stateful (IA_NA and IA_PD) options to facilitate renewal of all
  3033. client's leases at the same time (in a single message exchange),
  3034. </simpara></listitem>
  3035. <listitem><simpara>NoAddrsAvail and NoPrefixAvail status codes
  3036. are placed in the IA_NA and IA_PD options in the Advertise message,
  3037. rather than as the top level options.</simpara></listitem>
  3038. </itemizedlist>
  3039. </para>
  3040. </section>
  3041. <section id="dhcp6-relay-override">
  3042. <title>Using Specific Relay Agent for a Subnet</title>
  3043. <para>
  3044. The relay has to have an interface connected to the link on which
  3045. the clients are being configured. Typically the relay has a global IPv6
  3046. address configured on the interface that belongs to the subnet from which
  3047. the server will assign addresses. In the typical case, the
  3048. server is able to use the IPv6 address inserted by the relay (in the link-addr
  3049. field in RELAY-FORW message) to select the appropriate subnet.
  3050. </para>
  3051. <para>
  3052. However, that is not always the case. The relay
  3053. address may not match the subnet in certain deployments. This
  3054. usually means that there is more than one subnet allocated for a given
  3055. link. The two most common examples where this is the case are long lasting
  3056. network renumbering (where both old and new address space is still being
  3057. used) and a cable network. In a cable network both cable modems and the
  3058. devices behind them are physically connected to the same link, yet
  3059. they use distinct addressing. In such case, the DHCPv6 server needs
  3060. additional information (like the value of interface-id option or IPv6
  3061. address inserted in the link-addr field in RELAY-FORW message) to
  3062. properly select an appropriate subnet.
  3063. </para>
  3064. <para>
  3065. The following example assumes that there is a subnet 2001:db8:1::/64
  3066. that is accessible via a relay that uses 3000::1 as its IPv6 address.
  3067. The server will be able to select this subnet for any incoming packets
  3068. that came from a relay with an address in 2001:db8:1::/64 subnet.
  3069. It will also select that subnet for a relay with address 3000::1.
  3070. <screen>
  3071. "Dhcp6": {
  3072. "subnet6": [
  3073. {
  3074. "subnet": "2001:db8:1::/64",
  3075. "pools": [
  3076. {
  3077. "pool": "2001:db8:1::1-2001:db8:1::ffff"
  3078. }
  3079. ],
  3080. <userinput>"relay": {
  3081. "ip-address": "3000::1"
  3082. }</userinput>
  3083. }
  3084. ]
  3085. }
  3086. </screen>
  3087. </para>
  3088. <para>If "relay" is specified, the "ip-address" parameter within
  3089. it is mandatory.</para>
  3090. </section>
  3091. <section id="dhcp6-client-class-relay">
  3092. <title>Segregating IPv6 Clients in a Cable Network</title>
  3093. <para>
  3094. In certain cases, it is useful to mix relay address information,
  3095. introduced in <xref linkend="dhcp6-relay-override"/> with client
  3096. classification, explained in <xref linkend="classify"/>.
  3097. One specific example is a cable network, where typically modems
  3098. get addresses from a different subnet than all devices connected
  3099. behind them.
  3100. </para>
  3101. <para>
  3102. Let's assume that there is one CMTS (Cable Modem Termination System)
  3103. with one CM MAC (a physical link that modems are connected to).
  3104. We want the modems to get addresses from the 3000::/64 subnet,
  3105. while everything connected behind modems should get addresses from
  3106. another subnet (2001:db8:1::/64). The CMTS that acts as a relay
  3107. an uses address 3000::1. The following configuration can serve
  3108. that configuration:
  3109. <screen>
  3110. "Dhcp6": {
  3111. "subnet6": [
  3112. {
  3113. "subnet": "3000::/64",
  3114. "pools": [
  3115. { "pool": "3000::2 - 3000::ffff" }
  3116. ],
  3117. <userinput>"client-class": "VENDOR_CLASS_docsis3.0",
  3118. "relay": {
  3119. "ip-address": "3000::1"
  3120. }</userinput>
  3121. },
  3122. {
  3123. "subnet": "2001:db8:1::/64",
  3124. "pools": [
  3125. {
  3126. "pool": "2001:db8:1::1-2001:db8:1::ffff"
  3127. }
  3128. ],
  3129. <userinput>"relay": {
  3130. "ip-address": "3000::1"
  3131. }</userinput>
  3132. }
  3133. ]
  3134. }
  3135. </screen>
  3136. </para>
  3137. </section>
  3138. <section id="mac-in-dhcpv6">
  3139. <title>MAC/Hardware Addresses in DHCPv6</title>
  3140. <para>MAC/hardware addresses are available in DHCPv4 messages
  3141. from the clients and administrators
  3142. frequently use that information to perform certain tasks, like per host
  3143. configuration, address reservation for specific MAC addresses and other.
  3144. Unfortunately, the DHCPv6 protocol does not provide any completely reliable way
  3145. to retrieve that information. To mitigate that issue a number of mechanisms
  3146. have been implemented in Kea that attempt to gather it. Each
  3147. of those mechanisms works in certain cases, but may fail in other cases.
  3148. Whether the mechanism works or not in the particular deployment is
  3149. somewhat dependent on the network topology and the technologies used.</para>
  3150. <para>Kea allows configuration of which of the supported methods should be
  3151. used and in what order. This configuration may be considered a fine tuning
  3152. of the DHCP deployment. In a typical deployment the default
  3153. value of <command>"any"</command> is sufficient and there is no
  3154. need to select specific methods. Changing the value of this parameter
  3155. is the most useful in cases when an administrator wants to disable
  3156. certain method, e.g. if the administrator trusts the network infrastructure
  3157. more than the information provided by the clients themselves, the
  3158. administrator may prefer information provided by the relays over that
  3159. provided by the clients.
  3160. </para>
  3161. <para>
  3162. The configuration is controlled by the <command>mac-sources</command>
  3163. parameter as follows:
  3164. <screen>
  3165. "Dhcp6": {
  3166. <userinput>"mac-sources": [ "method1", "method2", "method3", ... ]</userinput>,
  3167. "subnet6": [ ... ],
  3168. ...
  3169. }
  3170. </screen>
  3171. When not specified, a special value of "any" is used, which
  3172. instructs the server to attempt to use all the methods in sequence and use
  3173. value returned by the first one that succeeds. If specified, it
  3174. has to have at least one value.</para>
  3175. <para>Supported methods are:
  3176. <itemizedlist>
  3177. <listitem>
  3178. <simpara><command>any</command> - Not an actual method, just a keyword that
  3179. instructs Kea to try all other methods and use the first one that succeeds.
  3180. This is the default operation if no <command>mac-sources</command> are defined.
  3181. </simpara>
  3182. </listitem>
  3183. <listitem>
  3184. <simpara><command>raw</command> - In principle, a DHCPv6 server could use raw
  3185. sockets to receive incoming traffic and extract MAC/hardware address
  3186. information. This is currently not implemented for DHCPv6 and this value has
  3187. no effect.
  3188. </simpara>
  3189. </listitem>
  3190. <listitem>
  3191. <simpara><command>duid</command> - DHCPv6 uses DUID identifiers instead of
  3192. MAC addresses. There are currently four DUID types defined, with two of them
  3193. (DUID-LLT, which is the default one and DUID-LL) convey MAC address information.
  3194. Although <ulink utl="http://tools.ietf.org/html/rfc3315">RFC 3315</ulink> forbids
  3195. it, it is possible to parse those DUIDs and extract
  3196. necessary information from them. This method is not completely reliable, as
  3197. clients may use other DUID types, namely DUID-EN or DUID-UUID.
  3198. </simpara>
  3199. </listitem>
  3200. <listitem>
  3201. <simpara><command>ipv6-link-local</command> - Another possible acquisition
  3202. method comes from the source IPv6 address. In typical usage, clients are
  3203. sending their packets from IPv6 link-local addresses. There is a good chance
  3204. that those addresses are based on EUI-64, which contains MAC address. This
  3205. method is not completely reliable, as clients may use other link-local address
  3206. types. In particular, privacy extensions, defined in
  3207. <ulink url="http://tools.ietf.org/html/rfc4941">RFC 4941</ulink>, do not use
  3208. MAC addresses. Also note that successful extraction requires that the
  3209. address's u-bit must be set to 1 and its g-bit set to 0, indicating that it
  3210. is an interface identifier as per
  3211. <ulink url="http://tools.ietf.org/html/rfc2373#section-2.5.1">
  3212. RFC 2373, section 2.5.1</ulink>.
  3213. </simpara>
  3214. </listitem>
  3215. <listitem>
  3216. <simpara><command>client-link-addr-option</command> - One extension defined
  3217. to alleviate missing MAC issues is client link-layer address option, defined
  3218. in <ulink url="http://tools.ietf.org/html/rfc6939">RFC 6939</ulink>. This is
  3219. an option that is inserted by a relay and contains information about client's
  3220. MAC address. This method requires a relay agent that supports the option and
  3221. is configured to insert it. This method is useless for directly connected
  3222. clients. This parameter can also be specified as <command>rfc6939</command>,
  3223. which is an alias for <command>client-link-addr-option</command>.
  3224. </simpara>
  3225. </listitem>
  3226. <listitem>
  3227. <simpara><command>remote-id</command> -
  3228. <ulink url="http://tools.ietf.org/html/rfc4649">RFC 4649</ulink>
  3229. defines a remote-id option that is inserted by a relay agent. Depending
  3230. on the relay agent configuration, the inserted option may convey the client's
  3231. MAC address information. This parameter can also be specified as
  3232. <command>rfc4649</command>, which is an alias for <command>remote-id</command>.
  3233. </simpara>
  3234. </listitem>
  3235. <listitem>
  3236. <simpara><command>subscriber-id</command> - Another option
  3237. that is somewhat similar to the previous one is subscriber-id,
  3238. defined in <ulink url="http://tools.ietf.org/html/rfc4580">RFC
  3239. 4580</ulink>. It is, too, inserted by a relay agent that is
  3240. configured to insert it. This parameter can also be specified
  3241. as <command>rfc4580</command>, which is an alias for
  3242. <command>subscriber-id</command>. This method is currently not
  3243. implemented.
  3244. </simpara>
  3245. </listitem>
  3246. <listitem>
  3247. <simpara><command>docsis-cmts</command> - Yet another possible source of MAC
  3248. address information are the DOCSIS options inserted by a CMTS that acts
  3249. as a DHCPv6 relay agent in cable networks. This method attempts to extract
  3250. MAC address information from suboption 1026 (cm mac) of the vendor specific option
  3251. with vendor-id=4491. This vendor option is extracted from the relay-forward message,
  3252. not the original client's message.
  3253. </simpara>
  3254. </listitem>
  3255. <listitem>
  3256. <simpara><command>docsis-modem</command> - Yet another possible source of MAC
  3257. address information are the DOCSIS options inserted by the cable modem itself.
  3258. This method attempts to extract MAC address information from suboption 36 (device id)
  3259. of the vendor specific option with vendor-id=4491. This vendor option is extracted from
  3260. the original client's message, not from any relay options.
  3261. </simpara>
  3262. </listitem>
  3263. </itemizedlist>
  3264. </para>
  3265. <para>Empty mac-sources is not allowed. If you do not want to specify it,
  3266. either simply omit mac-sources definition or specify it with the "any" value
  3267. which is the default.</para>
  3268. </section>
  3269. <section id="dhcp6-decline">
  3270. <title>Duplicate Addresses (DECLINE Support)</title>
  3271. <para>The DHCPv6 server is configured with a certain pool of
  3272. addresses that it is expected to hand out to the DHCPv6 clients.
  3273. It is assumed that the server is authoritative and has complete
  3274. jurisdiction over those addresses. However, due to various
  3275. reasons, such as misconfiguration or a faulty client implementation
  3276. that retains its address beyond the valid lifetime, there may be
  3277. devices connected that use those addresses without the server's
  3278. approval or knowledge.</para>
  3279. <para>Such an unwelcome event can be detected
  3280. by legitimate clients (using Duplicate Address Detection) and
  3281. reported to the DHCPv6 server using a DECLINE message. The server
  3282. will do a sanity check (if the client declining an address really
  3283. was supposed to use it), then will conduct a clean up operation
  3284. and confirm it by sending back a REPLY message. Any DNS entries
  3285. related to that address will be removed, the fact will be logged
  3286. and hooks will be triggered. After that is done, the address
  3287. will be marked as declined (which indicates that it is used by
  3288. an unknown entity and thus not available for assignment to
  3289. anyone) and a probation time will be set on it. Unless otherwise
  3290. configured, the probation period lasts 24 hours. After that
  3291. period, the server will recover the lease (i.e. put it back into
  3292. the available state) and the address will be available for assignment
  3293. again. It should be noted that if the underlying issue of a
  3294. misconfigured device is not resolved, the duplicate address
  3295. scenario will repeat. On the other hand, it provides an
  3296. opportunity to recover from such an event automatically, without
  3297. any sysadmin intervention.</para>
  3298. <para>To configure the decline probation period to a value other
  3299. than the default, the following syntax can be used:
  3300. <screen>
  3301. "Dhcp6": {
  3302. <userinput>"decline-probation-period": 3600</userinput>,
  3303. "subnet6": [ ... ],
  3304. ...
  3305. }
  3306. </screen>
  3307. The parameter is expressed in seconds, so the example above will instruct
  3308. the server to recycle declined leases after an hour.</para>
  3309. <para>There are several statistics and hook points associated with the
  3310. Decline handling procedure. The lease6_decline hook is triggered after the
  3311. incoming Decline message has been sanitized and the server is about to decline
  3312. the lease. The declined-addresses statistic is increased after the
  3313. hook returns (both global and subnet specific variants). (See
  3314. <xref linkend="dhcp4-stats"/> and <xref linkend="hooks-libraries"/> for more details
  3315. on DHCPv4 statistics and Kea hook points.)</para>
  3316. <para>Once the probation time elapses, the declined lease is recovered
  3317. using the standard expired lease reclamation procedure, with several
  3318. additional steps. In particular, both declined-addresses statistics
  3319. (global and subnet specific) are decreased. At the same time,
  3320. reclaimed-declined-addresses statistics (again in two variants, global and
  3321. subnet specific) are increased.</para>
  3322. <para>Note about statistics: The server does not decrease the
  3323. assigned-addresses statistics when a DECLINE message is received and
  3324. processed successfully. While technically a declined address is no longer
  3325. assigned, the primary usage of the assigned-addresses statistic is to
  3326. monitor pool utilization. Most people would forget to include
  3327. declined-addresses in the calculation, and simply do
  3328. assigned-addresses/total-addresses. This would have a bias towards
  3329. under-representing pool utilization. As this has a potential for major
  3330. issues, we decided not to decrease assigned addresses immediately after
  3331. receiving Decline, but to do it later when we recover the address back to
  3332. the available pool.</para>
  3333. </section>
  3334. <section id="dhcp6-stats">
  3335. <title>Statistics in the DHCPv6 Server</title>
  3336. <note>
  3337. <para>This section describes DHCPv6-specific statistics. For a general
  3338. overview and usage of statistics, see <xref linkend="stats" />.</para>
  3339. </note>
  3340. <para>
  3341. The DHCPv6 server supports the following statistics:
  3342. </para>
  3343. <table frame="all" id="dhcp6-statistics">
  3344. <title>DHCPv6 Statistics</title>
  3345. <tgroup cols='3'>
  3346. <colspec colname='statistic' align='center'/>
  3347. <colspec colname='type' align='center'/>
  3348. <colspec colname='description' align='left'/>
  3349. <thead>
  3350. <row>
  3351. <entry>Statistic</entry>
  3352. <entry>Data Type</entry>
  3353. <entry>Description</entry>
  3354. </row>
  3355. </thead>
  3356. <tbody>
  3357. <row>
  3358. <entry>pkt6-received</entry>
  3359. <entry>integer</entry>
  3360. <entry>Number of DHCPv6 packets received. This includes all packets:
  3361. valid, bogus, corrupted, rejected etc. This statistic is expected
  3362. to grow rapidly.</entry>
  3363. </row>
  3364. <row>
  3365. <entry>pkt6-receive-drop</entry>
  3366. <entry>integer</entry>
  3367. <entry>Number of incoming packets that were dropped. The exact reason
  3368. for dropping packets is logged, but the most common reasons may
  3369. be: an unacceptable or not supported packet type, direct responses
  3370. are forbidden, the server-id sent by the client does not match the
  3371. server's server-id or the packet is malformed.</entry>
  3372. </row>
  3373. <row>
  3374. <entry>pkt6-parse-failed</entry>
  3375. <entry>integer</entry>
  3376. <entry>Number of incoming packets that could not be parsed.
  3377. A non-zero value of this statistic indicates that the server
  3378. received a malformed or truncated packet. This may indicate problems
  3379. in your network, faulty clients, faulty relay agents or a bug in the
  3380. server.</entry>
  3381. </row>
  3382. <row>
  3383. <entry>pkt6-solicit-received</entry>
  3384. <entry>integer</entry>
  3385. <entry>
  3386. Number of SOLICIT packets received. This statistic is expected
  3387. to grow. Its increase means that clients that just booted
  3388. started their configuration process and their initial packets
  3389. reached your server.
  3390. </entry>
  3391. </row>
  3392. <row>
  3393. <entry>pkt6-advertise-received</entry>
  3394. <entry>integer</entry>
  3395. <entry>
  3396. Number of ADVERTISE packets received. Advertise packets are sent
  3397. by the server and the server is never expected to receive them. A non-zero
  3398. value of this statistic indicates an error occurring in the network.
  3399. One likely cause would be a misbehaving relay agent that incorrectly
  3400. forwards ADVERTISE messages towards the server rather back to the
  3401. clients.
  3402. </entry>
  3403. </row>
  3404. <row>
  3405. <entry>pkt6-request-received</entry>
  3406. <entry>integer</entry>
  3407. <entry>Number of REQUEST packets received. This statistic
  3408. is expected to grow. Its increase means that clients that just booted
  3409. received the server's response (ADVERTISE), accepted it and are now
  3410. requesting an address (REQUEST).
  3411. </entry>
  3412. </row>
  3413. <row>
  3414. <entry>pkt6-reply-received</entry>
  3415. <entry>integer</entry>
  3416. <entry>Number of REPLY packets received. This statistic is
  3417. expected to remain zero at all times, as REPLY packets are sent by
  3418. the server and the server is never expected to receive
  3419. them. A non-zero value indicates an error. One likely cause would be
  3420. a misbehaving relay agent that incorrectly forwards REPLY messages
  3421. towards the server, rather back to the clients.
  3422. </entry>
  3423. </row>
  3424. <row>
  3425. <entry>pkt6-renew-received</entry>
  3426. <entry>integer</entry>
  3427. <entry>Number of RENEW packets received. This statistic
  3428. is expected to grow. Its increase means that clients received their
  3429. addresses and prefixes and are trying to renew them.
  3430. </entry>
  3431. </row>
  3432. <row>
  3433. <entry>pkt6-rebind-received</entry>
  3434. <entry>integer</entry>
  3435. <entry>Number of REBIND packets received. A non-zero value
  3436. indicates that clients didn't receive responses to their RENEW messages
  3437. (regular lease renewal mechanism) and are attempting to find any server
  3438. that is able to take over their leases. It may mean that some server's
  3439. REPLY messages never reached the clients.
  3440. </entry>
  3441. </row>
  3442. <row>
  3443. <entry>pkt6-release-received</entry>
  3444. <entry>integer</entry>
  3445. <entry>Number of RELEASE packets received. This statistic is expected
  3446. to grow when a device is being shut down in the network. It
  3447. indicates that the address or prefix assigned is reported as no longer
  3448. needed. Note that many devices, especially wireless, do not send RELEASE
  3449. packets either because of design choice or due to the client moving out
  3450. of range.
  3451. </entry>
  3452. </row>
  3453. <row>
  3454. <entry>pkt6-decline-received</entry>
  3455. <entry>integer</entry>
  3456. <entry>
  3457. Number of DECLINE packets received. This statistic is expected to
  3458. remain close to zero. Its increase means that a client leased an
  3459. address, but discovered that the address is currently used by an
  3460. unknown device in your network. If this statistic is growing, it
  3461. may indicate a misconfigured server or devices that have statically
  3462. assigned conflicting addresses.
  3463. </entry>
  3464. </row>
  3465. <row>
  3466. <entry>pkt6-infrequest-received</entry>
  3467. <entry>integer</entry>
  3468. <entry>
  3469. Number of INFORMATION-REQUEST packets received. This statistic
  3470. is expected to grow if there are devices that are using
  3471. stateless DHCPv6. INFORMATION-REQUEST messages are used by
  3472. clients that request stateless configuration, i.e. options
  3473. and parameters other than addresses or prefixes.
  3474. </entry>
  3475. </row>
  3476. <row>
  3477. <entry>pkt6-dhcpv4-query-received</entry>
  3478. <entry>integer</entry>
  3479. <entry>
  3480. Number of DHCPv4-QUERY packets received. This
  3481. statistic is expected to grow if there are devices
  3482. that are using DHCPv4-over-DHCPv6. DHCPv4-QUERY
  3483. messages are used by DHCPv4 clients on an IPv6 only
  3484. line which encapsulates the requests over DHCPv6.
  3485. </entry>
  3486. </row>
  3487. <row>
  3488. <entry>pkt6-dhcpv4-response-received</entry>
  3489. <entry>integer</entry>
  3490. <entry>
  3491. Number of DHCPv4-RESPONSE packets received. This
  3492. statistic is expected to remain zero at all times, as
  3493. DHCPv4-RESPONSE packets are sent by the server and the
  3494. server is never expected to receive them. A non-zero
  3495. value indicates an error. One likely cause would be a
  3496. misbehaving relay agent that incorrectly forwards
  3497. DHCPv4-RESPONSE message towards the server rather
  3498. back to the clients.
  3499. </entry>
  3500. </row>
  3501. <row>
  3502. <entry>pkt6-unknown-received</entry>
  3503. <entry>integer</entry>
  3504. <entry>Number of packets received of an unknown type. A non-zero
  3505. value of this statistic indicates that the server received a
  3506. packet that it wasn't able to recognize: either it had an unsupported
  3507. type or was possibly malformed.</entry>
  3508. </row>
  3509. <row>
  3510. <entry>pkt6-sent</entry>
  3511. <entry>integer</entry>
  3512. <entry>Number of DHCPv6 packets sent. This statistic is expected
  3513. to grow every time the server transmits a packet. In general, it
  3514. should roughly match pkt6-received, as most incoming packets cause
  3515. the server to respond. There are exceptions (e.g. server receiving a
  3516. REQUEST with server-id matching other server), so do not worry, if
  3517. it is lesser than pkt6-received.</entry>
  3518. </row>
  3519. <row>
  3520. <entry>pkt6-advertise-sent</entry>
  3521. <entry>integer</entry>
  3522. <entry>Number of ADVERTISE packets sent. This statistic is
  3523. expected to grow in most cases after a SOLICIT is processed. There
  3524. are certain uncommon, but valid cases where incoming SOLICIT is
  3525. dropped, but in general this statistic is expected to be close to
  3526. pkt6-solicit-received.</entry>
  3527. </row>
  3528. <row>
  3529. <entry>pkt6-reply-sent</entry>
  3530. <entry>integer</entry>
  3531. <entry>Number of REPLY packets sent. This statistic is expected to
  3532. grow in most cases after a SOLICIT (with rapid-commit), REQUEST,
  3533. RENEW, REBIND, RELEASE, DECLINE or INFORMATION-REQUEST is
  3534. processed. There are certain cases where there is no response.
  3535. </entry>
  3536. </row>
  3537. <row>
  3538. <entry>pkt6-dhcpv4-response-sent</entry>
  3539. <entry>integer</entry>
  3540. <entry>Number of DHCPv4-RESPONSE packets sent. This
  3541. statistic is expected to grow in most cases after a
  3542. DHCPv4-QUERY is processed. There are certain cases where
  3543. there is no response.
  3544. </entry>
  3545. </row>
  3546. <row>
  3547. <entry>subnet[id].total-nas</entry>
  3548. <entry>integer</entry>
  3549. <entry>
  3550. This statistic shows the total number of NA addresses available for
  3551. DHCPv6 management for a given subnet. In other words, this is the sum
  3552. of all addresses in all configured pools. This statistic changes only
  3553. during configuration changes. Note that it does not take into account any
  3554. addresses that may be reserved due to host reservation. The
  3555. <emphasis>id</emphasis> is the subnet-id of a given subnet. This
  3556. statistic is exposed for each subnet separately and is
  3557. reset during a reconfiguration event.
  3558. </entry>
  3559. </row>
  3560. <row>
  3561. <entry>subnet[id].assigned-nas</entry>
  3562. <entry>integer</entry>
  3563. <entry>
  3564. This statistic shows the number of NA addresses in a given subnet that
  3565. are assigned. This statistic increases every time a new lease is allocated
  3566. (as a result of receiving a REQUEST message) and is decreased every time a
  3567. lease is released (a RELEASE message is received) or expires. The
  3568. <emphasis>id</emphasis> is the subnet-id of a given subnet. This
  3569. statistic is exposed for each subnet separately and is
  3570. reset during a reconfiguration event.
  3571. </entry>
  3572. </row>
  3573. <row>
  3574. <entry>subnet[id].total-pds</entry>
  3575. <entry>integer</entry>
  3576. <entry>
  3577. This statistic shows the total number of PD prefixes available for
  3578. DHCPv6 management for a given subnet. In other words, this is the sum
  3579. of all prefixes in all configured pools. This statistic changes only
  3580. during configuration changes. Note it does not take into account any
  3581. prefixes that may be reserved due to host reservation. The
  3582. <emphasis>id</emphasis> is the subnet-id of a given subnet. This
  3583. statistic is exposed for each subnet separately and is
  3584. reset during a reconfiguration event.
  3585. </entry>
  3586. </row>
  3587. <row>
  3588. <entry>subnet[id].assigned-pds</entry>
  3589. <entry>integer</entry>
  3590. <entry>
  3591. This statistic shows the number of PD prefixes in a given subnet that
  3592. are assigned. This statistic increases every time a new lease is allocated
  3593. (as a result of receiving a REQUEST message) and is decreased every time a
  3594. lease is released (a RELEASE message is received) or expires. The
  3595. <emphasis>id</emphasis> is the subnet-id of a given subnet. This statistic
  3596. is exposed for each subnet separately and is reset during a
  3597. reconfiguration event.
  3598. </entry>
  3599. </row>
  3600. <row>
  3601. <entry>reclaimed-leases</entry>
  3602. <entry>integer</entry>
  3603. <entry> This statistic is the number of expired leases that have been
  3604. reclaimed since server startup. It is incremented each time an expired
  3605. lease is reclaimed (it counts both NA and PD reclamations) and is reset
  3606. when the server is reconfigured.
  3607. </entry>
  3608. </row>
  3609. <row>
  3610. <entry>subnet[id].reclaimed-leases</entry>
  3611. <entry>integer</entry>
  3612. <entry>This statistic is the number of expired leases associated with
  3613. a given subnet (<emphasis>"id"</emphasis> is the subnet-id) that have
  3614. been reclaimed since server startup. It is incremented each time an expired
  3615. lease is reclaimed (it counts both NA and PD reclamations) and is reset
  3616. when the server is reconfigured.
  3617. </entry>
  3618. </row>
  3619. <row>
  3620. <entry>declined-addresses</entry>
  3621. <entry>integer</entry>
  3622. <entry>
  3623. This statistic shows the number of IPv6 addresses that are
  3624. currently declined and so counts the number of leases
  3625. currently unavailable. Once a lease is recovered, this
  3626. statistic will be decreased. Ideally, this statistic should be
  3627. zero. If this statistic is non-zero (or worse, increasing),
  3628. the network administrator should investigate if there is
  3629. a misbehaving device in the network. This is a global statistic
  3630. that covers all subnets.
  3631. </entry>
  3632. </row>
  3633. <row>
  3634. <entry>subnet[id].declined-addresses</entry>
  3635. <entry>integer</entry>
  3636. <entry>
  3637. This statistic shows the number of IPv6 addresses that are
  3638. currently declined in a given subnet. This statistic counts the
  3639. number of leases currently unavailable. Once a lease is
  3640. recovered, this statistic will be decreased. Ideally, this
  3641. statistic should be zero. If this statistic is
  3642. non-zero (or worse, increasing), a network administrator should
  3643. investigate if there is a misbehaving device in the network. The
  3644. <emphasis>id</emphasis> is the subnet-id of a given subnet. This
  3645. statistic is exposed for each subnet separately.
  3646. </entry>
  3647. </row>
  3648. <row>
  3649. <entry>reclaimed-declined-addresses</entry>
  3650. <entry>integer</entry>
  3651. <entry>
  3652. This statistic shows the number of IPv6 addresses that were
  3653. declined, but have now been recovered. Unlike
  3654. declined-addresses, this statistic never decreases. It can be used
  3655. as a long term indicator of how many actual valid Declines were
  3656. processed and recovered from. This is a global statistic that
  3657. covers all subnets.
  3658. </entry>
  3659. </row>
  3660. <row>
  3661. <entry>subnet[id].reclaimed-declined-addresses</entry>
  3662. <entry>integer</entry>
  3663. <entry>
  3664. This statistic shows the number of IPv6 addresses that were
  3665. declined, but have now been recovered. Unlike
  3666. declined-addresses, this statistic never decreases. It can be used
  3667. as a long term indicator of how many actual valid Declines were
  3668. processed and recovered from. The
  3669. <emphasis>id</emphasis> is the subnet-id of a given subnet. This
  3670. statistic is exposed for each subnet separately.
  3671. </entry>
  3672. </row>
  3673. </tbody>
  3674. </tgroup>
  3675. </table>
  3676. </section>
  3677. <section id="dhcp6-ctrl-channel">
  3678. <title>Management API for the DHCPv6 Server</title>
  3679. <para>
  3680. The management API allows the issuing of specific
  3681. management commands, such as statistics retrieval, reconfiguration or shutdown.
  3682. For more details, see <xref linkend="ctrl-channel" />. Currently the only
  3683. supported communication channel type is UNIX stream socket. By default there
  3684. are no sockets open. To instruct Kea to open a socket, the following entry
  3685. in the configuration file can be used:
  3686. <screen>
  3687. "Dhcp6": {
  3688. "control-socket": {
  3689. "socket-type": "unix",
  3690. "socket-name": <userinput>"/path/to/the/unix/socket"</userinput>
  3691. },
  3692. "subnet6": [
  3693. ...
  3694. ],
  3695. ...
  3696. }
  3697. </screen>
  3698. </para>
  3699. <para>
  3700. The length of the path specified by the <command>socket-name</command>
  3701. parameter is restricted by the maximum length for the unix socket name
  3702. on your operating system, i.e. the size of the <command>sun_path</command>
  3703. field in the <command>sockaddr_un</command> structure, decreased by 1.
  3704. This value varies on different operating systems between 91 and 107
  3705. characters. Typical values are 107 on Linux and 103 on FreeBSD.
  3706. </para>
  3707. <para>
  3708. Communication over control channel is conducted using JSON structures.
  3709. See the Control Channel section in the Kea Developer's Guide for more details.
  3710. </para>
  3711. <para>The DHCPv6 server supports the following operational commands:
  3712. <itemizedlist>
  3713. <listitem>build-report</listitem>
  3714. <listitem>config-get</listitem>
  3715. <listitem>config-reload</listitem>
  3716. <listitem>config-set</listitem>
  3717. <listitem>config-test</listitem>
  3718. <listitem>config-write</listitem>
  3719. <listitem>leases-reclaim</listitem>
  3720. <listitem>list-commands</listitem>
  3721. <listitem>shutdown</listitem>
  3722. <listitem>version-get</listitem>
  3723. </itemizedlist>
  3724. as described in <xref linkend="commands-common"/>. In addition,
  3725. it supports the following statistics related commands:
  3726. <itemizedlist>
  3727. <listitem>statistic-get</listitem>
  3728. <listitem>statistic-reset</listitem>
  3729. <listitem>statistic-remove</listitem>
  3730. <listitem>statistic-get-all</listitem>
  3731. <listitem>statistic-reset-all</listitem>
  3732. <listitem>statistic-remove-all</listitem>
  3733. </itemizedlist>
  3734. as described here <xref linkend="command-stats"/>.
  3735. </para>
  3736. </section>
  3737. <section>
  3738. <title>User context in IPv6 pools</title>
  3739. <para>
  3740. Kea allows loading hook libraries that sometimes could benefit from
  3741. additional parameters. If such a parameter is specific to the whole
  3742. library, it is typically defined as a parameter for the hook library.
  3743. However, sometimes there is a need to specify parameters that are
  3744. different for each pool.
  3745. </para>
  3746. <para>
  3747. Let's consider an example where certain parameters are supposed
  3748. to be delivered to clients in form of additional options,
  3749. and the values of those options are correlated to delegated
  3750. prefixes. It seems reasonable to keep those parameters with
  3751. the the definition of the PD pool. On the other hand, this
  3752. functionality is is not part of the base Kea code so Kea will
  3753. not understand any hook-specific keywords in that definition.
  3754. The solution to this problem is to use user context. For
  3755. each PD pool that is expected to be used with this feature,
  3756. a "user context" is defined. This is a structure that holds the
  3757. parameters used by the hook library when it is loaded.
  3758. An example configuration could look as follows:
  3759. <screen>
  3760. "Dhcp4": {
  3761. "subnet6": [ {
  3762. "pd-pools": [
  3763. {
  3764. "prefix": "2001:db8::",
  3765. "prefix-len": 56,
  3766. "delegated-len": 64,
  3767. <userinput>"user-context": {
  3768. "threshold-percent": 85,
  3769. "v4-network": "192.168.0.0/16",
  3770. "v4-overflow": "10.0.0.0/16"
  3771. }</userinput>
  3772. } ],
  3773. "subnet": "2001:db8::/32"
  3774. } ],
  3775. ...
  3776. }</screen>
  3777. </para>
  3778. <para>
  3779. Kea does not interpret or use the content of the user context:
  3780. it just stores it, making it available to the hook
  3781. libraries. It is up to each hook library to extract the information
  3782. and make use of it.
  3783. </para>
  3784. <para>
  3785. Currently only address and prefix pools allow definition of user
  3786. contexts, but this concept is expected to be enhanced to other
  3787. structures in the future. For more background information, see <xref
  3788. linkend="user-context"/>
  3789. </para>
  3790. </section>
  3791. <section id="dhcp6-std">
  3792. <title>Supported DHCPv6 Standards</title>
  3793. <para>The following standards are currently
  3794. supported:</para>
  3795. <itemizedlist>
  3796. <listitem>
  3797. <simpara><emphasis>Dynamic Host Configuration Protocol for IPv6</emphasis>,
  3798. <ulink url="http://tools.ietf.org/html/rfc3315">RFC 3315</ulink>:
  3799. Supported messages are SOLICIT,
  3800. ADVERTISE, REQUEST, RELEASE, RENEW, REBIND, INFORMATION-REQUEST,
  3801. CONFIRM and REPLY.</simpara>
  3802. </listitem>
  3803. <listitem>
  3804. <simpara><emphasis>IPv6 Prefix Options for
  3805. Dynamic Host Configuration Protocol (DHCP) version 6</emphasis>,
  3806. <ulink url="http://tools.ietf.org/html/rfc3633">RFC 3633</ulink>:
  3807. Supported options are IA_PD and
  3808. IA_PREFIX. Also supported is the status code NoPrefixAvail.</simpara>
  3809. </listitem>
  3810. <listitem>
  3811. <simpara><emphasis>DNS Configuration options for Dynamic Host
  3812. Configuration Protocol for IPv6 (DHCPv6)</emphasis>,
  3813. <ulink url="http://tools.ietf.org/html/rfc3646">RFC 3646</ulink>:
  3814. Supported option is DNS_SERVERS.</simpara>
  3815. </listitem>
  3816. <listitem>
  3817. <simpara><emphasis>The Dynamic Host Configuration Protocol for IPv6 (DHCPv6)
  3818. Relay Agent Remote-ID Option</emphasis>,
  3819. <ulink url="http://tools.ietf.org/html/rfc4649">RFC 4649</ulink>:
  3820. REMOTE-ID option is supported.</simpara>
  3821. </listitem>
  3822. <listitem>
  3823. <simpara><emphasis>The Dynamic Host Configuration Protocol for IPv6 (DHCPv6) Client
  3824. Fully Qualified Domain Name (FQDN) Option</emphasis>,
  3825. <ulink url="http://tools.ietf.org/html/rfc4704">RFC 4704</ulink>:
  3826. Supported option is CLIENT_FQDN.</simpara>
  3827. </listitem>
  3828. <listitem>
  3829. <simpara><emphasis>Dynamic Host Configuration Protocol for IPv6 (DHCPv6)
  3830. Option for Dual-Stack Lite</emphasis>,
  3831. <ulink url="http://tools.ietf.org/html/rfc6334">RFC 6334</ulink>:
  3832. the AFTR-Name DHCPv6 Option is supported.</simpara>
  3833. </listitem>
  3834. <listitem>
  3835. <simpara><emphasis>Relay-Supplied DHCP Options</emphasis>,
  3836. <ulink url="http://tools.ietf.org/html/rfc6422">RFC 6422</ulink>:
  3837. Full functionality is supported: OPTION_RSOO, ability of the server
  3838. to echo back the options, checks whether an option is RSOO-enabled,
  3839. ability to mark additional options as RSOO-enabled.</simpara>
  3840. </listitem>
  3841. <listitem>
  3842. <simpara><emphasis>Prefix Exclude Option for DHCPv6-based Prefix
  3843. Delegation</emphasis>,
  3844. <ulink url="http://tools.ietf.org/html/rfc6603">RFC
  3845. 6603</ulink>: Prefix Exclude option is supported.</simpara>
  3846. </listitem>
  3847. <listitem>
  3848. <simpara><emphasis>Client Link-Layer Address Option in
  3849. DHCPv6</emphasis>,
  3850. <ulink url="http://tools.ietf.org/html/rfc6939">RFC
  3851. 6939</ulink>: Supported option is client link-layer
  3852. address option.</simpara>
  3853. </listitem>
  3854. <listitem>
  3855. <simpara><emphasis>Issues and Recommendations with Multiple
  3856. Stateful DHCPv6 Options</emphasis>,
  3857. <ulink url="http://tools.ietf.org/html/rfc7550">RFC
  3858. 7550</ulink>: All recommendations related to the DHCPv6 server
  3859. operation are supported.</simpara>
  3860. </listitem>
  3861. </itemizedlist>
  3862. </section>
  3863. <section id="dhcp6-limit">
  3864. <title>DHCPv6 Server Limitations</title>
  3865. <para> These are the current limitations of the DHCPv6 server
  3866. software. Most of them are reflections of the early stage of
  3867. development and should be treated as <quote>not implemented
  3868. yet</quote>, rather than actual limitations.</para>
  3869. <itemizedlist>
  3870. <listitem>
  3871. <simpara>
  3872. The server will allocate, renew or rebind a maximum of one lease
  3873. for a particular IA option (IA_NA or IA_PD) sent by a client.
  3874. <ulink url="http://tools.ietf.org/html/rfc3315">RFC 3315</ulink> and
  3875. <ulink url="http://tools.ietf.org/html/rfc3633">RFC 3633</ulink> allow
  3876. for multiple addresses or prefixes to be allocated for a single IA.
  3877. </simpara>
  3878. </listitem>
  3879. <listitem>
  3880. <simpara>Temporary addresses are not supported.</simpara>
  3881. </listitem>
  3882. <listitem>
  3883. <simpara>
  3884. Client reconfiguration (RECONFIGURE) is not yet supported.
  3885. </simpara>
  3886. </listitem>
  3887. </itemizedlist>
  3888. </section>
  3889. <!--
  3890. <section id="dhcp6-srv-examples">
  3891. <title>Kea DHCPv6 server examples</title>
  3892. <para>
  3893. This section provides easy to use example. Each example can be read
  3894. separately. It is not intended to be read sequentially as there will
  3895. be many repetitions between examples. They are expected to serve as
  3896. easy to use copy-paste solutions to many common deployments.
  3897. </para>
  3898. @todo: add simple configuration for direct clients
  3899. @todo: add configuration for relayed clients
  3900. @todo: add client classification example
  3901. </section> -->
  3902. </chapter>