dhcp6-srv.xml 198 KB

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