dhcp6-srv.xml 115 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672
  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 default DHCPv6 ports will not be able to
  39. handle regular DHCPv6 queries.</simpara>
  40. </listitem>
  41. <listitem>
  42. <simpara>
  43. <command>-v</command> - prints out Kea version and exits.
  44. </simpara>
  45. </listitem>
  46. <listitem>
  47. <simpara>
  48. <command>-V</command> - prints out Kea extended version with
  49. additional parameters and exits.
  50. </simpara>
  51. </listitem>
  52. <listitem>
  53. <simpara>
  54. <command>-W</command> - prints out Kea configuration report
  55. and exits.
  56. </simpara>
  57. </listitem>
  58. </itemizedlist>
  59. <para>
  60. The <command>-V</command> returns the versions of the
  61. external libraries dynamically linked, at the opposite
  62. the <command>-W</command> describes the environment used
  63. to build Kea.
  64. </para>
  65. <para>
  66. All of the executable binaries in Kea contain an embedded
  67. copy of the <filename>config.report</filename>
  68. file produced by <userinput>./configure</userinput>
  69. and displayed by the <command>-W</command> command,
  70. but is accessible in some other ways when needed.
  71. The following command may be used to extract this information.
  72. The binary <userinput>path</userinput> may be found in the
  73. install directory or in the <filename>.libs</filename>
  74. subdirectory in the source treee. For example
  75. <filename>kea/src/bin/dhcp6/.libs/kea-dhcp6</filename>.
  76. <screen>
  77. strings <userinput>path</userinput>/kea-dhcp6 | sed -n 's/;;;; //p'
  78. </screen>
  79. </para>
  80. <para>
  81. When running in a console, the server can be shut down by
  82. pressing ctrl-c. It detects the key combination and shuts
  83. down gracefully.
  84. </para>
  85. <para>
  86. On start-up, the server will detect available network interfaces
  87. and will attempt to open UDP sockets on all interfaces
  88. mentioned in the configuration file.
  89. </para>
  90. <para>
  91. Since the DHCPv6 server opens privileged ports, it requires root
  92. access. Make sure you run this daemon as root.
  93. </para>
  94. </section>
  95. <section id="dhcp6-configuration">
  96. <title>DHCPv6 Server Configuration</title>
  97. <section>
  98. <title>Introduction</title>
  99. <para>
  100. This section explains how to configure the DHCPv6 server using the
  101. Kea configuration backend. (Kea configuration using any other
  102. backends is outside of scope of this document.) Before DHCPv6
  103. is started, its configuration file has to be created. The
  104. basic configuration looks as follows:
  105. <screen>
  106. {
  107. # DHCPv6 configuration starts on the next line
  108. "Dhcp6": {
  109. # First we set up global values
  110. "renew-timer": 1000,
  111. "rebind-timer": 2000,
  112. "preferred-lifetime": 3000,
  113. "valid-lifetime": 4000,
  114. # Next we setup the interfaces to be used by the server.
  115. "interfaces-config": {
  116. "interfaces": [ "eth0" ]
  117. },
  118. # And we specify the type of a lease database
  119. "lease-database": {
  120. "type": "memfile",
  121. "persist": true,
  122. "name": "/var/kea/dhcp6.leases"
  123. },
  124. # Finally, we list the subnets from which we will be leasing addresses.
  125. "subnet6": [
  126. {
  127. "subnet": "2001:db8:1::/64",
  128. "pools": [
  129. {
  130. "pool": "2001:db8:1::1-2001:db8:1::ffff"
  131. }
  132. ]
  133. }
  134. ]
  135. # DHCPv6 configuration ends with the next line
  136. }
  137. } </screen>
  138. </para>
  139. <para>The following paragraphs provide a brief overview of the parameters in
  140. the above example and
  141. their format. Subsequent sections of this chapter go into much greater detail
  142. for these and other parameters.</para>
  143. <para>The lines starting with a hash (#) are comments and are ignored by
  144. the server; they do not impact its
  145. operation in any way.</para>
  146. <para>The configuration starts in the first line with the initial
  147. opening curly bracket (or brace). Each configuration consists of
  148. one or more objects. In this specific example, we have only one
  149. object called Dhcp6. This is a simplified configuration, as usually
  150. there will be additional objects, like <command>Logging</command> or
  151. <command>DhcpDns</command>, but we omit them now for clarity. The Dhcp6
  152. configuration starts with the <command>"Dhcp6": {</command> line
  153. and ends with the corresponding closing brace (in the above example,
  154. the brace after the last comment). Everything defined between those
  155. lines is considered to be the Dhcp6 configuration.</para>
  156. <para>In the general case, the order in which those parameters appear does not
  157. matter. There are two caveats here though. The first one is to remember that
  158. the configuration file must be well formed JSON. That means that parameters
  159. for any given scope must be separated by a comma and there must not be a comma
  160. after the last parameter. When reordering a configuration file, keep in mind that
  161. moving a parameter to or from the last position in a given scope may require
  162. moving the comma as well. The second caveat is that it is uncommon &mdash; although
  163. legal JSON &mdash; to
  164. repeat the same parameter multiple times. If that happens, the last occurrence of a
  165. given parameter in a given scope is used while all previous instances are
  166. ignored. This is unlikely to cause any confusion as there are no real life
  167. reasons to keep multiple copies of the same parameter in your configuration
  168. file.</para>
  169. <para>Moving onto the DHCPv6 configuration elements, the very first few elements
  170. define some global parameters. <command>valid-lifetime</command>
  171. defines for how long the addresses (leases) given out by the server are valid. If
  172. nothing changes, a client that got an address is allowed to use it for 4000
  173. seconds. (Note that integer numbers are specified as is, without any quotes
  174. around them.) The address will become deprecated in 3000 seconds (clients are
  175. allowed to keep old connections, but can't use this address for creating new
  176. connections). <command>renew-timer</command> and <command>
  177. rebind-timer</command> are values that define T1 and T2 timers that govern when
  178. the client will begin the renewal and rebind procedures.</para>
  179. <para>The <command>interfaces-config</command> map specifies the server
  180. configuration concerning the network interfaces, on which the server should
  181. listen to the DHCP messages. The <command>interfaces</command> parameter
  182. specifies a list of network interfaces on which the server should listen.
  183. Lists are opened and closed with square brackets, with elements separated
  184. by commas. Had we wanted to listen on two interfaces, the
  185. <command>interfaces-config</command> would look like this:
  186. <screen>
  187. "interfaces-config": {
  188. "interfaces": [ "eth0", "eth1" ]
  189. },
  190. </screen>
  191. </para>
  192. <para>The next couple of lines define the lease database, the place where the server
  193. stores its lease information. This particular example tells the server to use
  194. <command>memfile</command>, which is the simplest (and fastest) database
  195. backend. It uses an in-memory database and stores leases on disk in a CSV
  196. file. This is a very simple configuration. Usually, lease database configuration
  197. is more extensive and contains additional parameters. Note that
  198. <command>lease-database</command>
  199. is an object and opens up a new scope, using an opening brace.
  200. Its parameters (just one in this example -- <command>type</command>)
  201. follow. Had there been more than one, they would be separated by commas. This
  202. scope is closed with a closing brace. As more parameters follow, a trailing
  203. comma is present.</para>
  204. <para>Finally, we need to define a list of IPv6 subnets. This is the
  205. most important DHCPv6 configuration structure as the server uses that
  206. information to process clients' requests. It defines all subnets from
  207. which the server is expected to receive DHCP requests. The subnets are
  208. specified with the <command>subnet6</command> parameter. It is a list,
  209. so it starts and ends with square brackets. Each subnet definition in
  210. the list has several attributes associated with it, so it is a structure
  211. and is opened and closed with braces. At minimum, a subnet definition
  212. has to have at least two parameters: <command>subnet</command> (that
  213. defines the whole subnet) and <command>pool</command> (which is a list of
  214. dynamically allocated pools that are governed by the DHCP server).</para>
  215. <para>The example contains a single subnet. Had more than one been defined,
  216. additional elements
  217. in the <command>subnet6</command> parameter would be specified and
  218. separated by commas. For example, to define two subnets, the following
  219. syntax would be used:
  220. <screen>
  221. "subnet6": [
  222. {
  223. "pools": [
  224. {
  225. "pool": "2001:db8:1::/112"
  226. }
  227. ],
  228. "subnet": "2001:db8:1::/64"
  229. },
  230. {
  231. "pools": [ { "pool": "2001:db8:2::1-2001:db8:2::ffff" } ],
  232. "subnet": "2001:db8:2::/64",
  233. "interface": "eth0"
  234. }
  235. ]
  236. </screen>
  237. Note that indentation is optional and is used for aesthetic purposes only.
  238. In some cases in may be preferable to use more compact notation.
  239. </para>
  240. <para>After all parameters are specified, we have two contexts open:
  241. global and Dhcp6, hence we need two closing curly brackets to close them.
  242. In a real life configuration file there most likely would be additional
  243. components defined such as Logging or DhcpDdns, so the closing brace would
  244. be followed by a comma and another object definition.</para>
  245. </section>
  246. <section>
  247. <title>Lease Storage</title>
  248. <para>All leases issued by the server are stored in the lease database.
  249. Currently there are three database backends available:
  250. memfile (which is the default backend), MySQL and PostgreSQL.</para>
  251. <section>
  252. <title>Memfile, Basic Storage for Leases</title>
  253. <para>The server is able to store lease data in different repositories. Larger
  254. deployments may elect to store leases in a database. <xref
  255. linkend="database-configuration6"/> describes this option. In typical
  256. smaller deployments though, the server will use a CSV file rather than a database to
  257. store lease information. As well as requiring less administration, an
  258. advantage of using a file for storage is that it
  259. eliminates a dependency on third-party database software.</para>
  260. <para>The configuration of the file backend (Memfile) is controlled through
  261. the Dhcp6/lease-database parameters. The <command>type</command> parameter
  262. is mandatory and it specifies which storage for leases the server should use.
  263. The value of <userinput>"memfile"</userinput> indicates that the file should
  264. be used as the storage. The following list presents the remaining, not mandatory
  265. parameters, which can be used to configure the Memfile backend.
  266. <itemizedlist>
  267. <listitem>
  268. <simpara><command>persist</command>: controls whether the new leases and
  269. updates to existing leases are written to the file. It is strongly
  270. recommended that the value of this parameter is set to
  271. <userinput>true</userinput> at all times, during the server's normal
  272. operation. Not writing leases to disk will mean that if a server is restarted
  273. (e.g. after a power failure), it will not know what addresses have been
  274. assigned. As a result, it may hand out addresses to new clients that are
  275. already in use. The value of <userinput>false</userinput> is mostly useful
  276. for performance testing purposes. The default value of the
  277. <command>persist</command> parameter is <userinput>true</userinput>,
  278. which enables writing lease updates
  279. to the lease file.
  280. </simpara>
  281. </listitem>
  282. <listitem>
  283. <simpara><command>name</command>: specifies an absolute location of the lease
  284. file in which new leases and lease updates will be recorded. The default value
  285. for this parameter is <userinput>"[kea-install-dir]/var/kea/kea-leases6.csv"
  286. </userinput>.</simpara>
  287. </listitem>
  288. <listitem>
  289. <simpara><command>lfc-interval</command>: specifies the interval in seconds, at
  290. which the server (Memfile backend) will perform a lease file cleanup (LFC),
  291. which removes the redundant (historical) information from the lease file
  292. and effectively reduces the lease file size. The cleanup process is described
  293. in more detailed fashion further in this section. The default value of the
  294. <command>lfc-interval</command> is <userinput>0</userinput>, which disables
  295. the LFC.</simpara>
  296. </listitem>
  297. </itemizedlist>
  298. </para>
  299. <para>The example configuration of the Memfile backend is presented below:
  300. <screen>
  301. "Dhcp6": {
  302. "lease-database": {
  303. <userinput>"type": "memfile"</userinput>,
  304. <userinput>"persist": true</userinput>,
  305. <userinput>"name": "/tmp/kea-leases6.csv"</userinput>,
  306. <userinput>"lfc-interval": 1800</userinput>
  307. }
  308. }
  309. </screen>
  310. </para>
  311. <para>It is important to know how the lease file contents are organized
  312. to understand why the periodic lease file cleanup is needed. Every time when
  313. the server updates a lease or creates a new lease for the client, the new
  314. lease information must be recorded in the lease file. For performance reasons,
  315. the server does not supersede the existing client's lease, as it would require
  316. the lookup of the specific lease entry, but simply appends the new lease
  317. information at the end of the lease file. The previous lease entries for the
  318. client are not removed. When the server loads leases from the lease file, e.g.
  319. at the server startup, it assumes that the latest lease entry for the client
  320. is the valid one. The previous entries are discarded. This means that the
  321. server can re-construct the accurate information about the leases even though
  322. there may be many lease entries for each client. However, storing many entries
  323. for each client results in bloated lease file and impairs the performance of
  324. the server's startup and reconfiguration, as it needs to process larger number
  325. of lease entries.
  326. </para>
  327. <para>The lease file cleanup removes all previous entries for each client and
  328. leaves only the latest ones. The interval at which the cleanup is performed
  329. is configurable, and it should be selected according to the frequency of lease
  330. renewals initiated by the clients. The more frequent renewals are, the lesser
  331. value of the <command>lfc-interval</command> should be. Note however, that the
  332. LFC takes time and thus it is possible (although unlikely) that new cleanup
  333. is started while the previous cleanup instance is still running, if the
  334. <command>lfc-interval</command> is too short. The server would recover from
  335. this by skipping the new cleanup when it detects that the previous cleanup
  336. is still in progress. But, this implies that the actual cleanups will be
  337. triggered more rarely than configured. Moreover, triggering a new cleanup
  338. adds an overhead to the server, which will not be able to respond to new
  339. requests for a short period of time when the new cleanup process is spawned.
  340. Therefore, it is recommended that the <command>lfc-interval</command> value
  341. is selected in a way that would allow for completing the cleanup before the
  342. new cleanup is triggered.
  343. </para>
  344. <para>The LFC is performed by a separate process (in background) to avoid
  345. performance impact on the server process. In order to avoid the conflicts
  346. between the two processes both using the same lease files, the LFC process
  347. operates on the copy of the original lease file, rather than on the lease
  348. file used by the server to record lease updates. There are also other files
  349. being created as a side effect of the lease file cleanup. The detailed
  350. description of the LFC is located on the Kea wiki:
  351. <ulink url="http://kea.isc.org/wiki/LFCDesign"/>.
  352. </para>
  353. </section>
  354. <section id="database-configuration6">
  355. <title>Database Configuration</title>
  356. <note>
  357. <para>Database access information must be configured for the DHCPv6 server,
  358. even if it has already been configured for the DHCPv4 server. The servers
  359. store their information independently, so each server can use a separate
  360. database or both servers can use the same database.</para>
  361. </note>
  362. <para>Database configuration is controlled through the Dhcp6/lease-database
  363. parameters. The type of the database must be set to "mysql" or "postgresql",
  364. e.g.
  365. <screen>
  366. "Dhcp6": { "lease-database": { <userinput>"type": "mysql"</userinput>, ... }, ... }
  367. </screen>
  368. Next, the name of the database is to hold the leases must be set: this is the
  369. name used when the lease database was created (see <xref linkend="mysql-database-create"/>
  370. or <xref linkend="pgsql-database-create"/>).
  371. <screen>
  372. "Dhcp6": { "lease-database": { <userinput>"name": "<replaceable>database-name</replaceable>" </userinput>, ... }, ... }
  373. </screen>
  374. If the database is located on a different system than the DHCPv6 server, the
  375. database host name must also be specified (although it should be noted that this
  376. configuration may have a severe impact on server performance):
  377. <screen>
  378. "Dhcp6": { "lease-database": { <userinput>"host": <replaceable>remote-host-name</replaceable></userinput>, ... }, ... }
  379. </screen>
  380. The usual state of affairs will be to have the database on the same machine as
  381. the DHCPv6 server. In this case, set the value to the empty string:
  382. <screen>
  383. "Dhcp6": { "lease-database": { <userinput>"host" : ""</userinput>, ... }, ... }
  384. </screen>
  385. </para>
  386. <para>Finally, the credentials of the account under which the server will
  387. access the database should be set:
  388. <screen>
  389. "Dhcp6": { "lease-database": { <userinput>"user": "<replaceable>user-name</replaceable>"</userinput>,
  390. <userinput>"password": "<replaceable>password</replaceable>"</userinput>,
  391. ... },
  392. ... }
  393. </screen>
  394. If there is no password to the account, set the password to the empty string
  395. "". (This is also the default.)</para>
  396. </section>
  397. </section>
  398. <section id="dhcp6-interface-selection">
  399. <title>Interface selection</title>
  400. <para>The DHCPv6 server has to be configured to listen on specific network
  401. interfaces. The simplest network interface configuration instructs the server to
  402. listen on all available interfaces:
  403. <screen>
  404. "Dhcp6": {
  405. "interfaces-config": {
  406. "interfaces": [ <userinput>"*"</userinput> ]
  407. }
  408. ...
  409. }
  410. </screen>
  411. The asterisk plays the role of a wildcard and means "listen on all interfaces".
  412. However, it is usually a good idea to explicitly specify interface names:
  413. <screen>
  414. "Dhcp6": {
  415. "interfaces-config": {
  416. "interfaces": [ <userinput>"eth1", "eth3"</userinput> ]
  417. },
  418. ...
  419. }
  420. </screen>
  421. </para>
  422. <para>It is possible to use wildcard interface name (asterisk) concurrently
  423. with the actual interface names:
  424. <screen>
  425. "Dhcp6": {
  426. "interfaces-config": {
  427. "interfaces": [ <userinput>"eth1", "eth3", "*"</userinput> ]
  428. },
  429. ...
  430. }
  431. </screen>
  432. It is anticipated that this will form of usage only be used where it is desired to
  433. temporarily override a list of interface names and listen on all interfaces.
  434. </para>
  435. </section>
  436. <section id="ipv6-subnet-id">
  437. <title>IPv6 Subnet Identifier</title>
  438. <para>
  439. The subnet identifier is a unique number associated with a particular subnet.
  440. In principle, it is used to associate clients' leases with respective subnets.
  441. When the subnet identifier is not specified for a subnet being configured, it will
  442. be automatically assigned by the configuration mechanism. The identifiers
  443. are assigned from 1 and are monotonically increased for each subsequent
  444. subnet: 1, 2, 3 ....
  445. </para>
  446. <para>
  447. If there are multiple subnets configured with auto-generated identifiers and
  448. one of them is removed, the subnet identifiers may be renumbered. For example:
  449. if there are four subnets and the third is removed the last subnet will be assigned
  450. the identifier that the third subnet had before removal. As a result, the leases
  451. stored in the lease database for subnet 3 are now associated with
  452. subnet 4, which may have unexpected consequences. In the future it is planned
  453. to implement a mechanism to preserve auto-generated subnet ids upon removal
  454. of one of the subnets. Currently, the only remedy for this issue is to
  455. manually specify a unique subnet identifier for each subnet.
  456. </para>
  457. <para>
  458. The following configuration will assign the specified subnet
  459. identifier to the newly configured subnet:
  460. <screen>
  461. "Dhcp6": {
  462. "subnet6": [
  463. {
  464. "subnet": "2001:db8:1::/64",
  465. <userinput>"id": 1024</userinput>,
  466. ...
  467. }
  468. ]
  469. }
  470. </screen>
  471. This identifier will not change for this subnet unless the "id" parameter is
  472. removed or set to 0. The value of 0 forces auto-generation of the subnet
  473. identifier.
  474. </para>
  475. <!-- @todo: describe whether database needs to be updated after changing
  476. id -->
  477. </section>
  478. <section id="dhcp6-unicast">
  479. <title>Unicast traffic support</title>
  480. <para>
  481. When the DHCPv6 server starts, by default it listens to the DHCP traffic
  482. sent to multicast address ff02::1:2 on each interface that it is
  483. configured to listen on (see <xref linkend="dhcp6-interface-selection"/>).
  484. In some cases it is useful to configure a server to handle incoming
  485. traffic sent to the global unicast addresses as well. The most common
  486. reason for that is to have relays send their traffic to the server
  487. directly. To configure the server to listen on a specific unicast address, the
  488. notation to specify interfaces has been extended. An interface name can be
  489. optionally followed by a slash, followed by the global unicast address on which
  490. the server should listen. This will be done in addition to normal
  491. link-local binding + listening on ff02::1:2 address. The sample configuration
  492. below shows how to listen on 2001:db8::1 (a global address)
  493. configured on the eth1 interface.
  494. </para>
  495. <para>
  496. <screen>
  497. "Dhcp6": {
  498. "interfaces-config": {
  499. "interfaces": [ <userinput>"eth1/2001:db8::1"</userinput> ]
  500. },
  501. ...
  502. }
  503. </screen>
  504. This configuration will cause the server to listen on
  505. eth1 on link-local address, multicast group (ff02::1:2) and 2001:db8::1.
  506. </para>
  507. <para>
  508. It is possible to mix interface names, wildcards and interface name/addresses
  509. on the list of interfaces. It is not possible to specify more than one
  510. unicast address on a given interface.
  511. </para>
  512. <para>
  513. Care should be taken to specify proper unicast addresses. The server will
  514. attempt to bind to those addresses specified, without any additional checks.
  515. This approach is selected on purpose, so the software can be used to
  516. communicate over uncommon addresses if the administrator so desires.
  517. </para>
  518. </section>
  519. <section id="dhcp6-address-config">
  520. <title>Subnet and Address Pool</title>
  521. <para>
  522. The essential role of a DHCPv6 server is address assignment. For this,
  523. the server has to be configured with at least one subnet and one pool of dynamic
  524. addresses to be managed. For example, assume that the server
  525. is connected to a network segment that uses the 2001:db8:1::/64
  526. prefix. The Administrator of that network has decided that addresses from range
  527. 2001:db8:1::1 to 2001:db8:1::ffff are going to be managed by the Dhcp6
  528. server. Such a configuration can be achieved in the following way:
  529. <screen>
  530. "Dhcp6": {
  531. <userinput>"subnet6": [
  532. {
  533. "subnet": "2001:db8:1::/64",
  534. "pools": [
  535. {
  536. "pool": "2001:db8:1::1-2001:db8:1::ffff"
  537. }
  538. ],
  539. ...
  540. }
  541. ]</userinput>
  542. }</screen>
  543. Note that subnet is defined as a simple string, but the pool parameter
  544. is actually a list of pools: for this reason, the pool definition is
  545. enclosed in square brackets, even though only one range of addresses
  546. is specified.</para>
  547. <para>Each <command>pool</command> is a structure that contains the
  548. parameters that describe a single pool. Currently there is only one
  549. parameter, <command>pool</command>, which gives the range of addresses
  550. in the pool. Additional parameters will be added in future releases of
  551. Kea.</para>
  552. <para>It is possible to define more than one pool in a
  553. subnet: continuing the previous example, further assume that
  554. 2001:db8:1:0:5::/80 should also be managed by the server. It could be written as
  555. 2001:db8:1:0:5:: to 2001:db8:1::5:ffff:ffff:ffff, but typing so many 'f's
  556. is cumbersome. It can be expressed more simply as 2001:db8:1:0:5::/80. Both
  557. formats are supported by Dhcp6 and can be mixed in the pool list.
  558. For example, one could define the following pools:
  559. <screen>
  560. "Dhcp6": {
  561. <userinput>"subnet6": [
  562. {
  563. "subnet": "2001:db8:1::/64",
  564. "pools": [
  565. { "pool": "2001:db8:1::1-2001:db8:1::ffff" },
  566. { "pool": "2001:db8:1:05::/80" }
  567. ]</userinput>,
  568. ...
  569. }
  570. ]
  571. }</screen>
  572. The number of pools is not limited, but for performance reasons it is recommended to
  573. use as few as possible.
  574. </para>
  575. <para>
  576. The server may be configured to serve more than one subnet. To add a second subnet,
  577. use a command similar to the following:
  578. <screen>
  579. "Dhcp6": {
  580. <userinput>"subnet6": [
  581. {
  582. "subnet": "2001:db8:1::/64",
  583. "pools": [
  584. { "pool": "2001:db8:1::1-2001:db8:1::ffff" }
  585. ]
  586. },
  587. {
  588. "subnet": "2001:db8:2::/64",
  589. "pools": [
  590. { "pool": "2001:db8:2::/64" }
  591. ]
  592. },
  593. </userinput>
  594. ...
  595. ]
  596. }</screen>
  597. In this example, we allow the server to
  598. dynamically assign all addresses available in the whole subnet. Although
  599. rather wasteful, it is certainly a valid configuration to dedicate the
  600. whole /64 subnet for that purpose. Note that the Kea server does not preallocate
  601. the leases, so there is no danger in using gigantic address pools.
  602. </para>
  603. <para>
  604. When configuring a DHCPv6 server using prefix/length notation, please pay
  605. attention to the boundary values. When specifying that the server can use
  606. a given pool, it will also be able to allocate the first (typically network
  607. address) address from that pool. For example for pool 2001:db8:2::/64 the
  608. 2001:db8:2:: address may be assigned as well. If you want to avoid this,
  609. use the "min-max" notation.
  610. </para>
  611. </section>
  612. <section>
  613. <!-- @todo: add real meat to the prefix delegation config this is just place holder stuff -->
  614. <title>Subnet and Prefix Delegation Pools</title>
  615. <para>
  616. Subnets may also be configured to delegate prefixes, as defined in
  617. <ulink url="http://tools.ietf.org/html/rfc3633">RFC 3633</ulink>.
  618. A subnet may have one or more prefix delegation pools. Each pool has
  619. a prefixed address, which is specified as a prefix and a prefix length,
  620. as well as a delegated prefix length. <command>delegated-len</command>
  621. must not be shorter (that is it must be numerically greater or equal)
  622. than <command>prefix-len</command>.
  623. If both <command>delegated-len</command>
  624. and <command>prefix-len</command> are equal, the server will be able to
  625. delegate only one prefix. The delegated <command>prefix</command> does
  626. not have to match the <command>subnet</command> prefix.
  627. </para>
  628. <para> Below is a sample subnet configuration which enables prefix
  629. delegation for the subnet:
  630. <screen>
  631. "Dhcp6": {
  632. "subnet6": [
  633. {
  634. "subnet": "2001:d8b:1::/64",
  635. <userinput>"pd-pools": [
  636. {
  637. "prefix": "3000:1::",
  638. "prefix-len": 64,
  639. "delegated-len": 96
  640. }
  641. ]</userinput>
  642. }
  643. ],
  644. ...
  645. }</screen>
  646. </para>
  647. </section>
  648. <section id="dhcp6-std-options">
  649. <title>Standard DHCPv6 options</title>
  650. <para>
  651. One of the major features of a DHCPv6 server is to provide configuration
  652. options to clients. Although there are several options that require
  653. special behavior, most options are sent by the server only if the client
  654. explicitly requests them. The following example shows how to
  655. configure DNS servers, which is one of the most frequently used
  656. options. Numbers in the first column are added for easier reference and
  657. will not appear on screen. Options specified in this way are considered
  658. global and apply to all configured subnets.
  659. <screen>
  660. "Dhcp6": {
  661. "option-data": [
  662. {
  663. <userinput>"name": "dns-servers",
  664. "code": 23,
  665. "space": "dhcp6",
  666. "csv-format": true,
  667. "data": "2001:db8::cafe, 2001:db8::babe"</userinput>
  668. },
  669. ...
  670. ]
  671. }
  672. </screen>
  673. </para>
  674. <para>
  675. The <command>option-data></command> line creates a new entry in
  676. the option-data table. This table contains
  677. information on all global options that the server is supposed to configure
  678. in all subnets. The <command>name</command> line specifies the option name.
  679. (For a complete list
  680. of currently supported names, see <xref
  681. linkend="dhcp6-std-options-list"/>.) The next line specifies the option code,
  682. which must match one of the values from that list. The line beginning with
  683. <command>space</command> specifies the option space, which must always be set
  684. to "dhcp6" as these are standard DHCPv6 options. For other name spaces,
  685. including custom option spaces, see <xref
  686. linkend="dhcp6-option-spaces"/>. The next line specifies the format in
  687. which the data will be entered: use of CSV (comma separated values) is
  688. recommended. The <command>data</command> line gives the actual value to be sent to
  689. clients. Data is specified as normal text, with values separated by
  690. commas if more than one value is allowed.
  691. </para>
  692. <para>
  693. Options can also be configured as hexadecimal values. If "csv-format" is
  694. set to false, the option data must be specified as a string of hexadecimal
  695. numbers. The
  696. following commands configure the DNS-SERVERS option for all
  697. subnets with the following addresses: 2001:db8:1::cafe and
  698. 2001:db8:1::babe.
  699. <screen>
  700. "Dhcp6": {
  701. "option-data": [
  702. {
  703. <userinput>"name": "dns-servers",
  704. "code": 23,
  705. "space": "dhcp6",
  706. "csv-format": false,
  707. "data": "2001 0DB8 0001 0000 0000 0000 0000 CAFE
  708. 2001 0DB8 0001 0000 0000 0000 0000 BABE"</userinput>
  709. },
  710. ...
  711. ]
  712. }
  713. </screen>
  714. The value for the setting of the "data" element is split across two
  715. lines in this document for clarity: when entering the command, the
  716. whole string should be entered on the same line. Care should be taken
  717. to use proper encoding when using hexadecimal format as Kea's ability
  718. to validate data correctness in hexadecimal is limited.
  719. </para>
  720. <para>
  721. Most of the parameters in the "option-data" structure are optional and
  722. can be omitted in some circumstances as discussed in the
  723. <xref linkend="dhcp6-option-data-defaults"/>.
  724. </para>
  725. <para>
  726. It is possible to override options on a per-subnet basis. If
  727. clients connected to most of your subnets are expected to get the
  728. same values of a given option, you should use global options: you
  729. can then override specific values for a small number of subnets.
  730. On the other hand, if you use different values in each subnet,
  731. it does not make sense to specify global option values
  732. (Dhcp6/option-data), rather you should set only subnet-specific values
  733. (Dhcp6/subnet[X]/option-data[Y]).
  734. </para>
  735. <para>
  736. The following commands override the global
  737. DNS servers option for a particular subnet, setting a single DNS
  738. server with address 2001:db8:1::3.
  739. <screen>
  740. "Dhcp6": {
  741. "subnet6": [
  742. {
  743. <userinput>"option-data": [
  744. {
  745. "name": "dns-servers",
  746. "code": 23,
  747. "space": "dhcp6",
  748. "csv-format": true,
  749. "data": "2001:db8:1::3"
  750. },
  751. ...
  752. ]</userinput>,
  753. ...
  754. },
  755. ...
  756. ],
  757. ...
  758. }
  759. </screen>
  760. </para>
  761. <para>
  762. The currently supported standard DHCPv6 options are
  763. listed in <xref linkend="dhcp6-std-options-list"/>.
  764. The "Name" and "Code"
  765. are the values that should be used as a name in the option-data
  766. structures. "Type" designates the format of the data: the meanings of
  767. the various types is given in <xref linkend="dhcp-types"/>.
  768. </para>
  769. <para>
  770. Some options are designated as arrays, which means that more than one
  771. value is allowed in such an option. For example the option dns-servers
  772. allows the specification of more than one IPv6 address, allowing
  773. clients to obtain the addresses of multiple DNS servers.
  774. </para>
  775. <!-- @todo: describe record types -->
  776. <para>
  777. The <xref linkend="dhcp6-custom-options"/> describes the configuration
  778. syntax to create custom option definitions (formats). It is generally not
  779. allowed to create custom definitions for standard options, even if the
  780. definition being created matches the actual option format defined in the
  781. RFCs. There is an exception from this rule for standard options for which
  782. Kea does not provide a definition yet. In order to use such options,
  783. a server administrator must create a definition as described in
  784. <xref linkend="dhcp6-custom-options"/> in the 'dhcp6' option space. This
  785. definition should match the option format described in the relevant
  786. RFC but the configuration mechanism would allow any option format as it has
  787. no means to validate the format at the moment.
  788. </para>
  789. <para>
  790. <table frame="all" id="dhcp6-std-options-list">
  791. <title>List of standard DHCPv6 options</title>
  792. <tgroup cols='4'>
  793. <colspec colname='name'/>
  794. <colspec colname='code' align='center'/>
  795. <colspec colname='type' align='center'/>
  796. <colspec colname='array' align='center'/>
  797. <thead>
  798. <row><entry>Name</entry><entry>Code</entry><entry>Type</entry><entry>Array?</entry></row>
  799. </thead>
  800. <tbody>
  801. <!-- Our engine uses those options on its own, admin must not configure them on his own
  802. <row><entry>clientid</entry><entry>1</entry><entry>binary</entry><entry>false</entry></row>
  803. <row><entry>serverid</entry><entry>2</entry><entry>binary</entry><entry>false</entry></row>
  804. <row><entry>ia-na</entry><entry>3</entry><entry>record</entry><entry>false</entry></row>
  805. <row><entry>ia-ta</entry><entry>4</entry><entry>uint32</entry><entry>false</entry></row>
  806. <row><entry>iaaddr</entry><entry>5</entry><entry>record</entry><entry>false</entry></row>
  807. <row><entry>oro</entry><entry>6</entry><entry>uint16</entry><entry>true</entry></row> -->
  808. <row><entry>preference</entry><entry>7</entry><entry>uint8</entry><entry>false</entry></row>
  809. <!-- Our engine uses those options on its own, admin must not configure them on his own
  810. <row><entry>elapsed-time</entry><entry>8</entry><entry>uint16</entry><entry>false</entry></row>
  811. <row><entry>relay-msg</entry><entry>9</entry><entry>binary</entry><entry>false</entry></row>
  812. <row><entry>auth</entry><entry>11</entry><entry>binary</entry><entry>false</entry></row>
  813. <row><entry>unicast</entry><entry>12</entry><entry>ipv6-address</entry><entry>false</entry></row>
  814. <row><entry>status-code</entry><entry>13</entry><entry>record</entry><entry>false</entry></row>
  815. <row><entry>rapid-commit</entry><entry>14</entry><entry>empty</entry><entry>false</entry></row>
  816. <row><entry>user-class</entry><entry>15</entry><entry>binary</entry><entry>false</entry></row>
  817. <row><entry>vendor-class</entry><entry>16</entry><entry>record</entry><entry>false</entry></row>
  818. <row><entry>vendor-opts</entry><entry>17</entry><entry>uint32</entry><entry>false</entry></row>
  819. <row><entry>interface-id</entry><entry>18</entry><entry>binary</entry><entry>false</entry></row>
  820. <row><entry>reconf-msg</entry><entry>19</entry><entry>uint8</entry><entry>false</entry></row>
  821. <row><entry>reconf-accept</entry><entry>20</entry><entry>empty</entry><entry>false</entry></row> -->
  822. <row><entry>sip-server-dns</entry><entry>21</entry><entry>fqdn</entry><entry>true</entry></row>
  823. <row><entry>sip-server-addr</entry><entry>22</entry><entry>ipv6-address</entry><entry>true</entry></row>
  824. <row><entry>dns-servers</entry><entry>23</entry><entry>ipv6-address</entry><entry>true</entry></row>
  825. <row><entry>domain-search</entry><entry>24</entry><entry>fqdn</entry><entry>true</entry></row>
  826. <!-- <row><entry>ia-pd</entry><entry>25</entry><entry>record</entry><entry>false</entry></row> -->
  827. <!-- <row><entry>iaprefix</entry><entry>26</entry><entry>record</entry><entry>false</entry></row> -->
  828. <row><entry>nis-servers</entry><entry>27</entry><entry>ipv6-address</entry><entry>true</entry></row>
  829. <row><entry>nisp-servers</entry><entry>28</entry><entry>ipv6-address</entry><entry>true</entry></row>
  830. <row><entry>nis-domain-name</entry><entry>29</entry><entry>fqdn</entry><entry>true</entry></row>
  831. <row><entry>nisp-domain-name</entry><entry>30</entry><entry>fqdn</entry><entry>true</entry></row>
  832. <row><entry>sntp-servers</entry><entry>31</entry><entry>ipv6-address</entry><entry>true</entry></row>
  833. <row><entry>information-refresh-time</entry><entry>32</entry><entry>uint32</entry><entry>false</entry></row>
  834. <row><entry>bcmcs-server-dns</entry><entry>33</entry><entry>fqdn</entry><entry>true</entry></row>
  835. <row><entry>bcmcs-server-addr</entry><entry>34</entry><entry>ipv6-address</entry><entry>true</entry></row>
  836. <row><entry>geoconf-civic</entry><entry>36</entry><entry>record</entry><entry>false</entry></row>
  837. <row><entry>remote-id</entry><entry>37</entry><entry>record</entry><entry>false</entry></row>
  838. <row><entry>subscriber-id</entry><entry>38</entry><entry>binary</entry><entry>false</entry></row>
  839. <row><entry>client-fqdn</entry><entry>39</entry><entry>record</entry><entry>false</entry></row>
  840. <row><entry>pana-agent</entry><entry>40</entry><entry>ipv6-address</entry><entry>true</entry></row>
  841. <row><entry>new-posix-timezone</entry><entry>41</entry><entry>string</entry><entry>false</entry></row>
  842. <row><entry>new-tzdb-timezone</entry><entry>42</entry><entry>string</entry><entry>false</entry></row>
  843. <row><entry>ero</entry><entry>43</entry><entry>uint16</entry><entry>true</entry></row>
  844. <row><entry>lq-query</entry><entry>44</entry><entry>record</entry><entry>false</entry></row>
  845. <row><entry>client-data</entry><entry>45</entry><entry>empty</entry><entry>false</entry></row>
  846. <row><entry>clt-time</entry><entry>46</entry><entry>uint32</entry><entry>false</entry></row>
  847. <row><entry>lq-relay-data</entry><entry>47</entry><entry>record</entry><entry>false</entry></row>
  848. <row><entry>lq-client-link</entry><entry>48</entry><entry>ipv6-address</entry><entry>true</entry></row>
  849. <row><entry>erp-local-domain-name</entry><entry>65</entry><entry>fqdn</entry><entry>false</entry></row>
  850. <row><entry>rsoo</entry><entry>66</entry><entry>empty</entry><entry>false</entry></row>
  851. <row><entry>client-linklayer-addr</entry><entry>79</entry><entry>binary</entry><entry>false</entry></row>
  852. </tbody>
  853. </tgroup>
  854. </table>
  855. </para>
  856. </section>
  857. <section id="dhcp6-custom-options">
  858. <title>Custom DHCPv6 options</title>
  859. <para>It is also possible to define options other than the standard ones.
  860. Assume that we want to define a new DHCPv6 option called "foo" which will have
  861. code 100 and will convey a single unsigned 32 bit integer value. We can define
  862. such an option by using the following commands:
  863. <screen>
  864. "Dhcp6": {
  865. "option-def": [
  866. {
  867. <userinput>"name": "foo",
  868. "code": 100,
  869. "type": "uint32",
  870. "array": false,
  871. "record-types": "",
  872. "space": "dhcp6",
  873. "encapsulate": ""</userinput>
  874. }, ...
  875. ],
  876. ...
  877. }
  878. </screen>
  879. The "false" value of the "array" parameter determines that the option does
  880. NOT comprise an array of "uint32" values but rather a single value. Two
  881. other parameters have been left blank: "record-types" and "encapsulate".
  882. The former specifies the comma separated list of option data fields if the
  883. option comprises a record of data fields. The "record-fields" value should
  884. be non-empty if the "type" is set to "record". Otherwise it must be left
  885. blank. The latter parameter specifies the name of the option space being
  886. encapsulated by the particular option. If the particular option does not
  887. encapsulate any option space it should be left blank. Note that the above
  888. set of comments define the format of the new option and do not set its
  889. values.
  890. </para>
  891. <para>Once the new option format is defined, its value is set
  892. in the same way as for a standard option. For example the following
  893. commands set a global value that applies to all subnets.
  894. <screen>
  895. "Dhcp6": {
  896. "option-data": [
  897. {
  898. <userinput>"name": "foo",
  899. "code": 100,
  900. "space": "dhcp6",
  901. "csv-format": true,
  902. "data": "12345"</userinput>
  903. }, ...
  904. ],
  905. ...
  906. }
  907. </screen>
  908. </para>
  909. <para>New options can take more complex forms than simple use of
  910. primitives (uint8, string, ipv6-address etc): it is possible to
  911. define an option comprising a number of existing primitives.
  912. </para>
  913. <para>
  914. Assume we want to define a new option that will consist of an IPv6
  915. address, followed by an unsigned 16 bit integer, followed by a
  916. boolean value, followed by a text string. Such an option could
  917. be defined in the following way:
  918. <screen>
  919. "Dhcp6": {
  920. "option-def": [
  921. {
  922. <userinput>"name": "bar",
  923. "code": 101,
  924. "space": "dhcp6",
  925. "type": "record",
  926. "array": false,
  927. "record-types": "ipv4-address, uint16, boolean, string",
  928. "encapsulate": ""</userinput>
  929. }, ...
  930. ],
  931. ...
  932. }
  933. </screen>
  934. The "type" is set to "record" to indicate that the option contains
  935. multiple values of different types. These types are given as a comma-separated
  936. list in the "record-types" field and should be those listed in <xref linkend="dhcp-types"/>.
  937. </para>
  938. <para>
  939. The values of the option are set as follows:
  940. <screen>
  941. "Dhcp6": {
  942. "option-data": [
  943. {
  944. <userinput>"name": "bar",
  945. "space": "dhcp6",
  946. "code": 101,
  947. "csv-format": true,
  948. "data": "2001:db8:1::10, 123, false, Hello World"</userinput>
  949. }
  950. ],
  951. ...
  952. }</screen>
  953. <command>csv-format</command> is set <command>true</command> to indicate
  954. that the <command>data</command> field comprises a command-separated list
  955. of values. The values in the "data" must correspond to the types set in
  956. the "record-types" field of the option definition.
  957. </para>
  958. <note>
  959. <para>In the general case, boolean values are specified as <command>true</command> or
  960. <command>false</command>, without quotes. Some specific boolean parameters may
  961. accept also <command>"true"</command>, <command>"false"</command>,
  962. <command>0</command>, <command>1</command>, <command>"0"</command> and
  963. <command>"1"</command>. Future Kea versions will accept all those values
  964. for all boolean parameters.</para>
  965. </note>
  966. </section>
  967. <section id="dhcp6-vendor-opts">
  968. <title>DHCPv6 vendor specific options</title>
  969. <para>
  970. Currently there are three option spaces defined: dhcp4 (to be used
  971. in DHCPv4 daemon) and dhcp6 (for the DHCPv6 daemon); there is also
  972. vendor-opts-space, which is empty by default, but options can be
  973. defined in it. Those options are called vendor-specific information
  974. options. The following examples show how to define an option "foo"
  975. with code 1 that consists of an IPv6 address, an unsigned 16 bit integer
  976. and a string. The "foo" option is conveyed in a vendor specific
  977. information option. This option comprises a single uint32 value
  978. that is set to "12345". The sub-option "foo" follows the data
  979. field holding this value.
  980. <screen>
  981. "Dhcp6": {
  982. "option-def": [
  983. {
  984. <userinput>"name": "foo",
  985. "code": 1,
  986. "space": "vendor-encapsulated-options-space",
  987. "type": "record",
  988. "array": false,
  989. "record-types": "ipv6-address, uint16, string",
  990. "encapsulates": ""</userinput>
  991. }
  992. ],
  993. ...
  994. }</screen>
  995. (Note that the option space is set to <command>vendor-opts-space</command>.)
  996. Once the option format is defined, the next step is to define actual values
  997. for that option:
  998. <screen>
  999. "Dhcp6": {
  1000. "option-data": [
  1001. {
  1002. <userinput>"name": "foo",
  1003. "space": "vendor-encapsulated-options-space",
  1004. "code": 1,
  1005. "csv-format": true,
  1006. "data": "2001:db8:1::10, 123, Hello World"</userinput>
  1007. },
  1008. ...
  1009. ],
  1010. ...
  1011. }</screen>
  1012. We should also define values for the vendor-opts, that will convey our
  1013. option foo.
  1014. <screen>
  1015. "Dhcp6": {
  1016. "option-data": [
  1017. ...,
  1018. {
  1019. <userinput>"name": "vendor-encapsulated-options",
  1020. "space": "dhcp6",
  1021. "code": 17,
  1022. "csv-format": true,
  1023. "data": "12345"</userinput>
  1024. }
  1025. ],
  1026. ...
  1027. }</screen>
  1028. </para>
  1029. </section>
  1030. <section id="dhcp6-option-spaces">
  1031. <title>Nested DHCPv6 options (custom option spaces)</title>
  1032. <para>It is sometimes useful to define completely new option
  1033. spaces. This is useful if the user wants his new option to
  1034. convey sub-options that use a separate numbering scheme, for
  1035. example sub-options with codes 1 and 2. Those option codes
  1036. conflict with standard DHCPv6 options, so a separate option
  1037. space must be defined.
  1038. </para>
  1039. <para>Note that it is not required to create a new option space when
  1040. defining sub-options for a standard option because it is
  1041. created by default if the standard option is meant to convey
  1042. any sub-options (see <xref linkend="dhcp6-vendor-opts"/>).
  1043. </para>
  1044. <para>
  1045. Assume that we want to have a DHCPv6 option called "container"
  1046. with code 102 that conveys two sub-options with codes 1 and 2.
  1047. First we need to define the new sub-options:
  1048. <screen>
  1049. "Dhcp6": {
  1050. "option-def": [
  1051. {
  1052. <userinput>"name": "subopt1",
  1053. "code": 1,
  1054. "space": "isc",
  1055. "type": "ipv6-address",
  1056. "record-types": "",
  1057. "array": false,
  1058. "encapsulate": ""</userinput>
  1059. },
  1060. {
  1061. <userinput>"name": "subopt2",
  1062. "code": 2,
  1063. "space": "isc",
  1064. "type": "string",
  1065. "record-types": "",
  1066. "array": false
  1067. "encapsulate": ""</userinput>
  1068. }
  1069. ],
  1070. ...
  1071. }</screen>
  1072. Note that we have defined the options to belong to a new option space
  1073. (in this case, "isc").
  1074. </para>
  1075. <para>
  1076. The next step is to define a regular DHCPv6 option and specify that it
  1077. should include options from the isc option space:
  1078. <screen>
  1079. "Dhcp6": {
  1080. "option-def": [
  1081. ...,
  1082. {
  1083. <userinput>"name": "container",
  1084. "code": 102,
  1085. "space": "dhcp6",
  1086. "type": "empty",
  1087. "array": false,
  1088. "record-types": "",
  1089. "encapsulate": "isc"</userinput>
  1090. }
  1091. ],
  1092. ...
  1093. }</screen>
  1094. The name of the option space in which the sub-options are defined is set in
  1095. the <command>encapsulate</command> field. The <command>type</command> field
  1096. is set to <command>empty</command> which limits this option to only carrying
  1097. data in sub-options.
  1098. </para>
  1099. <para>
  1100. Finally, we can set values for the new options:
  1101. <screen>
  1102. "Dhcp6": {
  1103. "option-data": [
  1104. {
  1105. <userinput>"name": "subopt1",
  1106. "space": "isc",
  1107. "code": 1,
  1108. "csv-format": true,
  1109. "data": "2001:db8::abcd"</userinput>
  1110. },
  1111. }
  1112. <userinput>"name": "subopt2",
  1113. "space": "isc",
  1114. "code": 2,
  1115. "csv-format": true,
  1116. "data": "Hello world"</userinput>
  1117. },
  1118. {
  1119. <userinput>"name": "container",
  1120. "space": "dhcp6",
  1121. "code": 102,
  1122. "csv-format": true,
  1123. "data": ""</userinput>
  1124. }
  1125. ],
  1126. ...
  1127. }
  1128. </screen>
  1129. Even though the "container" option does not carry any data except
  1130. sub-options, the "data" field must be explicitly set to an empty value.
  1131. This is required because in the current version of Kea, the default
  1132. configuration values are not propagated to the configuration parsers: if the
  1133. "data" is not set the parser will assume that this parameter is not
  1134. specified and an error will be reported.
  1135. </para>
  1136. <para>Note that it is possible to create an option which carries some data
  1137. in addition to the sub-options defined in the encapsulated option space.
  1138. For example, if the "container" option from the previous example was
  1139. required to carry an uint16 value as well as the sub-options, the "type"
  1140. value would have to be set to "uint16" in the option definition. (Such an
  1141. option would then have the following data structure: DHCP header, uint16
  1142. value, sub-options.) The value specified with the "data" parameter &mdash; which
  1143. should be a valid integer enclosed in quotes, e.g. "123" &mdash; would then be
  1144. assigned to the uint16 field in the "container" option.
  1145. </para>
  1146. </section>
  1147. <section id="dhcp6-option-data-defaults">
  1148. <title>Unspecified parameters for DHCPv6 option configuration</title>
  1149. <para>In many cases it is not required to specify all parameters for
  1150. an option configuration and the default values can be used. However, it is
  1151. important to understand the implications of not specifing some of them
  1152. as it may result in configuration errors. The list below explains
  1153. the behavior of the server when a particular parameter is not explicitly
  1154. specified:
  1155. <itemizedlist>
  1156. <listitem>
  1157. <simpara><command>name</command> - the server requires an option name or
  1158. option code to identify an option. If this parameter is unspecified, the
  1159. option code must be specified.
  1160. </simpara>
  1161. </listitem>
  1162. <listitem>
  1163. <simpara><command>code</command> - the server requires an option name or
  1164. option code to identify an option. This parameter may be left unspecified if
  1165. the <command>name</command> parameter is specified. However, this also
  1166. requires that the particular option has its definition (it is either a
  1167. standard option or an administrator created a definition for the option
  1168. using an 'option-def' structure), as the option definition associates an
  1169. option with a particular name. It is possible to configure an option
  1170. for which there is no definition (unspecified option format).
  1171. Configuration of such options requires the use of option code.
  1172. </simpara>
  1173. </listitem>
  1174. <listitem>
  1175. <simpara><command>space</command> - if the option space is unspecified it
  1176. will default to 'dhcp6' which is an option space holding DHCPv6 standard
  1177. options.
  1178. </simpara>
  1179. </listitem>
  1180. <listitem>
  1181. <simpara><command>data</command> - if the option data is unspecified it
  1182. defaults to an empty value. The empty value is mostly used for the
  1183. options which have no payload (boolean options), but it is legal to specify
  1184. empty values for some options which carry variable length data and which
  1185. spec allows for the length of 0. For such options, the data parameter
  1186. may be omitted in the configuration.</simpara>
  1187. </listitem>
  1188. <listitem>
  1189. <simpara><command>csv-format</command> - if this value is not specified
  1190. and the definition for the particular option exists, the server will assume
  1191. that the option data is specified as a list of comma separated values to be
  1192. assigned to individual fields of the DHCP option. If the definition
  1193. does not exist for this option, the server will assume that the data
  1194. parameter contains the option payload in the binary format (represented
  1195. as a string of hexadecimal digits). Note that not specifying this
  1196. parameter doesn't imply that it defaults to a fixed value, but
  1197. the configuration data interpretation also depends on the presence
  1198. of the option definition. An administrator must be aware if the
  1199. definition for the particular option exists when this parameter
  1200. is not specified. It is generally recommended to not specify this
  1201. parameter only for the options for which the definition exists, e.g.
  1202. standard options. Setting <command>csv-format</command> to an explicit
  1203. value will cause the server to strictly check the format of the option
  1204. data specified.
  1205. </simpara>
  1206. </listitem>
  1207. </itemizedlist>
  1208. </para>
  1209. </section>
  1210. <section id="dhcp6-config-subnets">
  1211. <title>IPv6 Subnet Selection</title>
  1212. <para>
  1213. The DHCPv6 server may receive requests from local (connected to the
  1214. same subnet as the server) and remote (connecting via relays) clients.
  1215. As the server may have many subnet configurations defined, it must select
  1216. an appropriate subnet for a given request.
  1217. </para>
  1218. <para>
  1219. The server can not assume which of the configured subnets are local. In IPv4
  1220. it is possible as there is a reasonable expectation that the
  1221. server will have a (global) IPv4 address configured on the interface,
  1222. and can use that information to detect whether a subnet is local or
  1223. not. That assumption is not true in IPv6, the DHCPv6 server must be able
  1224. to operate while only having link-local addresses. Therefore an optional
  1225. &quot;interface&quot; parameter is available within a subnet definition
  1226. to designate that a given subnet is local, i.e. reachable directly over
  1227. the specified interface. For example the server that is intended to serve
  1228. a local subnet over eth0 may be configured as follows:
  1229. <screen>
  1230. "Dhcp6": {
  1231. "subnet6": [
  1232. {
  1233. "subnet": "2001:db8:beef::/48",
  1234. "pools": [
  1235. {
  1236. "pool": "2001:db8:beef::/48"
  1237. }
  1238. ],
  1239. <userinput>"interface": "eth0"</userinput>
  1240. }
  1241. ],
  1242. ...
  1243. }
  1244. </screen>
  1245. </para>
  1246. </section>
  1247. <section id="dhcp6-relays">
  1248. <title>DHCPv6 Relays</title>
  1249. <para>
  1250. A DHCPv6 server with multiple subnets defined must select the
  1251. appropriate subnet when it receives a request from a client. For clients
  1252. connected via relays, two mechanisms are used:
  1253. </para>
  1254. <para>
  1255. The first uses the linkaddr field in the RELAY_FORW message. The name
  1256. of this field is somewhat misleading in that it does not contain a link-layer
  1257. address: instead, it holds an address (typically a global address) that is
  1258. used to identify a link. The DHCPv6 server checks if the address belongs
  1259. to a defined subnet and, if it does, that subnet is selected for the client's
  1260. request.
  1261. </para>
  1262. <para>
  1263. The second mechanism is based on interface-id options. While forwarding a client's
  1264. message, relays may insert an interface-id option into the message that
  1265. identifies the interface on the relay that received the message. (Some
  1266. relays allow configuration of that parameter, but it is sometimes
  1267. hardcoded and may range from the very simple (e.g. "vlan100") to the very cryptic:
  1268. one example seen on real hardware was "ISAM144|299|ipv6|nt:vp:1:110"). The
  1269. server can use this information to select the appropriate subnet.
  1270. The information is also returned to the relay which then knows the
  1271. interface to use to transmit the response to the client. In order for
  1272. this to work successfully, the relay interface IDs must be unique within
  1273. the network and the server configuration must match those values.
  1274. </para>
  1275. <para>
  1276. When configuring the DHCPv6 server, it should be noted that two
  1277. similarly-named parameters can be configured for a subnet:
  1278. <itemizedlist>
  1279. <listitem><simpara>
  1280. "interface" defines which local network interface can be used
  1281. to access a given subnet.
  1282. </simpara></listitem>
  1283. <listitem><simpara>
  1284. "interface-id" specifies the content of the interface-id option
  1285. used by relays to identify the interface on the relay to which
  1286. the response packet is sent.
  1287. </simpara></listitem>
  1288. </itemizedlist>
  1289. The two are mutually exclusive: a subnet cannot be both reachable locally
  1290. (direct traffic) and via relays (remote traffic). Specifying both is a
  1291. configuration error and the DHCPv6 server will refuse such a configuration.
  1292. </para>
  1293. <para>
  1294. To specify interface-id with value "vlan123", the following commands can
  1295. be used:
  1296. <screen>
  1297. "Dhcp6": {
  1298. "subnet6": [
  1299. {
  1300. "subnet": "2001:db8:beef::/48",
  1301. "pools": [
  1302. {
  1303. "pool": "2001:db8:beef::/48"
  1304. }
  1305. ],
  1306. <userinput>"interface-id": "vlan123"</userinput>
  1307. }
  1308. ],
  1309. ...
  1310. }
  1311. </screen>
  1312. </para>
  1313. </section>
  1314. <section id="dhcp6-rsoo">
  1315. <title>Relay-Supplied Options</title>
  1316. <para><ulink url="http://tools.ietf.org/html/rfc6422">RFC 6422</ulink>
  1317. defines a mechanism called Relay-Supplied DHCP Options. In certain cases relay
  1318. agents are the only entities that may have specific information. They can
  1319. insert options when relaying messages from the client to the server. The
  1320. server will then do certain checks and copy those options to the response
  1321. that will be sent to the client.</para>
  1322. <para>There are certain conditions that must be met for the option to be
  1323. included. First, the server must not provide the option by itself. In
  1324. other words, if both relay and server provide an option, the server always
  1325. takes precedence. Second, the option must be RSOO-enabled. IANA mantains a
  1326. list of RSOO-enabled options <ulink url="http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml#options-relay-supplied">here</ulink>.
  1327. However, there may be cases when system administrators want to echo other
  1328. options. Kea can be instructed to treat other options as RSOO-enabled.
  1329. For example, to mark options 110, 120 and 130 as RSOO-enabled, the following
  1330. syntax should be used:
  1331. <screen>
  1332. "Dhcp6": {
  1333. <userinput>"relay-supplied-options": [ "110", "120", "130" ],</userinput>
  1334. ...
  1335. }
  1336. </screen>
  1337. </para>
  1338. <para>As of March 2015, only option 65 is RSOO-enabled by IANA. This
  1339. option will always be treated as such and there's no need to explicitly
  1340. mark it. Also, when enabling standard options, it is possible to use their
  1341. names, rather than option code, e.g. (e.g. use
  1342. <command>dns-servers</command> instead of <command>23</command>). See
  1343. <xref linkend="dhcp6-std-options-list" /> for the names. In certain cases
  1344. it could also work for custom options, but due to the nature of the parser
  1345. code this may be unreliable and should be avoided.
  1346. </para>
  1347. </section>
  1348. <section id="dhcp6-client-classifier">
  1349. <title>Client Classification in DHCPv6</title>
  1350. <note>
  1351. <para>
  1352. DHCPv6 server has been extended to support limited client classification.
  1353. Although the current capability is modest, it is expected to be expanded
  1354. in the future. It is envisaged that the majority of client classification
  1355. extensions will be using hooks extensions.
  1356. </para>
  1357. </note>
  1358. <para>In certain cases it is useful to differentiate between different types
  1359. of clients and treat them differently. The process of doing classification
  1360. is conducted in two steps. The first step is to assess an incoming packet and
  1361. assign it to zero or more classes. This classification is currently simple,
  1362. but is expected to grow in capability soon. Currently the server checks whether
  1363. the incoming packet includes vendor class option (16). If it has, the content
  1364. of that option is prepended with &quot;VENDOR_CLASS_&quot; then it is interpreted as a
  1365. class. For example, modern cable modems will send this option with value
  1366. &quot;docsis3.0&quot; and as a result the packet will belong to class
  1367. &quot;VENDOR_CLASS_docsis3.0&quot;.
  1368. </para>
  1369. <para>It is envisaged that the client classification will be used for changing
  1370. behavior of almost any part of the DHCP engine processing, including assigning
  1371. leases from different pools, assigning different option (or different values of
  1372. the same options) etc. For now, there is only one mechanism that is taking
  1373. advantage of client classification: subnet selection.</para>
  1374. <para>
  1375. Kea can be instructed to limit access to given subnets based on class information.
  1376. This is particularly useful for cases where two types of devices share the
  1377. same link and are expected to be served from two different subnets. The
  1378. primary use case for such a scenario are cable networks. There are two
  1379. classes of devices: the cable modem itself, which should be handed a lease
  1380. from subnet A and all other devices behind modems that should get a lease
  1381. from subnet B. That segregation is essential to prevent overly curious
  1382. users from playing with their cable modems. For details on how to set up
  1383. class restrictions on subnets, see <xref linkend="dhcp6-subnet-class"/>.
  1384. </para>
  1385. </section>
  1386. <section id="dhcp6-subnet-class">
  1387. <title>Limiting access to IPv6 subnet to certain classes</title>
  1388. <para>
  1389. In certain cases it beneficial to restrict access to certain subnets
  1390. only to clients that belong to a given class. For details on client
  1391. classes, see <xref linkend="dhcp6-client-classifier"/>. This is an
  1392. extension of a previous example from <xref linkend="dhcp6-address-config"/>.
  1393. Let's assume that the server is connected to a network segment that uses
  1394. the 2001:db8:1::/64 prefix. The Administrator of that network has
  1395. decided that addresses from range 2001:db8:1::1 to 2001:db8:1::ffff are
  1396. going to be managed by the Dhcp6 server. Only clients belonging to the
  1397. eRouter1.0 client class are allowed to use that pool. Such a
  1398. configuration can be achieved in the following way:
  1399. <screen>
  1400. "Dhcp6": {
  1401. "subnet6": [
  1402. {
  1403. "subnet": "2001:db8:1::/64",
  1404. "pools": [
  1405. {
  1406. "pool": "2001:db8:1::-2001:db8:1::ffff"
  1407. }
  1408. ],
  1409. <userinput>"client-class": "VENDOR_CLASS_eRouter1.0"</userinput>
  1410. }
  1411. ],
  1412. ...
  1413. }
  1414. </screen>
  1415. </para>
  1416. <para>
  1417. Care should be taken with client classification as it is easy for
  1418. clients that do not meet class criteria to be denied any service altogether.
  1419. </para>
  1420. </section>
  1421. <section id="dhcp6-ddns-config">
  1422. <title>Configuring DHCPv6 for DDNS</title>
  1423. <para>
  1424. As mentioned earlier, kea-dhcp6 can be configured to generate requests to
  1425. the DHCP-DDNS server (referred to here as "D2") to update
  1426. DNS entries. These requests are known as NameChangeRequests or NCRs.
  1427. Each NCR contains the following information:
  1428. <orderedlist>
  1429. <listitem><para>
  1430. Whether it is a request to add (update) or remove DNS entries
  1431. </para></listitem>
  1432. <listitem><para>
  1433. Whether the change requests forward DNS updates (AAAA records), reverse
  1434. DNS updates (PTR records), or both.
  1435. </para></listitem>
  1436. <listitem><para>
  1437. The FQDN, lease address, and DHCID
  1438. </para></listitem>
  1439. </orderedlist>
  1440. The parameters controlling the generation of NCRs for submission to D2
  1441. are contained in the "dhcp-ddns" section of kea-dhcp6
  1442. configuration. The mandatory parameters for the DHCP DDNS configuration
  1443. are <command>enable-updates</command> which is unconditionally
  1444. required, and <command>qualifying-suffix</command> which has no
  1445. default value and is required when <command>enable-updates</command>
  1446. is set to <command>true</command>.
  1447. The two (disabled and enabled) minimal DHCP DDNS configurations are:
  1448. <screen>
  1449. "Dhcp6": {
  1450. "dhcp-ddns": {
  1451. <userinput>"enable-updates": false</userinput>
  1452. },
  1453. ...
  1454. }
  1455. </screen>
  1456. and for example:
  1457. <screen>
  1458. "Dhcp6": {
  1459. "dhcp-ddns": {
  1460. <userinput>"enable-updates": true,
  1461. "qualifying-suffix": "example."</userinput>
  1462. },
  1463. ...
  1464. }
  1465. </screen>
  1466. The default values for the "dhcp-ddns" section are as follows:
  1467. <itemizedlist>
  1468. <listitem><simpara>
  1469. <command>"server-ip": "127.0.0.1"</command>
  1470. </simpara></listitem>
  1471. <listitem><simpara>
  1472. <command>"server-port": 53001</command>
  1473. </simpara></listitem>
  1474. <listitem><simpara>
  1475. <command>"sender-ip": ""</command>
  1476. </simpara></listitem>
  1477. <listitem><simpara>
  1478. <command>"sender-port": 0</command>
  1479. </simpara></listitem>
  1480. <listitem><simpara>
  1481. <command>"max-queue-size": 1024</command>
  1482. </simpara></listitem>
  1483. <listitem><simpara>
  1484. <command>"ncr-protocol": "UDP"</command>
  1485. </simpara></listitem>
  1486. <listitem><simpara>
  1487. <command>"ncr-format": "JSON"</command>
  1488. </simpara></listitem>
  1489. <listitem><simpara>
  1490. <command>"override-no-update": false</command>
  1491. </simpara></listitem>
  1492. <listitem><simpara>
  1493. <command>"override-client-update": false</command>
  1494. </simpara></listitem>
  1495. <listitem><simpara>
  1496. <command>"replace-client-name": false</command>
  1497. </simpara></listitem>
  1498. <listitem><simpara>
  1499. <command>"generated-prefix": "myhost"</command>
  1500. </simpara></listitem>
  1501. </itemizedlist>
  1502. </para>
  1503. <section id="dhcpv6-d2-io-config">
  1504. <title>DHCP-DDNS Server Connectivity</title>
  1505. <para>
  1506. In order for NCRs to reach the D2 server, kea-dhcp6 must be able
  1507. to communicate with it. kea-dhcp6 uses the following configuration
  1508. parameters to control how it communications with D2:
  1509. <itemizedlist>
  1510. <listitem><simpara>
  1511. <command>enable-updates</command> - determines whether or not kea-dhcp6 will
  1512. generate NCRs. If missing, this value is assumed to be false hence DDNS updates
  1513. are disabled. To enable DDNS updates set this value to true:
  1514. </simpara></listitem>
  1515. <listitem><simpara>
  1516. <command>server-ip</command> - IP address on which D2 listens for requests. The default is
  1517. the local loopback interface at address 127.0.0.1. You may specify
  1518. either an IPv4 or IPv6 address.
  1519. </simpara></listitem>
  1520. <listitem><simpara>
  1521. <command>server-port</command> - port on which D2 listens for requests. The default value
  1522. is 53001.
  1523. </simpara></listitem>
  1524. <listitem><simpara>
  1525. <command>sender-ip</command> - IP address which kea-dhcp6 should use to send requests to D2.
  1526. The default value is blank which instructs kea-dhcp6 to select a suitable
  1527. address.
  1528. </simpara></listitem>
  1529. <listitem><simpara>
  1530. <command>sender-port</command> - port which kea-dhcp6 should use to send requests to D2. The
  1531. default value of 0 instructs kea-dhcp6 to select a suitable port.
  1532. </simpara></listitem>
  1533. <listitem><simpara>
  1534. <command>max-queue-size</command> - maximum number of requests allowed to queue waiting to
  1535. be sent to D2. This value guards against requests accumulating
  1536. uncontrollably if they are being generated faster than they can be
  1537. delivered. If the number of requests queued for transmission reaches
  1538. this value, DDNS updating will be turned off until the queue backlog has
  1539. been sufficiently reduced. The intent is to allow kea-dhcp6 to
  1540. continue lease operations. The default value is 1024.
  1541. </simpara></listitem>
  1542. <listitem><simpara>
  1543. <command>ncr-format</command> - Socket protocol use when sending requests to D2. Currently
  1544. only UDP is supported. TCP may be available in an upcoming release.
  1545. </simpara></listitem>
  1546. <listitem><simpara>
  1547. <command>ncr-protocol</command> - Packet format to use when sending requests to D2.
  1548. Currently only JSON format is supported. Other formats may be available
  1549. in future releases.
  1550. </simpara></listitem>
  1551. </itemizedlist>
  1552. By default, kea-dhcp-ddns is assumed to running on the same machine as kea-dhcp6, and
  1553. all of the default values mentioned above should be sufficient.
  1554. If, however, D2 has been configured to listen on a different address or
  1555. port, these values must altered accordingly. For example, if D2 has been
  1556. configured to listen on 2001:db8::5 port 900, the following commands
  1557. would be required:
  1558. <screen>
  1559. "Dhcp6": {
  1560. "dhcp-ddns": {
  1561. <userinput>"server-ip": "2001:db8::5",
  1562. "server-port": 900</userinput>,
  1563. ...
  1564. },
  1565. ...
  1566. }
  1567. </screen>
  1568. </para>
  1569. </section>
  1570. <section id="dhcpv6-d2-rules-config">
  1571. <title>When does kea-dhcp6 generate DDNS request</title>
  1572. <para>kea-dhcp6 follows the behavior prescribed for DHCP servers in
  1573. <ulink url="http://tools.ietf.org/html/rfc4704">RFC 4704</ulink>.
  1574. It is important to keep in mind that kea-dhcp6 provides the initial
  1575. decision making of when and what to update and forwards that
  1576. information to D2 in the form of NCRs. Carrying out the actual
  1577. DNS updates and dealing with such things as conflict resolution
  1578. are the purview of D2 (<xref linkend="dhcp-ddns-server"/>).</para>
  1579. <para>
  1580. This section describes when kea-dhcp6 will generate NCRs and the
  1581. configuration parameters that can be used to influence this decision.
  1582. It assumes that the "enable-updates" parameter is true.
  1583. </para>
  1584. <note>
  1585. <para>
  1586. Currently the interface between kea-dhcp6 and D2 only supports requests
  1587. which update DNS entries for a single IP address. If a lease grants
  1588. more than one address, kea-dhcp6 will create the DDNS update request for
  1589. only the first of these addresses. Support for multiple address
  1590. mappings may be provided in a future release.
  1591. </para>
  1592. </note>
  1593. <para>
  1594. In general, kea-dhcp6 will generate DDNS update requests when:
  1595. <orderedlist>
  1596. <listitem><para>
  1597. A new lease is granted in response to a DHCP REQUEST
  1598. </para></listitem>
  1599. <listitem><para>
  1600. An existing lease is renewed but the FQDN associated with it has
  1601. changed.
  1602. </para></listitem>
  1603. <listitem><para>
  1604. An existing lease is released in response to a DHCP RELEASE
  1605. </para></listitem>
  1606. </orderedlist>
  1607. In the second case, lease renewal, two DDNS requests will be issued: one
  1608. request to remove entries for the previous FQDN and a second request to
  1609. add entries for the new FQDN. In the last case, a lease release, a
  1610. single DDNS request to remove its entries will be made. The decision
  1611. making involved when granting a new lease is more involved and is
  1612. discussed next.
  1613. </para>
  1614. <para>
  1615. kea-dhcp6 will generate a DDNS update request only if the DHCP REQUEST
  1616. contains the FQDN option (code 39). By default kea-dhcp6 will
  1617. respect the FQDN N and S flags specified by the client as shown in the
  1618. following table:
  1619. </para>
  1620. <table id="dhcp6-fqdn-flag-table">
  1621. <title>Default FQDN Flag Behavior</title>
  1622. <tgroup cols='4' align='left'>
  1623. <colspec colname='cflags'/>
  1624. <colspec colname='meaning'/>
  1625. <colspec colname='response'/>
  1626. <colspec colname='sflags'/>
  1627. <thead>
  1628. <row>
  1629. <entry>Client Flags:N-S</entry>
  1630. <entry>Client Intent</entry>
  1631. <entry>Server Response</entry>
  1632. <entry>Server Flags:N-S-O</entry>
  1633. </row>
  1634. </thead>
  1635. <tbody>
  1636. <row>
  1637. <entry>0-0</entry>
  1638. <entry>
  1639. Client wants to do forward updates, server should do reverse updates
  1640. </entry>
  1641. <entry>Server generates reverse-only request</entry>
  1642. <entry>1-0-0</entry>
  1643. </row>
  1644. <row>
  1645. <entry>0-1</entry>
  1646. <entry>Server should do both forward and reverse updates</entry>
  1647. <entry>Server generates request to update both directions</entry>
  1648. <entry>0-1-0</entry>
  1649. </row>
  1650. <row>
  1651. <entry>1-0</entry>
  1652. <entry>Client wants no updates done</entry>
  1653. <entry>Server does not generate a request</entry>
  1654. <entry>1-0-0</entry>
  1655. </row>
  1656. </tbody>
  1657. </tgroup>
  1658. </table>
  1659. <para>
  1660. The first row in the table above represents "client delegation". Here
  1661. the DHCP client states that it intends to do the forward DNS updates and
  1662. the server should do the reverse updates. By default, kea-dhcp6 will honor
  1663. the client's wishes and generate a DDNS request to D2 to update only
  1664. reverse DNS data. The parameter, "override-client-update", can be used
  1665. to instruct the server to override client delegation requests. When
  1666. this parameter is true, kea-dhcp6 will disregard requests for client
  1667. delegation and generate a DDNS request to update both forward and
  1668. reverse DNS data. In this case, the N-S-O flags in the server's
  1669. response to the client will be 0-1-1 respectively.
  1670. </para>
  1671. <para>
  1672. (Note that the flag combination N=1, S=1 is prohibited according to
  1673. RFC 4702. If such a combination is received from the client, the packet
  1674. will be dropped by kea-dhcp6.)
  1675. </para>
  1676. <para>
  1677. To override client delegation, issue the following commands:
  1678. </para>
  1679. <screen>
  1680. "Dhcp6": {
  1681. "dhcp-ddns": {
  1682. <userinput>"override-client-update": true</userinput>,
  1683. ...
  1684. },
  1685. ...
  1686. }
  1687. </screen>
  1688. <para>
  1689. The third row in the table above describes the case in which the client
  1690. requests that no DNS updates be done. The parameter, "override-no-update",
  1691. can be used to instruct the server to disregard the client's wishes. When
  1692. this parameter is true, kea-dhcp6 will generate DDNS update requests to
  1693. kea-dhcp-ddns even if the client requests no updates be done. The N-S-O
  1694. flags in the server's response to the client will be 0-1-1.
  1695. </para>
  1696. <para>
  1697. To override client delegation, issue the following commands:
  1698. </para>
  1699. <screen>
  1700. "Dhcp6": {
  1701. "dhcp-ddns": {
  1702. <userinput>"override-no-update": true</userinput>,
  1703. ...
  1704. },
  1705. ...
  1706. }
  1707. </screen>
  1708. </section>
  1709. <section id="dhcpv6-fqdn-name-generation">
  1710. <title>kea-dhcp6 name generation for DDNS update requests</title>
  1711. <para>Each NameChangeRequest must of course include the fully qualified domain
  1712. name whose DNS entries are to be affected. kea-dhcp6 can be configured to
  1713. supply a portion or all of that name based upon what it receives from
  1714. the client in the DHCP REQUEST.</para>
  1715. <para>The rules for determining the FQDN option are as follows:
  1716. <orderedlist>
  1717. <listitem><para>
  1718. If configured to do so ignore the REQUEST contents and generate a
  1719. FQDN using a configurable prefix and suffix.
  1720. </para></listitem>
  1721. <listitem><para>
  1722. Otherwise, using the domain name value from the client FQDN option as
  1723. the candidate name:
  1724. <orderedlist>
  1725. <listitem><para>
  1726. If the candidate name is a fully qualified domain name then use it.
  1727. </para></listitem>
  1728. <listitem><para>
  1729. If the candidate name is a partial (i.e. unqualified) name then
  1730. add a configurable suffix to the name and use the result as the FQDN.
  1731. </para></listitem>
  1732. <listitem><para>
  1733. If the candidate name is a empty then generate a FQDN using a
  1734. configurable prefix and suffix.
  1735. </para></listitem>
  1736. </orderedlist>
  1737. </para></listitem>
  1738. </orderedlist>
  1739. To instruct kea-dhcp6 to always generate a FQDN, set the parameter
  1740. "replace-client-name" to true:
  1741. </para>
  1742. <screen>
  1743. "Dhcp6": {
  1744. "dhcp-ddns": {
  1745. <userinput>"replace-client-name": true</userinput>,
  1746. ...
  1747. },
  1748. ...
  1749. }
  1750. </screen>
  1751. <para>
  1752. The prefix used when generating a FQDN is specified by the
  1753. "generated-prefix" parameter. The default value is "myhost". To alter
  1754. its value, simply set it to the desired string:
  1755. </para>
  1756. <screen>
  1757. "Dhcp6": {
  1758. "dhcp-ddns": {
  1759. <userinput>"generated-prefix": "another.host"</userinput>,
  1760. ...
  1761. },
  1762. ...
  1763. }
  1764. </screen>
  1765. <para>
  1766. The suffix used when generating a FQDN or when qualifying a
  1767. partial name is specified by
  1768. the <command>qualifying-suffix</command> parameter. This
  1769. parameter has no default value, thus it is mandatory when
  1770. DDNS updates are enabled.
  1771. To set its value simply set it to the desired string:
  1772. </para>
  1773. <screen>
  1774. "Dhcp6": {
  1775. "dhcp-ddns": {
  1776. <userinput>"qualifying-suffix": "foo.example.org"</userinput>,
  1777. ...
  1778. },
  1779. ...
  1780. }
  1781. </screen>
  1782. </section>
  1783. <para>
  1784. When qualifying a partial name, kea-dhcp6 will construct a name with the
  1785. format:
  1786. </para>
  1787. <para>
  1788. [candidate-name].[qualifying-suffix].
  1789. </para>
  1790. <para>
  1791. where candidate-name is the partial name supplied in the REQUEST.
  1792. For example, if FQDN domain name value was "some-computer" and
  1793. qualifying-suffix "example.com", the generated FQDN would be:
  1794. </para>
  1795. <para>
  1796. some-computer.example.com.
  1797. </para>
  1798. <para>
  1799. When generating the entire name, kea-dhcp6 will construct name of the
  1800. format:
  1801. </para>
  1802. <para>
  1803. [generated-prefix]-[address-text].[qualifying-suffix].
  1804. </para>
  1805. <para>
  1806. where address-text is simply the lease IP address converted to a
  1807. hyphenated string. For example, if lease address is 3001:1::70E,
  1808. the qualifying suffix "example.com", and the default value is used for
  1809. <command>generated-prefix</command>, the generated FQDN would be:
  1810. </para>
  1811. <para>
  1812. myhost-3001-1--70E.example.com.
  1813. </para>
  1814. </section>
  1815. </section>
  1816. <!-- Host reservation is a large topic. There will be many subsections,
  1817. so it should be a section on its own. -->
  1818. <section id="host-reservation-v6">
  1819. <title>Host reservation in DHCPv6</title>
  1820. <para>There are many cases where it is useful to provide a configuration on
  1821. a per host basis. The most obvious one is to reserve specific, static IPv6
  1822. address or/and prefix for exclusive use by a given client (host) &dash; returning
  1823. client will get the same address or/and prefix every time and other clients will
  1824. never get that address. Note that there may be cases when the
  1825. new reservation has been made for the client for the address or prefix being
  1826. currently in use by another client. We call this situation a "conflict". The
  1827. conflicts get resolved automatically over time as described in the subsequent
  1828. sections. Once conflict is resolved, the client will keep receiving the reserved
  1829. configuration when it renews.</para>
  1830. <para>Another example when the host reservations are applicable is when a host
  1831. that has specific requirements, e.g. a printer that needs additional DHCP options
  1832. or a cable modem needs specific parameters. Yet another possible use case for
  1833. host reservation is to define unique names for hosts. Although not all of
  1834. the presented use cases are are implemented yet, Kea software will support them
  1835. in the near future.</para>
  1836. <para>Hosts reservations are defined as parameters for each subnet. Each host
  1837. can be identified by either DUID or its hardware/MAC address. See
  1838. <xref linkend="mac-in-dhcpv6"/> for details. There is an optional
  1839. <command>reservations</command> array in the
  1840. <command>Subnet6</command> structure. Each element in that array
  1841. is a structure, that holds information about a single host. In
  1842. particular, such a structure has to have an indentifer that
  1843. uniquely identifies a host. In DHCPv6 context, such an identifier
  1844. is a hardware (MAC) address or a DUID. Also, either one or more
  1845. addresses or prefixes should be specified. It is possible to
  1846. specify a hostname. Additional capabilities are planned.</para>
  1847. <para>The following example shows how to reserve addresses and prefixes
  1848. for specific hosts:
  1849. <screen>
  1850. "subnet6": [
  1851. {
  1852. "subnet": "2001:db8:1::/48",
  1853. "pools": [ { "pool": "2001:db8:1::/80" } ],
  1854. "pd-pools": [
  1855. {
  1856. "prefix": "2001:db8:1:8000::",
  1857. "prefix-len": 56,
  1858. "delegated-len": 64
  1859. }
  1860. ],
  1861. <userinput>"reservations": [
  1862. {
  1863. "duid": "01:02:03:04:05:0A:0B:0C:0D:0E",
  1864. "ip-addresses": [ "2001:db8:1::100" ]
  1865. },
  1866. {
  1867. "hw-address": "00:01:02:03:04:05",
  1868. "ip-addresses": [ "2001:db8:1::101" ]
  1869. },
  1870. {
  1871. "duid": "01:02:03:04:05:06:07:08:09:0A",
  1872. "ip-addresses": [ "2001:db8:1::102" ],
  1873. "prefixes": [ "2001:db8:2:abcd::/64" ],
  1874. "hostname": "foo.example.com"
  1875. }
  1876. ]</userinput>
  1877. }
  1878. ]
  1879. </screen>
  1880. This example makes 3 reservations. The first one reserves 2001:db8:1::100 address
  1881. for the client using DUID 01:02:03:04:05:0A:0B:0C:0D:0E. The second one
  1882. also reserves an address, but does so using MAC or hardware address, rather than
  1883. DUID. The third example is most advanced. It reserves an address, a prefix and
  1884. a hostname at the same time.
  1885. </para>
  1886. <para>Note that DHCPv6 allows for a single client to lease multiple addresses
  1887. and multiple prefixes at the same time. In the upcoming Kea releases, it will
  1888. be possible to have multiple addresses and prefixes reserved for a single
  1889. host. Therefore <command>ip-addresses</command> and <command>prefixes</command>
  1890. are plural and are actually arrays. As of 0.9.1 having more than one IPv6
  1891. address or prefix is only partially supported.</para>
  1892. <para>Making a reservation for a mobile host that may visit multiple subnets
  1893. requires a separate host definition in each subnet it is expected to visit.
  1894. It is not allowed to define multiple host definitions with the same hardware
  1895. address in a single subnet. It is a valid configuration, if such definitions
  1896. are specified in different subnets, though. The reservation for a given host
  1897. should include only one identifier, either DUID or hwardware address. Defining
  1898. both for the same host is considered a configuration error, but as of 0.9.1
  1899. beta, it is not rejected.
  1900. </para>
  1901. <para>Adding host reservation incurs a performance penalty. In principle,
  1902. when the server that does not support host reservation responds to a query,
  1903. it needs to check whether there is a lease for a given address being
  1904. considered for allocation or renewal. The server that also supports host
  1905. reservation, has to perform additional checks: not only if the address is
  1906. currently used (if there is a lease for it), but also whether the address
  1907. could be used by someone else (if there is a reservation for it). That
  1908. additional check incurs performance penalty.</para>
  1909. <section id="reservation6-types">
  1910. <title>Address/prefix reservation types</title>
  1911. <para>In a typical scenario there's an IPv6 subnet defined with a certain
  1912. part of it dedicated for dynamic address allocation by the DHCPv6
  1913. server. There may be an additional address space defined for prefix
  1914. delegation. Those dynamic parts are referred to as dynamic pools, address
  1915. and prefix pools or simply pools. In principle, the host reservation can
  1916. reserve any address or prefix that belongs to the subnet. The reservations
  1917. that specify an address that belongs to configured pools are called
  1918. <command>in-pool reservations</command>. In contrast, those that do not
  1919. belong to dynamic pools are called <command>out-of-pool
  1920. reservations</command>. There is no formal difference in the reservation
  1921. syntax. As of 0.9.1, both reservation types are handled
  1922. uniformly. However, upcoming releases may offer improved performance if
  1923. there are only out-of-pool reservations as the server will be able to skip
  1924. reservation checks when dealing with existing leases. Therefore, system
  1925. administrators are encouraged to use out-of-pool reservations, if
  1926. possible.</para>
  1927. </section>
  1928. <section id="reservation6-conflict">
  1929. <title>Conflicts in DHCPv6 reservations</title>
  1930. <para>As reservations and lease information are stored in different places,
  1931. conflicts may arrise. Consider the following series of events. The server
  1932. has configured the dynamic pool of addresses from the range of 2001:db8::10
  1933. to 2001:db8::20. Host A requests an address and gets 2001:db8::10. Now the
  1934. system administrator decides to reserve an address for host B. He decides
  1935. to reserve 2001:db8::10 for that purpose. In general, reserving an address
  1936. that is currently assigned to someone else is not recommended, but there
  1937. are valid use cases where such an operation is warranted.</para>
  1938. <para>The server now has a conflict to resolve. Let's analyze the
  1939. situation here. If host B boots up and request an address, the server is
  1940. not able to assign the reserved address 2001:db8::10. A naive approach
  1941. would to be immediately remove the lease for host A and create a new one
  1942. for host B. That would not solve the problem, though, because as soon as
  1943. host B get the address, it will detect that the address is already in use
  1944. by someone else (host A) and would send Decline. Therefore in this
  1945. situation, the server has to temporarily assign a different address from the
  1946. dynamic pool (not matching what has been reserved) to host B.</para>
  1947. <para>When the host A renews its address, the server will discover that
  1948. the address being renewed is now reserved for someone else (host
  1949. B). Therefore the server will remove the lease for 2001:db8::10 and select
  1950. a new address and will create a new lease for it. It will send two
  1951. addresses in its response: the old address with lifetimes set to 0 to
  1952. explicitly indicate that it is no longer valid and a new address with
  1953. non-zero lifetimes. When the host B renews its temporarily assigned
  1954. address, the server will detect that the existing lease does not match
  1955. reservation, so it will release the current address host B has and will
  1956. create a new lease matching the reservation. Similar as before, the server
  1957. will send two addresses: the temporarily assigned one with zeroed
  1958. lifetimes, and the new one that matches reservation with proper lifetimes
  1959. set.</para>
  1960. <para>This recovery will succeed, even if other hosts will attempt to get
  1961. the reserved address. Had the host C requested address 2001:db8::10 after
  1962. the reservation was made, the server will propose a different address.</para>
  1963. <para>This recovery mechanism allows the server to fully recover from a
  1964. case where reservations conflict with existing leases. This procedure
  1965. takes time and will roughly take as long as renew-timer value specified.
  1966. The best way to avoid such recovery is to not define new reservations that
  1967. conflict with existing leases. Another recommendation is to use
  1968. out-of-pool reservations. If the reserved address does not belong to a
  1969. pool, there is no way that other clients could get this address (note that
  1970. having multiple reservations for the same address is not allowed).
  1971. </para>
  1972. </section>
  1973. <section id="reservation6-hostname">
  1974. <title>Reserving a hostname</title>
  1975. <para>When the reservation for the client includes the <command>hostname
  1976. </command>, the server will assign this hostname to the client and send
  1977. it back in the Client FQDN, if the client sent the FQDN option to the
  1978. the server. The reserved hostname always takes precedence over the hostname
  1979. supplied by the client (via the FQDN option) or the autogenerated
  1980. (from the IPv6 address) hostname.</para>
  1981. <para>The server qualifies the reserved hostname with the value
  1982. of the <command>qualifying-suffix</command> parameter. For example, the
  1983. following subnet configuration:
  1984. <screen>
  1985. "subnet6": [
  1986. {
  1987. "subnet": "2001:db8:1::/48",
  1988. "pools": [ { "pool": "2001:db8:1::/80" } ],
  1989. "reservations": [
  1990. {
  1991. "duid": "01:02:03:04:05:0A:0B:0C:0D:0E",
  1992. "ip-addresses": [ "2001:db8:1::100" ]
  1993. "hostname": "alice-laptop"
  1994. }
  1995. ]
  1996. }
  1997. ],
  1998. "dhcp-ddns": {
  1999. "enable-updates": true,
  2000. "qualifying-suffix": "example.isc.org."
  2001. }
  2002. </screen>
  2003. will result in assigning the "alice-laptop.example.isc.org." hostname to the
  2004. client using the DUID "01:02:03:04:05:0A:0B:0C:0D:0E". If the <command>qualifying-suffix
  2005. </command> is not specified, the default (empty) value will be used, and
  2006. in this case the value specified as a <command>hostname</command> will
  2007. be treated as fully qualified name. Thus, by leaving the
  2008. <command>qualifying-suffix</command> empty it is possible to qualify
  2009. hostnames for the different clients with different domain names:
  2010. <screen>
  2011. "subnet6": [
  2012. {
  2013. "subnet": "2001:db8:1::/48",
  2014. "pools": [ { "pool": "2001:db8:1::/80" } ],
  2015. "reservations": [
  2016. {
  2017. "duid": "01:02:03:04:05:0A:0B:0C:0D:0E",
  2018. "ip-addresses": [ "2001:db8:1::100" ]
  2019. "hostname": "mark-desktop.example.org."
  2020. }
  2021. ]
  2022. }
  2023. ],
  2024. "dhcp-ddns": {
  2025. "enable-updates": true,
  2026. }
  2027. </screen>
  2028. will result in assigning the "mark-desktop.example.org." hostname to the
  2029. client using the DUID "01:02:03:04:05:0A:0B:0C:0D:0E".
  2030. </para>
  2031. </section>
  2032. <section id="reservation6-options">
  2033. <title>Reserving specific options</title>
  2034. <!-- @todo: replace this with the actual text once #3573 is implemented -->
  2035. <para>Currently it is not possible to specify options in host
  2036. reservation. Such a feature will be added in the upcoming Kea
  2037. releases.</para>
  2038. </section>
  2039. <section id="reservation6-mode">
  2040. <title>Fine Tuning IPv6 Host Reservation</title>
  2041. <note>
  2042. <para><command>reservation-mode</command> in the DHCPv6 server is
  2043. implemented in Kea 0.9.1 beta, but has not been tested and is
  2044. considered experimental.</para>
  2045. </note>
  2046. <para>Host reservation capability introduces additional restrictions for the
  2047. allocation engine during lease selection and renewal. In particular, three
  2048. major checks are necessary. First, when selecting a new lease, it is not
  2049. sufficient for a candidate lease to be not used by another DHCP client. It
  2050. also must not be reserved for another client. Second, when renewing a lease,
  2051. additional check must be performed whether the address being renewed is not
  2052. reserved for another client. Finally, when a host renews an address or a
  2053. prefix, the server has to check whether there's a reservation for this host,
  2054. so the existing (dynamically allocated) address should be revoked and the
  2055. reserved one be used instead.</para>
  2056. <para>Some of those checks may be unnecessary in certain deployments. Not
  2057. performing them may improve performance. The Kea server provides the
  2058. <command>reservation-mode</command> configuration parameter to select the
  2059. types of reservations allowed for the particular subnet. Each reservation
  2060. type has different constraints for the checks to be performed by the
  2061. server when allocating or renewing a lease for the client.
  2062. Allowed values are:
  2063. <itemizedlist>
  2064. <listitem><simpara> <command>all</command> - enables all host reservation
  2065. types. This is the default value. This setting is the safest and the most
  2066. flexible. It allows in-pool and out-of-pool reservations. As all checks
  2067. are conducted, it is also the slowest.
  2068. </simpara></listitem>
  2069. <listitem><simpara> <command>out-of-pool</command> - allows only out of
  2070. pool host reservations. With this setting in place, the server may assume
  2071. that all host reservations are for addresses that do not belong to the
  2072. dynamic pool. Therefore it can skip the reservation checks when dealing
  2073. with in-pool addresses, thus improving performance. Do not use this mode
  2074. if any of your reservations use in-pool address. Caution is advised when
  2075. using this setting. Kea 0.9.1 does not sanity check the reservations against
  2076. <command>reservation-mode</command>. Misconfiguration may cause problems.
  2077. </simpara></listitem>
  2078. <listitem><simpara>
  2079. <command>disabled</command> - host reservation support is disabled. As there
  2080. are no reservations, the server will skip all checks. Any reservations defined
  2081. will be completely ignored. As the checks are skipped, the server may
  2082. operate faster in this mode.
  2083. </simpara></listitem>
  2084. </itemizedlist>
  2085. </para>
  2086. <para>
  2087. An example configuration that disables reservation looks like follows:
  2088. <screen>
  2089. "Dhcp6": {
  2090. "subnet6": [
  2091. {
  2092. "subnet": "2001:db8:1::/64",
  2093. <userinput>"reservation-mode": "disabled"</userinput>,
  2094. ...
  2095. }
  2096. ]
  2097. }
  2098. </screen>
  2099. </para>
  2100. </section>
  2101. <!-- @todo: add support for per IA reservation (that specifies IAID in
  2102. the ip-addresses and prefixes) -->
  2103. </section>
  2104. <!-- end of host reservations section -->
  2105. <section id="dhcp6-serverid">
  2106. <title>Server Identifier in DHCPv6</title>
  2107. <para>The DHCPv6 protocol uses a "server identifier" (also known
  2108. as a DUID) for clients to be able to discriminate between several
  2109. servers present on the same link. There are several types of
  2110. DUIDs defined, but <ulink url="http://tools.ietf.org/html/rfc3315">RFC 3315</ulink> instructs servers to use DUID-LLT if
  2111. possible. This format consists of a link-layer (MAC) address and a
  2112. timestamp. When started for the first time, the DHCPv6 server will
  2113. automatically generate such a DUID and store the chosen value to
  2114. a file. That file is read by the server
  2115. and the contained value used whenever the server is subsequently started.
  2116. </para>
  2117. <para>
  2118. It is unlikely that this parameter should ever need to be changed.
  2119. However, if such a need arises, stop the server, edit the file and restart
  2120. the server. (The file is named kea-dhcp6-serverid and by default is
  2121. stored in the "var" subdirectory of the directory in which Kea is installed.
  2122. This can be changed when Kea is built by using "--localstatedir"
  2123. on the "configure" command line.) The file is a text file that contains
  2124. double digit hexadecimal values
  2125. separated by colons. This format is similar to typical MAC address
  2126. format. Spaces are ignored. No extra characters are allowed in this
  2127. file.
  2128. </para>
  2129. </section>
  2130. <section id="stateless-dhcp6">
  2131. <title>Stateless DHCPv6 (Information-Request Message)</title>
  2132. <para>Typically DHCPv6 is used to assign both addresses and options. These
  2133. assignments (leases) have state that changes over time, hence
  2134. their name, stateful. DHCPv6 also supports a stateless mode,
  2135. where clients request configuration options only. This mode is
  2136. considered lightweight from the server perspective, as it does not require
  2137. any state tracking; hence its name.</para>
  2138. <para>The Kea server supports stateless mode. Clients can send
  2139. Information-Request messages and the server will send back
  2140. answers with the requested options (providing the options are
  2141. available in the server configuration). The server will attempt to
  2142. use per-subnet options first. If that fails - for whatever reason - it
  2143. will then try to provide options defined in the global scope.</para>
  2144. <para>Stateless and stateful mode can be used together. No special
  2145. configuration directives are required to handle this. Simply use the
  2146. configuration for stateful clients and the stateless clients will get
  2147. just options they requested.</para>
  2148. <para>This usage of global options allows for an interesting case.
  2149. It is possible to run a server that provides just options and no
  2150. addresses or prefixes. If the options have the same value in each
  2151. subnet, the configuration can define required options in the global
  2152. scope and skip subnet definitions altogether. Here's a simple example of
  2153. such a configuration:
  2154. <screen>
  2155. "Dhcp6": {
  2156. "interfaces-config": {
  2157. "interfaces": [ "ethX" ]
  2158. },
  2159. <userinput>"option-data": [ {
  2160. "name": "dns-servers",
  2161. "data": "2001:db8::1, 2001:db8::2"
  2162. } ]</userinput>,
  2163. "lease-database": { "type": "memfile" }
  2164. }
  2165. </screen>
  2166. This very simple configuration will provide DNS server information
  2167. to all clients in the network, regardless of their location. Note the
  2168. specification of the memfile lease database: this is required since,
  2169. as of version 0.9.1, Kea requires a lease database to be specified
  2170. even if it is not used.</para>
  2171. </section>
  2172. <section id="dhcp6-relay-override">
  2173. <title>Using specific relay agent for a subnet</title>
  2174. <para>
  2175. The relay has to have an interface connected to the link on which
  2176. the clients are being configured. Typically the relay has a global IPv6
  2177. address configured on the interface that belongs to the subnet from which
  2178. the server will assign addresses. In the typical case, the
  2179. server is able to use the IPv6 address inserted by the relay (in the link-addr
  2180. field in RELAY-FORW message) to select the appropriate subnet.
  2181. </para>
  2182. <para>
  2183. However, that is not always the case. The relay
  2184. address may not match the subnet in certain deployments. This
  2185. usually means that there is more than one subnet allocated for a given
  2186. link. The two most common examples where this is the case are long lasting
  2187. network renumbering (where both old and new address space is still being
  2188. used) and a cable network. In a cable network both cable modems and the
  2189. devices behind them are physically connected to the same link, yet
  2190. they use distinct addressing. In such case, the DHCPv6 server needs
  2191. additional information (like the value of interface-id option or IPv6
  2192. address inserted in the link-addr field in RELAY-FORW message) to
  2193. properly select an appropriate subnet.
  2194. </para>
  2195. <para>
  2196. The following example assumes that there is a subnet 2001:db8:1::/64
  2197. that is accessible via relay that uses 3000::1 as its IPv6 address.
  2198. The server will be able to select this subnet for any incoming packets
  2199. that came from a relay that has an address in 2001:db8:1::/64 subnet.
  2200. It will also select that subnet for a relay with address 3000::1.
  2201. <screen>
  2202. "Dhcp6": {
  2203. "subnet6": [
  2204. {
  2205. "subnet": "2001:db8:1::/64",
  2206. "pools": [
  2207. {
  2208. "pool": "2001:db8:1::1-2001:db8:1::ffff"
  2209. }
  2210. ],
  2211. <userinput>"relay": {
  2212. "ip-address": "3000::1"
  2213. }</userinput>
  2214. }
  2215. ]
  2216. }
  2217. </screen>
  2218. </para>
  2219. </section>
  2220. <section id="dhcp6-client-class-relay">
  2221. <title>Segregating IPv6 clients in a cable network</title>
  2222. <para>
  2223. In certain cases, it is useful to mix relay address information,
  2224. introduced in <xref linkend="dhcp6-relay-override"/> with client
  2225. classification, explained in <xref linkend="dhcp6-subnet-class"/>.
  2226. One specific example is a cable network, where typically modems
  2227. get addresses from a different subnet than all devices connected
  2228. behind them.
  2229. </para>
  2230. <para>
  2231. Let's assume that there is one CMTS (Cable Modem Termination System)
  2232. with one CM MAC (a physical link that modems are connected to).
  2233. We want the modems to get addresses from the 3000::/64 subnet,
  2234. while everything connected behind modems should get addresses from
  2235. another subnet (2001:db8:1::/64). The CMTS that acts as a relay
  2236. an uses address 3000::1. The following configuration can serve
  2237. that configuration:
  2238. <screen>
  2239. "Dhcp6": {
  2240. "subnet6": [
  2241. {
  2242. "subnet": "3000::/64",
  2243. "pools": [
  2244. { "pool": "3000::2 - 3000::ffff" }
  2245. ],
  2246. <userinput>"client-class": "VENDOR_CLASS_docsis3.0",
  2247. "relay": {
  2248. "ip-address": "3000::1"
  2249. }</userinput>
  2250. },
  2251. {
  2252. "subnet": "2001:db8:1::/64",
  2253. "pools": [
  2254. {
  2255. "pool": "2001:db8:1::1-2001:db8:1::ffff"
  2256. }
  2257. ],
  2258. <userinput>"relay": {
  2259. "ip-address": "3000::1"
  2260. }</userinput>
  2261. }
  2262. ]
  2263. }
  2264. </screen>
  2265. </para>
  2266. </section>
  2267. <section id="mac-in-dhcpv6">
  2268. <title>MAC/Hardware addresses in DHCPv6</title>
  2269. <para>MAC/hardware addesses are available in DHCPv4 messages
  2270. from the clients and administrators
  2271. frequently use that information to perform certain tasks, like per host
  2272. configuration, address reserveration for specific MAC addresses and other.
  2273. Unfortunately, DHCPv6 protocol does not provide any completely reliable way
  2274. to retrieve that information. To mitigate that issue a number of mechanisms
  2275. have been implemented in Kea that attempt to gather that information. Each
  2276. of those mechanisms works in certain cases, but may fail in other cases.
  2277. Whether the mechanism works or not in the particular deployment is
  2278. somewhat dependent on the network topology and the technologies used.</para>
  2279. <para>Kea allows for configuration which of the supported methods should be
  2280. used and in which order. This configuration may be considered a fine tuning
  2281. of the DHCP deployment. In a typical deployment the default
  2282. value of <command>"any"</command> is sufficient and there is no
  2283. need to select specific methods. Changing the value of this parameter
  2284. is the most useful in cases when an administrator wants to disable
  2285. certain method, e.g. if the administrator trusts the network infrastructure
  2286. more than the information provided by the clients themselves, the
  2287. administrator may prefer information provided by the relays over that
  2288. provided by the clients. The format of this parameter is as follows:
  2289. <screen>
  2290. "Dhcp6": {
  2291. <userinput>"mac-sources": [ "method1", "method2", "method3", ... ]</userinput>,
  2292. "subnet6": [ ... ],
  2293. ...
  2294. }
  2295. </screen>
  2296. When not specified, a special value of <emphasis>any</emphasis> is used, which
  2297. instructs the server to attempt to use all the methods in sequence and use
  2298. value returned by the first one that succeeds.</para>
  2299. <para>Supported methods are:
  2300. <itemizedlist>
  2301. <listitem>
  2302. <simpara><command>any</command> - not an actual method, just a keyword that
  2303. instructs Kea to try all other methods and use the first one that succeeds.
  2304. This is the default operation if no <command>mac-sources</command> are defined.
  2305. </simpara>
  2306. </listitem>
  2307. <listitem>
  2308. <simpara><command>raw</command> - In principle, a DHCPv6 server could use raw
  2309. sockets to receive incoming traffic and extract MAC/hardware address
  2310. information. This is currently not implemented for DHCPv6 and this value has
  2311. no effect.
  2312. </simpara>
  2313. </listitem>
  2314. <listitem>
  2315. <simpara><command>duid</command> - DHCPv6 uses DUID identifiers instead of
  2316. MAC addresses. There are currently four DUID types defined, with two of them
  2317. (DUID-LLT, which is the default one and DUID-LL) convey MAC address information.
  2318. Although RFC3315 forbids it, it is possible to parse those DUIDs and extract
  2319. necessary information from them. This method is not completely reliable, as
  2320. clients may use other DUID types, namely DUID-EN or DUID-UUID.
  2321. </simpara>
  2322. </listitem>
  2323. <listitem>
  2324. <simpara><command>ipv6-link-local</command> - Another possible aquisition
  2325. method comes from the source IPv6 address. In typical usage, clients are
  2326. sending their packets from IPv6 link-local addresses. There's a good chance
  2327. that those addresses are based on EUI-64, which contains MAC address. This
  2328. method is not completely reliable, as clients may use other link-local address
  2329. types. In particular, privacy extensions, defined in RFC4941, do not use
  2330. MAC addresses. Also note that successful extraction requires that the
  2331. address's u-bit must be set to 1 and its g-bit set to 0, indicating that it
  2332. is an interface identifier as per
  2333. <ulink url="http://tools.ietf.org/html/rfc2373#section-2.5.1">
  2334. RFC 2373, section 2.5.1</ulink>.
  2335. </simpara>
  2336. </listitem>
  2337. <listitem>
  2338. <simpara><command>client-link-addr-option</command> - One extension defined
  2339. to alleviate missing MAC issues is client link-layer address option, defined
  2340. in <ulink url="http://tools.ietf.org/html/rfc6939">RFC 6939</ulink>. This is
  2341. an option that is inserted by a relay and contains information about client's
  2342. MAC address. This method requires a relay agent that supports the option and
  2343. is configured to insert it. This method is useless for directly connected
  2344. clients. This parameter can also be specified as <command>rfc6939</command>,
  2345. which is an alias for <command>client-link-addr-option</command>.
  2346. </simpara>
  2347. </listitem>
  2348. <listitem>
  2349. <simpara><command>remote-id</command> - <ulink
  2350. url="http://tools.ietf.org/html/rfc4649">RFC 4649</ulink>
  2351. defines remote-id option that is inserted by a relay agent. Depending
  2352. on the relay agent configuration, the inserted option may convey client's
  2353. MAC address information. This parameter can also be specified as
  2354. <command>rfc4649</command>, which is an alias for <command>remote-id</command>.
  2355. </simpara>
  2356. </listitem>
  2357. <listitem>
  2358. <simpara><command>subscriber-id</command> - Another option
  2359. that is somewhat similar to the previous one is subscriber-id,
  2360. defined in <ulink url="http://tools.ietf.org/html/rfc4580">RFC
  2361. 4580</ulink>. It is, too, inserted by a relay agent that is
  2362. configured to insert it. This parameter can also be specified
  2363. as <command>rfc4580</command>, which is an alias for
  2364. <command>subscriber-id</command>. This method is currently not
  2365. implemented.
  2366. </simpara>
  2367. </listitem>
  2368. <listitem>
  2369. <simpara><command>docsis-cmts</command> - Yet another possible source of MAC
  2370. address information are DOCSIS options inserted by a CMTS that acts
  2371. as a DHCPv6 relay agent in cable networks. This method attempts to extract
  2372. MAC address information from suboption 1026 (cm mac) of the vendor specific option
  2373. with vendor-id=4491. This vendor option is extracted from the relay-forward message,
  2374. not the original client's message.
  2375. </simpara>
  2376. </listitem>
  2377. <listitem>
  2378. <simpara><command>docsis-modem</command> - Yet another possible source of MAC
  2379. address information are DOCSIS options inserted by the cable modem itself.
  2380. This method attempts to extract MAC address information from suboption 36 (device id)
  2381. of the vendor specific option with vendor-id=4491. This vendor option is extracted from
  2382. the original client's message, not from any relay options.
  2383. </simpara>
  2384. </listitem>
  2385. </itemizedlist>
  2386. </para>
  2387. </section>
  2388. <section id="dhcp6-std">
  2389. <title>Supported DHCPv6 Standards</title>
  2390. <para>The following standards are currently
  2391. supported:</para>
  2392. <itemizedlist>
  2393. <listitem>
  2394. <simpara><emphasis>Dynamic Host Configuration Protocol for IPv6</emphasis>,
  2395. <ulink url="http://tools.ietf.org/html/rfc3315">RFC 3315</ulink>:
  2396. Supported messages are SOLICIT,
  2397. ADVERTISE, REQUEST, RELEASE, RENEW, REBIND, INFORMATION-REQUEST,
  2398. CONFIRM and REPLY.</simpara>
  2399. </listitem>
  2400. <listitem>
  2401. <simpara><emphasis>IPv6 Prefix Options for
  2402. Dynamic Host Configuration Protocol (DHCP) version 6</emphasis>,
  2403. <ulink url="http://tools.ietf.org/html/rfc3633">RFC 3633</ulink>:
  2404. Supported options are IA_PD and
  2405. IA_PREFIX. Also supported is the status code NoPrefixAvail.</simpara>
  2406. </listitem>
  2407. <listitem>
  2408. <simpara><emphasis>DNS Configuration options for Dynamic Host
  2409. Configuration Protocol for IPv6 (DHCPv6)</emphasis>,
  2410. <ulink url="http://tools.ietf.org/html/rfc3646">RFC 3646</ulink>:
  2411. Supported option is DNS_SERVERS.</simpara>
  2412. </listitem>
  2413. <listitem>
  2414. <simpara><emphasis>The Dynamic Host Configuration Protocol for IPv6 (DHCPv6)
  2415. Relay Agent Remote-ID Option</emphasis>,
  2416. <ulink url="http://tools.ietf.org/html/rfc4649">RFC 4649</ulink>:
  2417. REMOTE-ID option is supported.</simpara>
  2418. </listitem>
  2419. <listitem>
  2420. <simpara><emphasis>The Dynamic Host Configuration Protocol for IPv6 (DHCPv6) Client
  2421. Fully Qualified Domain Name (FQDN) Option</emphasis>,
  2422. <ulink url="http://tools.ietf.org/html/rfc4704">RFC 4704</ulink>:
  2423. Supported option is CLIENT_FQDN.</simpara>
  2424. </listitem>
  2425. <listitem>
  2426. <simpara><emphasis>Relay-Supplied DHCP Options</emphasis>,
  2427. <ulink url="http://tools.ietf.org/html/rfc6422">RFC 6422</ulink>:
  2428. Full functionality is supported: OPTION_RSOO, ability of the server
  2429. to echo back the options, checks whether an option is RSOO-enabled,
  2430. ability to mark additional options as RSOO-enabled.</simpara>
  2431. </listitem>
  2432. <listitem>
  2433. <simpara><emphasis>Client Link-Layer Address Option in
  2434. DHCPv6</emphasis>,
  2435. <ulink url="http://tools.ietf.org/html/rfc6939">RFC
  2436. 6939</ulink>: Supported option is client link-layer
  2437. address option.</simpara>
  2438. </listitem>
  2439. </itemizedlist>
  2440. </section>
  2441. <section id="dhcp6-limit">
  2442. <title>DHCPv6 Server Limitations</title>
  2443. <para> These are the current limitations and known problems
  2444. with the DHCPv6 server
  2445. software. Most of them are reflections of the early stage of
  2446. development and should be treated as <quote>not implemented
  2447. yet</quote>, rather than actual limitations.</para>
  2448. <itemizedlist>
  2449. <listitem> <!-- see tickets #3234, #3281 -->
  2450. <para>
  2451. On-line configuration has some limitations. Adding new subnets or
  2452. modifying existing ones work, as is removing the last subnet from
  2453. the list. However, removing non-last (e.g. removing subnet 1,2 or 3 if
  2454. there are 4 subnets configured) will cause issues. The problem is
  2455. caused by simplistic subnet-id assignment. The subnets are always
  2456. numbered, starting from 1. That subnet-id is then used in leases
  2457. that are stored in the lease database. Removing non-last subnet will
  2458. cause the configuration information to mismatch data in the lease
  2459. database. It is possible to manually update subnet-id fields in
  2460. MySQL or PostgreSQL database, but it is awkward and error prone
  2461. process. A better reconfiguration support is planned.
  2462. </para>
  2463. </listitem>
  2464. <listitem>
  2465. <simpara>
  2466. The server will allocate, renew or rebind a maximum of one lease
  2467. for a particular IA option (IA_NA or IA_PD) sent by a client.
  2468. <ulink url="http://tools.ietf.org/html/rfc3315">RFC 3315</ulink> and
  2469. <ulink url="http://tools.ietf.org/html/rfc3633">RFC 3633</ulink> allow
  2470. for multiple addresses or prefixes to be allocated for a single IA.
  2471. </simpara>
  2472. </listitem>
  2473. <listitem>
  2474. <simpara>Temporary addresses are not supported.</simpara>
  2475. </listitem>
  2476. <listitem>
  2477. <simpara>
  2478. Duplication report (DECLINE) and client reconfiguration (RECONFIGURE) are
  2479. not yet supported.
  2480. </simpara>
  2481. </listitem>
  2482. <listitem>
  2483. <simpara>
  2484. The server doesn't act upon expired leases. In particular,
  2485. when a lease expires, the server doesn't request removal of
  2486. the DNS records associated with it.
  2487. </simpara>
  2488. </listitem>
  2489. </itemizedlist>
  2490. </section>
  2491. <!--
  2492. <section id="dhcp6-srv-examples">
  2493. <title>Kea DHCPv6 server examples</title>
  2494. <para>
  2495. This section provides easy to use example. Each example can be read
  2496. separately. It is not intended to be read sequentially as there will
  2497. be many repetitions between examples. They are expected to serve as
  2498. easy to use copy-paste solutions to many common deployments.
  2499. </para>
  2500. @todo: add simple configuration for direct clients
  2501. @todo: add configuration for relayed clients
  2502. @todo: add client classification example
  2503. </section> -->
  2504. </chapter>