dhcp6-srv.xml 115 KB

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