dhcp6-srv.xml 179 KB

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