dhcp6-srv.xml 182 KB

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