dhcp6-srv.xml 176 KB

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