dhcp6-srv.xml 114 KB

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