dhcp6-srv.xml 184 KB

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