dhcp6-srv.xml 183 KB

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