dhcp4-srv.xml 81 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879
  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="dhcp4">
  7. <title>The DHCPv4 Server</title>
  8. <section id="dhcp4-start-stop">
  9. <title>Starting and Stopping the DHCPv4 Server</title>
  10. <!-- @todo Rewrite this section once #3422 is done -->
  11. <para>
  12. It is recommended that the Kea DHCPv4 server be started and stopped
  13. using <command>keactl</command> (described in <xref linkend="keactrl"/>).
  14. However, it is also possible to run the server directly: it accepts
  15. the following command-line switches:
  16. </para>
  17. <itemizedlist>
  18. <listitem>
  19. <simpara>
  20. <command>-c <replaceable>file</replaceable></command> -
  21. specifies the configuration file. This is the only mandatory
  22. switch.</simpara>
  23. </listitem>
  24. <listitem>
  25. <simpara>
  26. <command>-v</command> - specifies whether the server
  27. logging should be switched to verbose mode. In verbose mode,
  28. the logging severity and debuglevel specified in a configuration
  29. file are ignored and "debug" severity and the maximum debuglevel
  30. (99) are assumed. The flag is convenient, for temporarily
  31. switching the server into maximum verbosity, e.g. when
  32. debugging.</simpara>
  33. </listitem>
  34. <listitem>
  35. <simpara>
  36. <command>-p <replaceable>port</replaceable></command> -
  37. specifies UDP port the server will listen on. This is only
  38. useful during testing, as the DHCPv4 server listening on
  39. ports other than default DHCPv4 ports will not be able to
  40. handle regular DHCPv4 queries.</simpara>
  41. </listitem>
  42. </itemizedlist>
  43. <para>
  44. When running in a console, the server can be shut down by
  45. pressing ctrl-c. It detects the key combination and shuts
  46. down gracefully.
  47. </para>
  48. <para>
  49. On start-up, the server will detect available network interfaces
  50. and will attempt to open UDP sockets on all interfaces
  51. mentioned in the configuration file.
  52. </para>
  53. <para>
  54. Since the DHCPv4 server opens privileged ports, it requires root
  55. access. Make sure you run this daemon as root.
  56. </para>
  57. </section>
  58. <section id="dhcp4-configuration">
  59. <title>Configuring the DHCPv4 Server</title>
  60. <section>
  61. <title>Introduction</title>
  62. <para>
  63. This section explains how to configure the DHCPv4 server using the
  64. Kea configuration backend. (Kea configuration using any other
  65. backends is outside of scope of this document.) Before DHCPv4
  66. is started, its configuration file has to be created. The
  67. basic configuration looks as follows:
  68. <screen>
  69. {
  70. # DHCPv4 configuration starts in this line
  71. "Dhcp4": {
  72. # First we set up global values
  73. "interfaces": [ "eth0" ],
  74. "valid-lifetime": 4000,
  75. "renew-timer": 1000,
  76. "rebind-timer": 2000,
  77. # Next we specify the type of lease database
  78. "lease-database": {
  79. "type": "memfile",
  80. "persist": "true",
  81. "name": "/var/kea/dhcp4.leases"
  82. },
  83. # Finally, we list the subnets from which we will be leasing addresses.
  84. "subnet4": [
  85. {
  86. "subnet": "192.0.2.0/24",
  87. "pool": [ "192.0.2.1 - 192.0.2.200" ]
  88. }
  89. ]
  90. # DHCPv4 configuration ends with this line
  91. }
  92. } </screen>
  93. </para>
  94. <para>The following paragraphs provide a brief overview of the parameters in
  95. the above example and
  96. their format. Subsequent sections of this chapter go into much greater detail
  97. for these and other parameters.</para>
  98. <para>The lines starting with a hash (#) are comments and are ignored by
  99. the server; they do not impact its
  100. operation in any way.</para>
  101. <para>The configuration starts in the first line with the initial
  102. opening curly bracket (or brace). Each configuration consists of
  103. one or more objects. In this specific example, we have only one
  104. object called Dhcp4. This is a simplified configuration, as usually
  105. there will be additional objects, like <command>Logging</command> or
  106. <command>DhcpDns</command>, but we omit them now for clarity. The Dhcp4
  107. configuration starts with the <command>"Dhcp4": {</command> line
  108. and ends with the corresponding closing brace (in the above example,
  109. the brace after the last comment). Everything defined between those
  110. lines is considered to be the Dhcp4 configuration.</para>
  111. <para>In general case, the order in which those parameters appear does not
  112. matter. There are two caveats here though. The first one is to remember that
  113. the configuration file must be a well formed JSON. That means that parameters
  114. for any given scope must be separate by a comma and there must not be a comma
  115. after the last parameter. When reordering configuration file, keep in mind that
  116. moving a parameter to or from the last position in a given scope may require
  117. moving the comma as well. The second caveat is that it is uncommon - although
  118. legal JSON - to
  119. repeat the same parameter multiple times. If that appears, the last occurrence of a
  120. given parameter in a given scope is used while all previous instances are
  121. ignored. This is unlikely to cause any confusion as there are no real life
  122. reasons to keep multiple copies of the same parameter in your configuration
  123. file.</para>
  124. <para>Moving onto the DHCPv4 configuration elements,
  125. the line defining <command>interfaces</command> parameter specifies a list
  126. of network interfaces on which the server should listen.
  127. Lists are opened and closed with square brackets, with elements
  128. separated by commas. Had we wanted to listen on two interfaces, the line could
  129. look like this:
  130. <screen>
  131. "interfaces": [ "eth0", "eth1" ],
  132. </screen>
  133. As "<command>interfaces</command>" is not the last parameter in the configuration,
  134. a trailing comma is required.</para>
  135. <para>A number of other parameters
  136. follow. <command>valid-lifetime</command> defines how long the addresses (leases) given out by the
  137. server are valid. If nothing changes, client that got the address is allowed to
  138. use it for 4000 seconds. (Note that integer numbers are specified as is,
  139. without any quotes around them.) <command>renew-timer</command> and
  140. <command>rebind-timer</command> are values that
  141. define T1 and T2 timers that govern when the client will begin renewal and
  142. rebind procedures.</para>
  143. <para>The next couple lines define the lease database, the place where the server
  144. stores its lease information. This particular example tells the server to use
  145. <command>memfile</command>, which is the simplest (and fastest) database
  146. backend. It uses in-memory database and stores leases on disk in a CSV
  147. file. This is a very simple configuration. Usually, lease database configuration
  148. is more extensive and contains additional parameters. Note that
  149. <command>lease-database</command>
  150. is an object and opens up a new scope, using an opening brace.
  151. Its parameters (just one in this example -- <command>type</command>)
  152. follow. Had there been more than one, they would be separated by commas. This
  153. scope is closed with a closing brace. As more parameters follow, a trailing
  154. comma is present.</para>
  155. <para>Finally, we need to define a list of IPv4 subnets. This is the
  156. most important DHCPv4 configuration structure as the server uses that
  157. information to process clients' requests. It defines all subnets that
  158. the server is expected to receive DHCP requests from. The subnets are
  159. specified with the <command>subnet4</command> parameter. It is a list,
  160. so it starts and ends with square brackets. Each subnet definition in
  161. the list has several attributes associated with it, so is a structure
  162. and is opened and closed with braces. At minimum, a subnet definition
  163. has to have at least two parameters: <command>subnet</command> (that
  164. defines the whole subnet) and <command>pool</command> (which is a list of
  165. dynamically allocated pools that are governed by the DHCP server).</para>
  166. <para>The example contains a single subnet. Had more than one been defined,
  167. additional elements
  168. in the <command>subnet4</command> parameter would be specified and
  169. separated by commas. For example, to define three subnets, the following
  170. syntax would be used:
  171. <screen>
  172. "subnet4": [
  173. {
  174. "pool": [ "192.0.2.1 - 192.0.2.200" ],
  175. "subnet": "192.0.2.0/24"
  176. },
  177. {
  178. "pool": [ "192.0.3.100 - 192.0.3.200" ],
  179. "subnet": "192.0.3.0/24"
  180. },
  181. {
  182. "pool": [ "192.0.4.1 - 192.0.4.254" ],
  183. "subnet": "192.0.4.0/24"
  184. }
  185. ]
  186. </screen>
  187. </para>
  188. <para>After all parameters are specified, we have two contexts open:
  189. global and Dhcp4, hence we need two closing curly brackets to close them.
  190. In a real life configuration file there most likely would be additional
  191. components defined such as Logging or DhcpDdns, so the closing brace would
  192. be followed by a comma and another object definition.</para>
  193. <para>Kea 0.9 does not have configuration syntax validation
  194. implemented yet. Such a feature is planned for the near future. For
  195. the time being, it is convenient to use on-line JSON validators and/or
  196. viewers to check whether the syntax is correct. One example of such a
  197. JSON validator is available at <ulink
  198. url="http://jsonviewer.stack.hu/"/>.
  199. </para>
  200. </section>
  201. <section>
  202. <title>Lease Storage</title>
  203. <para>All leases issued by the server are stored in the lease database.
  204. Currently there are three database backends available:
  205. memfile (which is the default backend), MySQL and PostgreSQL.</para>
  206. <section>
  207. <title>Memfile - Basic Storage for Leases</title>
  208. <para>The server is able to store lease data in different repositories. Larger
  209. deployments may elect to store leases in a database. <xref
  210. linkend="database-configuration4"/> describes this option. In typical
  211. smaller deployments though, the server will use a CSV file rather than a database to
  212. store lease information. As well as requiring less administration, an
  213. advantage of using a file for storage is that it
  214. eliminates a dependency on third-party database software.</para>
  215. <para>The configuration of the file backend (Memfile) is controlled through
  216. the Dhcp4/lease-database parameters. <!-- @todo: we don't have default
  217. parameters. Let's comment this out When default parameters are used, the
  218. Memfile backend will write leases to a disk in the
  219. [kea-install-dir]/var/kea/kea-leases4.csv. -->
  220. The following configuration:
  221. <screen>
  222. "Dhcp4": {
  223. "lease-database": {
  224. <userinput>"type": "memfile"</userinput>,
  225. <userinput>"persist": "true"</userinput>,
  226. <userinput>"name": "/tmp/kea-leases4.csv"</userinput>
  227. }
  228. ...
  229. }
  230. </screen>
  231. ...sets the name of the lease file to /tmp/kea-leases4.csv.
  232. </para>
  233. <para>The "persist" parameter controls whether the leases are written to disk.
  234. It is strongly recommended that this parameter is set to "true" at all times
  235. during the normal operation of the server. (Not writing leases to disk will
  236. mean that if a server is restarted (e.g. after a power failure), it will not
  237. know what addresses have been assigned. As a result, it may hand out addresses
  238. to new clients that are already in use.)
  239. </para>
  240. </section>
  241. <section id="database-configuration4">
  242. <title>Database Configuration</title>
  243. <note>
  244. <para>Database access information must be configured for the DHCPv4 server,
  245. even if it has already been configured for the DHCPv6 server. The servers
  246. store their information independently, so each server can use a separate
  247. database or both servers can use the same database.</para>
  248. </note>
  249. <para>Database configuration is controlled through the Dhcp4/lease-database
  250. parameters. The type of the database must be set to "mysql" or "postgresql",
  251. e.g.
  252. <screen>
  253. "Dhcp4": { "lease-database": { <userinput>"type": "mysql"</userinput>, ... }, ... }
  254. </screen>
  255. Next, the name of the database is to hold the leases must be set: this is the
  256. name used when the lease database was created (see <xref linkend="dhcp-mysql-database-create"/>
  257. or <xref linkend="dhcp-pgsql-database-create"/>).
  258. <screen>
  259. "Dhcp4": { "lease-database": { <userinput>"name": "<replaceable>database-name</replaceable>" </userinput>, ... }, ... }
  260. </screen>
  261. If the database is located on a different system to the DHCPv4 server, the
  262. database host name must also be specified (although it should be noted that this
  263. configuration may have a severe impact on server performance):
  264. <screen>
  265. "Dhcp4": { "lease-database": { <userinput>"host": <replaceable>remote-host-name</replaceable>"</userinput>, ... }, ... }
  266. </screen>
  267. The usual state of affairs will be to have the database on the same machine as
  268. the DHCPv4 server. In this case, set the value to the empty string:
  269. <screen>
  270. "Dhcp4": { "lease-database": { <userinput>"host" : ""</userinput>, ... }, ... }
  271. </screen>
  272. </para>
  273. <para>Finally, the credentials of the account under which the server will
  274. access the database should be set:
  275. <screen>
  276. "Dhcp4": { "lease-database": { <userinput>"user": "<replaceable>user-name</replaceable>"</userinput>,
  277. <userinput>"password" "<replaceable>password</replaceable>"</userinput>,
  278. ... },
  279. ... }
  280. </screen>
  281. If there is no password to the account, set the password to the empty string
  282. "". (This is also the default.)</para>
  283. </section>
  284. </section>
  285. <section id="dhcp4-interface-selection">
  286. <title>Interface selection</title>
  287. <para>The DHCPv4 server has to be configured to listen on specific network
  288. interfaces. The simplest network interface configuration tells the server to
  289. listen on all available interfaces:
  290. <screen>
  291. "Dhcp4": { <userinput>"interfaces": ["*"]</userinput>, ... }</screen>
  292. The asterisk plays the role of a wildcard and means "listen on all interfaces".
  293. However, it is usually a good idea to explicitly specify interface names:
  294. <screen>
  295. "Dhcp4": { <userinput>"interfaces": [ "eth1", "eth3" ]</userinput>, ... }</screen>
  296. </para>
  297. <para>It is possible to use wildcard interface name (asterisk) concurrently
  298. with explicit interface names:
  299. <screen>
  300. "Dhcp4": { <userinput>"interfaces": [ "eth1", "eth3", "*" ]</userinput>, ... }</screen>
  301. It is anticipated that this will form of usage only be used where it is desired to
  302. temporarily override a list of interface names and listen on all interfaces.
  303. </para>
  304. </section>
  305. <section id="ipv4-subnet-id">
  306. <title>IPv4 Subnet Identifier</title>
  307. <para>
  308. The subnet identifier is a unique number associated with a particular subnet.
  309. In principle, it is used to associate clients' leases with respective subnets.
  310. When a subnet identifier is not specified for a subnet being configured, it will
  311. be automatically assigned by the configuration mechanism. The identifiers
  312. are assigned from 1 and are monotonically increased for each subsequent
  313. subnet: 1, 2, 3 ....
  314. </para>
  315. <para>
  316. If there are multiple subnets configured with auto-generated identifiers and
  317. one of them is removed, the subnet identifiers may be renumbered. For example:
  318. if there are four subnets and third is removed the last subnet will be assigned
  319. identifier that the third subnet had before removal. As a result, the leases
  320. stored in the lease database for subnet 3 are now associated with
  321. subnet 4, something that may have unexpected consequences. It is planned
  322. to implement the mechanism to preserve auto-generated subnet ids in a
  323. future version of Kea. However, the only remedy for this issue
  324. at present is to
  325. manually specify a unique identifier for each subnet.
  326. </para>
  327. <para>
  328. The following configuration:
  329. <screen>
  330. "Dhcp4": {
  331. "subnet4": [
  332. "subnet": "192.0.2.0/24",
  333. <userinput>"id": 1024</userinput>,
  334. ...
  335. ]
  336. }
  337. </screen>
  338. will assign the arbitrary subnet identifier to the newly configured subnet.
  339. This identifier will not change for this subnet unless the "id" parameter is
  340. removed or set to 0. The value of 0 forces auto-generation of the subnet
  341. identifier.
  342. </para>
  343. <!-- @todo: describe whether database needs to be updated after changing
  344. id -->
  345. </section>
  346. <section id="dhcp4-address-config">
  347. <title>Configuration of IPv4 Address Pools</title>
  348. <para>
  349. The essential role of DHCPv4 server is address assignment. The server has to
  350. be configured with at least one subnet and one pool of dynamic addresses to
  351. be managed. For example, assume that the server is connected to a network
  352. segment that uses the 192.0.2.0/24 prefix. The Administrator of that network
  353. has decided that addresses from range 192.0.2.10 to 192.0.2.20 are going to
  354. be managed by the Dhcp4 server. Such a configuration can be achieved in the
  355. following way:
  356. <screen>
  357. "Dhcp4": {
  358. <userinput>"subnet4": [
  359. "subnet": "192.0.2.0/24",
  360. "pool": [ "192.0.2.10 - 192.0.2.20" ]</userinput>,
  361. ...
  362. ]
  363. }</screen>
  364. Note that subnet is defined as a simple string, but the pool parameter is
  365. actually a list of pools: for this reason, the pool definition is enclosed
  366. in square brackets, even though only one range of addresses is
  367. specified in this example.</para>
  368. <para>It is possible to define more than one pool in a subnet: continuing
  369. the previous example, further assume that 192.0.2.64/26 should be also be
  370. managed by the server. It could be written as 192.0.2.64 to
  371. 192.0.2.127. Alternatively, it can be expressed more simply as
  372. 192.0.2.64/26. Both formats are supported by Dhcp4 and can be mixed in the
  373. pool list. For example, one could define the following pools:
  374. <screen>
  375. "Dhcp4": {
  376. "subnet4": [
  377. <userinput>"pool": [ "192.0.2.10-192.0.2.20", "192.0.2.64/26" ]</userinput>,
  378. ...
  379. ],
  380. ...
  381. }
  382. </screen>
  383. The number of pools is not limited, but for performance reasons it is recommended to
  384. use as few as possible. White space in pool definitions is ignored, so
  385. spaces before and after hyphen are optional. They can be used to improve readability.
  386. </para>
  387. <para>
  388. The server may be configured to serve more than one subnet:
  389. <screen>
  390. "Dhcp4": {
  391. "subnet4": [
  392. {
  393. "subnet": "192.0.2.0/24",
  394. "pool": [ "192.0.2.1 - 192.0.2.200" ],
  395. ...
  396. },
  397. {
  398. "subnet": "192.0.3.0/24",
  399. "pool": [ "192.0.3.100 - 192.0.3.200" ],
  400. ...
  401. },
  402. {
  403. "subnet": "192.0.4.0/24",
  404. "pool": [ "192.0.4.1 - 192.0.4.254" ],
  405. ...
  406. }
  407. ]
  408. }
  409. </screen>
  410. </para>
  411. <para>
  412. When configuring a DHCPv4 server using prefix/length notation, please pay
  413. attention to the boundary values. When specifying that the server should use
  414. a given pool, it will be able to allocate also first (typically network
  415. address) and the last (typically broadcast address) address from that pool.
  416. In the aforementioned example of pool 192.0.3.0/24, both 192.0.3.0 and
  417. 192.0.3.255 addresses may be assigned as well. This may be invalid in some
  418. network configurations. If you want to avoid this, please use the "min-max" notation.
  419. </para>
  420. </section>
  421. <section id="dhcp4-std-options">
  422. <title>Standard DHCPv4 options</title>
  423. <para>
  424. One of the major features of the DHCPv4 server is to provide configuration
  425. options to clients. Although there are several options that require
  426. special behavior, most options are sent by the server only if the client
  427. explicitly requested them. The following example shows how to
  428. configure the addresses of DNS servers, which is one of the most frequently used
  429. options. Options specified in this way are considered global and apply
  430. to all configured subnets.
  431. <screen>
  432. "Dhcp4": {
  433. "option-data": [
  434. {
  435. <userinput>"name": "domain-name-servers",
  436. "code": 6,
  437. "space": "dhcp4",
  438. "csv-format": "true",
  439. "data": "192.0.2.1, 192.0.2.2"</userinput>
  440. },
  441. ...
  442. ]
  443. }
  444. </screen>
  445. </para>
  446. <para>
  447. The <command>name</command> parameter specifies the
  448. option name. For a complete list of currently supported names,
  449. see <xref linkend="dhcp4-std-options-list"/> below.
  450. The <command>code</command> parameter specifies the option code, which must match one of the
  451. values from that list. The next line specifies option space, which must always
  452. be set to "dhcp4" as these are standard DHCPv4 options. For
  453. other option spaces, including custom option spaces, see <xref
  454. linkend="dhcp4-option-spaces"/>. The next line specifies the format in
  455. which the data will be entered: use of CSV (comma
  456. separated values) is recommended. The sixth line gives the actual value to
  457. be sent to clients. Data is specified as a normal text, with
  458. values separated by commas if more than one value is
  459. allowed.
  460. </para>
  461. <para>
  462. Options can also be configured as hexadecimal values. If
  463. <command>csv-format</command> is
  464. set to false, option data must be specified as a hexadecimal string. The
  465. following commands configure the domain-name-servers option for all
  466. subnets with the following addresses: 192.0.3.1 and 192.0.3.2.
  467. Note that <command>csv-format</command> is set to false.
  468. <screen>
  469. "Dhcp4": {
  470. "option-data": [
  471. {
  472. <userinput>"name": "domain-name-servers",
  473. "code": 6,
  474. "space": "dhcp4",
  475. "csv-format": "false",
  476. "data": "C0 00 03 01 C0 00 03 02"</userinput>
  477. },
  478. ...
  479. ],
  480. ...
  481. }</screen>
  482. </para>
  483. <para>
  484. It is possible to specify or override options on a per-subnet basis. If
  485. clients connected to most of your subnets are expected to get the
  486. same values of a given option, you should use global options: you
  487. can then override specific values for a small number of subnets.
  488. On the other hand, if you use different values in each subnet,
  489. it does not make sense to specify global option values
  490. (Dhcp4/option-data), rather you should set only subnet-specific values
  491. (Dhcp4/subnet[X]/option-data[Y]).
  492. </para>
  493. <para>
  494. The following commands override the global
  495. DNS servers option for a particular subnet, setting a single DNS
  496. server with address 192.0.2.3.
  497. <screen>
  498. "Dhcp4": {
  499. "subnet4": [
  500. {
  501. <userinput>"option-data": [
  502. {
  503. "name": "domain-name-servers",
  504. "code": 6,
  505. "space: "dhcp4",
  506. "csv-format": "true",
  507. "data": "192.0.2.3"
  508. },
  509. ...
  510. ]</userinput>,
  511. ...
  512. },
  513. ...
  514. ],
  515. ...
  516. }
  517. </screen>
  518. </para>
  519. <note>
  520. <para>
  521. In future versions of Kea, it will not be necessary to specify
  522. the <command>code</command>, <command>space</command>
  523. and <command>csv-format</command> fields, as they will
  524. be set automatically.
  525. </para>
  526. </note>
  527. <para>
  528. The currently supported standard DHCPv4 options are
  529. listed in <xref linkend="dhcp4-std-options-list"/>
  530. and <xref linkend="dhcp4-std-options-list-part2"/>.
  531. The "Name" and "Code"
  532. are the values that should be used as a name in the option-data
  533. structures. "Type" designates the format of the data: the meanings of
  534. the various types is given in <xref linkend="dhcp-types"/>.
  535. </para>
  536. <para>
  537. Some options are designated as arrays, which means that more than one
  538. value is allowed in such an option. For example the option time-servers
  539. allows the specification of more than one IPv4 address, so allowing
  540. clients to obtain the addresses of multiple NTP servers.
  541. </para>
  542. <!-- @todo: describe record types -->
  543. <para>
  544. The <xref linkend="dhcp4-custom-options"/> describes the configuration
  545. syntax to create custom option definitions (formats). It is generally not
  546. allowed to create custom definitions for standard options, even if the
  547. definition being created matches the actual option format defined in the
  548. RFCs. There is an exception from this rule for standard options for which
  549. Kea does not provide a definition yet. In order to use such options,
  550. a server administrator must create a definition as described in
  551. <xref linkend="dhcp4-custom-options"/> in the 'dhcp4' option space. This
  552. definition should match the option format described in the relevant
  553. RFC but configuration mechanism would allow any option format as it has
  554. no means to validate it at the moment.
  555. </para>
  556. <para>
  557. <table frame="all" id="dhcp4-std-options-list">
  558. <title>List of standard DHCPv4 options</title>
  559. <tgroup cols='4'>
  560. <colspec colname='name'/>
  561. <colspec colname='code' align='center'/>
  562. <colspec colname='type' align='center'/>
  563. <colspec colname='array' align='center'/>
  564. <thead>
  565. <row>
  566. <entry>Name</entry>
  567. <entry>Code</entry>
  568. <entry>Type</entry>
  569. <entry>Array?</entry>
  570. </row>
  571. </thead>
  572. <tbody>
  573. <row><entry>subnet-mask</entry><entry>1</entry><entry>ipv4-address</entry><entry>false</entry></row>
  574. <row><entry>time-offset</entry><entry>2</entry><entry>int32</entry><entry>false</entry></row>
  575. <row><entry>routers</entry><entry>3</entry><entry>ipv4-address</entry><entry>true</entry></row>
  576. <row><entry>time-servers</entry><entry>4</entry><entry>ipv4-address</entry><entry>true</entry></row>
  577. <row><entry>name-servers</entry><entry>5</entry><entry>ipv4-address</entry><entry>false</entry></row>
  578. <row><entry>domain-name-servers</entry><entry>6</entry><entry>ipv4-address</entry><entry>true</entry></row>
  579. <row><entry>log-servers</entry><entry>7</entry><entry>ipv4-address</entry><entry>true</entry></row>
  580. <row><entry>cookie-servers</entry><entry>8</entry><entry>ipv4-address</entry><entry>true</entry></row>
  581. <row><entry>lpr-servers</entry><entry>9</entry><entry>ipv4-address</entry><entry>true</entry></row>
  582. <row><entry>impress-servers</entry><entry>10</entry><entry>ipv4-address</entry><entry>true</entry></row>
  583. <row><entry>resource-location-servers</entry><entry>11</entry><entry>ipv4-address</entry><entry>true</entry></row>
  584. <row><entry>host-name</entry><entry>12</entry><entry>string</entry><entry>false</entry></row>
  585. <row><entry>boot-size</entry><entry>13</entry><entry>uint16</entry><entry>false</entry></row>
  586. <row><entry>merit-dump</entry><entry>14</entry><entry>string</entry><entry>false</entry></row>
  587. <row><entry>domain-name</entry><entry>15</entry><entry>fqdn</entry><entry>false</entry></row>
  588. <row><entry>swap-server</entry><entry>16</entry><entry>ipv4-address</entry><entry>false</entry></row>
  589. <row><entry>root-path</entry><entry>17</entry><entry>string</entry><entry>false</entry></row>
  590. <row><entry>extensions-path</entry><entry>18</entry><entry>string</entry><entry>false</entry></row>
  591. <row><entry>ip-forwarding</entry><entry>19</entry><entry>boolean</entry><entry>false</entry></row>
  592. <row><entry>non-local-source-routing</entry><entry>20</entry><entry>boolean</entry><entry>false</entry></row>
  593. <row><entry>policy-filter</entry><entry>21</entry><entry>ipv4-address</entry><entry>true</entry></row>
  594. <row><entry>max-dgram-reassembly</entry><entry>22</entry><entry>uint16</entry><entry>false</entry></row>
  595. <row><entry>default-ip-ttl</entry><entry>23</entry><entry>uint8</entry><entry>false</entry></row>
  596. <row><entry>path-mtu-aging-timeout</entry><entry>24</entry><entry>uint32</entry><entry>false</entry></row>
  597. <row><entry>path-mtu-plateau-table</entry><entry>25</entry><entry>uint16</entry><entry>true</entry></row>
  598. <row><entry>interface-mtu</entry><entry>26</entry><entry>uint16</entry><entry>false</entry></row>
  599. <row><entry>all-subnets-local</entry><entry>27</entry><entry>boolean</entry><entry>false</entry></row>
  600. <row><entry>broadcast-address</entry><entry>28</entry><entry>ipv4-address</entry><entry>false</entry></row>
  601. <row><entry>perform-mask-discovery</entry><entry>29</entry><entry>boolean</entry><entry>false</entry></row>
  602. <row><entry>mask-supplier</entry><entry>30</entry><entry>boolean</entry><entry>false</entry></row>
  603. <row><entry>router-discovery</entry><entry>31</entry><entry>boolean</entry><entry>false</entry></row>
  604. <row><entry>router-solicitation-address</entry><entry>32</entry><entry>ipv4-address</entry><entry>false</entry></row>
  605. <row><entry>static-routes</entry><entry>33</entry><entry>ipv4-address</entry><entry>true</entry></row>
  606. <row><entry>trailer-encapsulation</entry><entry>34</entry><entry>boolean</entry><entry>false</entry></row>
  607. <row><entry>arp-cache-timeout</entry><entry>35</entry><entry>uint32</entry><entry>false</entry></row>
  608. <row><entry>ieee802-3-encapsulation</entry><entry>36</entry><entry>boolean</entry><entry>false</entry></row>
  609. <row><entry>default-tcp-ttl</entry><entry>37</entry><entry>uint8</entry><entry>false</entry></row>
  610. <row><entry>tcp-keepalive-internal</entry><entry>38</entry><entry>uint32</entry><entry>false</entry></row>
  611. <row><entry>tcp-keepalive-garbage</entry><entry>39</entry><entry>boolean</entry><entry>false</entry></row>
  612. </tbody>
  613. </tgroup>
  614. </table>
  615. </para>
  616. <para>
  617. <table frame="all" id="dhcp4-std-options-list-part2">
  618. <title>List of standard DHCPv4 options (continued)</title>
  619. <tgroup cols='4'>
  620. <colspec colname='name'/>
  621. <colspec colname='code'/>
  622. <colspec colname='type'/>
  623. <colspec colname='array'/>
  624. <thead>
  625. <row>
  626. <entry>Name</entry>
  627. <entry>Code</entry>
  628. <entry>Type</entry>
  629. <entry>Array?</entry>
  630. </row>
  631. </thead>
  632. <tbody>
  633. <row><entry>nis-domain</entry><entry>40</entry><entry>string</entry><entry>false</entry></row>
  634. <row><entry>nis-servers</entry><entry>41</entry><entry>ipv4-address</entry><entry>true</entry></row>
  635. <row><entry>ntp-servers</entry><entry>42</entry><entry>ipv4-address</entry><entry>true</entry></row>
  636. <row><entry>vendor-encapsulated-options</entry><entry>43</entry><entry>empty</entry><entry>false</entry></row>
  637. <row><entry>netbios-name-servers</entry><entry>44</entry><entry>ipv4-address</entry><entry>true</entry></row>
  638. <row><entry>netbios-dd-server</entry><entry>45</entry><entry>ipv4-address</entry><entry>true</entry></row>
  639. <row><entry>netbios-node-type</entry><entry>46</entry><entry>uint8</entry><entry>false</entry></row>
  640. <row><entry>netbios-scope</entry><entry>47</entry><entry>string</entry><entry>false</entry></row>
  641. <row><entry>font-servers</entry><entry>48</entry><entry>ipv4-address</entry><entry>true</entry></row>
  642. <row><entry>x-display-manager</entry><entry>49</entry><entry>ipv4-address</entry><entry>true</entry></row>
  643. <row><entry>dhcp-requested-address</entry><entry>50</entry><entry>ipv4-address</entry><entry>false</entry></row>
  644. <!-- Lease time should not be configured by a user.
  645. <row><entry>dhcp-lease-time</entry><entry>51</entry><entry>uint32</entry><entry>false</entry></row>
  646. -->
  647. <row><entry>dhcp-option-overload</entry><entry>52</entry><entry>uint8</entry><entry>false</entry></row>
  648. <!-- Message Type, Server Identifier and Parameter Request List should not be configured by a user.
  649. <row><entry>dhcp-message-type</entry><entry>53</entry><entry>uint8</entry><entry>false</entry></row>
  650. <row><entry>dhcp-server-identifier</entry><entry>54</entry><entry>ipv4-address</entry><entry>false</entry></row>
  651. <row><entry>dhcp-parameter-request-list</entry><entry>55</entry><entry>uint8</entry><entry>true</entry></row>
  652. -->
  653. <row><entry>dhcp-message</entry><entry>56</entry><entry>string</entry><entry>false</entry></row>
  654. <row><entry>dhcp-max-message-size</entry><entry>57</entry><entry>uint16</entry><entry>false</entry></row>
  655. <!-- Renewal and rebinding time should not be configured by a user.
  656. <row><entry>dhcp-renewal-time</entry><entry>58</entry><entry>uint32</entry><entry>false</entry></row>
  657. <row><entry>dhcp-rebinding-time</entry><entry>59</entry><entry>uint32</entry><entry>false</entry></row>
  658. -->
  659. <row><entry>vendor-class-identifier</entry><entry>60</entry><entry>binary</entry><entry>false</entry></row>
  660. <!-- Client identifier should not be configured by a user.
  661. <row><entry>dhcp-client-identifier</entry><entry>61</entry><entry>binary</entry><entry>false</entry></row>
  662. -->
  663. <row><entry>nwip-domain-name</entry><entry>62</entry><entry>string</entry><entry>false</entry></row>
  664. <row><entry>nwip-suboptions</entry><entry>63</entry><entry>binary</entry><entry>false</entry></row>
  665. <row><entry>tftp-server-name</entry><entry>66</entry><entry>string</entry><entry>false</entry></row>
  666. <row><entry>boot-file-name</entry><entry>67</entry><entry>string</entry><entry>false</entry></row>
  667. <row><entry>user-class</entry><entry>77</entry><entry>binary</entry><entry>false</entry></row>
  668. <row><entry>fqdn</entry><entry>81</entry><entry>record</entry><entry>false</entry></row>
  669. <row><entry>dhcp-agent-options</entry><entry>82</entry><entry>empty</entry><entry>false</entry></row>
  670. <row><entry>authenticate</entry><entry>90</entry><entry>binary</entry><entry>false</entry></row>
  671. <row><entry>client-last-transaction-time</entry><entry>91</entry><entry>uint32</entry><entry>false</entry></row>
  672. <row><entry>associated-ip</entry><entry>92</entry><entry>ipv4-address</entry><entry>true</entry></row>
  673. <row><entry>subnet-selection</entry><entry>118</entry><entry>ipv4-address</entry><entry>false</entry></row>
  674. <row><entry>domain-search</entry><entry>119</entry><entry>binary</entry><entry>false</entry></row>
  675. <row><entry>vivco-suboptions</entry><entry>124</entry><entry>binary</entry><entry>false</entry></row>
  676. <row><entry>vivso-suboptions</entry><entry>125</entry><entry>binary</entry><entry>false</entry></row>
  677. </tbody>
  678. </tgroup>
  679. </table>
  680. </para>
  681. <para>
  682. <table frame="all" id="dhcp-types">
  683. <title>List of standard DHCP option types</title>
  684. <tgroup cols='2'>
  685. <colspec colname='name'/>
  686. <colspec colname='meaning'/>
  687. <thead>
  688. <row><entry>Name</entry><entry>Meaning</entry></row>
  689. </thead>
  690. <tbody>
  691. <row><entry>binary</entry><entry>An arbitrary string of bytes, specified as a set of hexadecimal digits.</entry></row>
  692. <row><entry>boolean</entry><entry>Boolean value with allowed values true or false</entry></row>
  693. <row><entry>empty</entry><entry>No value, data is carried in suboptions</entry></row>
  694. <row><entry>fqdn</entry><entry>Fully qualified domain name (e.g. www.example.com)</entry></row>
  695. <row><entry>ipv4-address</entry><entry>IPv4 address in the usual dotted-decimal notation (e.g. 192.0.2.1)</entry></row>
  696. <row><entry>ipv6-address</entry><entry>IPv6 address in the usual colon notation (e.g. 2001:db8::1)</entry></row>
  697. <row><entry>record</entry><entry>Structured data that may comprise any types (except "record" and "empty")</entry></row>
  698. <row><entry>string</entry><entry>Any text</entry></row>
  699. <row><entry>uint8</entry><entry>8 bit unsigned integer with allowed values 0 to 255</entry></row>
  700. <row><entry>uint16</entry><entry>16 bit unsigned integer with allowed values 0 to 65535</entry></row>
  701. <row><entry>uint32</entry><entry>32 bit unsigned integer with allowed values 0 to 4294967295</entry></row>
  702. </tbody>
  703. </tgroup>
  704. </table>
  705. </para>
  706. </section>
  707. <section id="dhcp4-custom-options">
  708. <title>Custom DHCPv4 options</title>
  709. <para>Kea supports custom (non-standard) DHCPv4 options. Assume
  710. that we want to define a new DHCPv4 option called "foo" which
  711. will have code 222 and will convey a single unsigned 32 bit
  712. integer value. We can define such an option by using the
  713. following entry in the configuration file:
  714. <screen>
  715. "Dhcp4": {
  716. "option-def": [
  717. {
  718. <userinput>"name": "foo",
  719. "code": 222,
  720. "type": "uint32",
  721. "array": "false",
  722. "record-types": "",
  723. "space": "dhcp4",
  724. "encapsulate": ""</userinput>
  725. }, ...
  726. ],
  727. ...
  728. }
  729. </screen>
  730. The "false" value of the <command>array</command> parameter determines that the option
  731. does NOT comprise an array of "uint32" values but rather a single value.
  732. Two other parameters have been left blank: <command>record-types</command> and <command>encapsulate</command>.
  733. The former specifies the comma separated list of option data fields if the
  734. option comprises a record of data fields. This should
  735. be non-empty if the <command>type</command> is set to "record". Otherwise it must be left
  736. blank. The latter parameter specifies the name of the option space being
  737. encapsulated by the particular option. If the particular option does not
  738. encapsulate any option space it should be left blank.
  739. Note that the above set of comments define the format of the new option and do not
  740. set its values.
  741. </para>
  742. <note>
  743. <para>
  744. In the current release the default values are not propagated to the
  745. parser when the new configuration is being set. Therefore, all
  746. parameters must be specified at all times, even if their values are
  747. left blank.
  748. </para>
  749. </note>
  750. <para>Once the new option format is defined, its value is set
  751. in the same way as for a standard option. For example the following
  752. commands set a global value that applies to all subnets.
  753. <screen>
  754. "Dhcp4": {
  755. "option-data": [
  756. {
  757. <userinput>name "foo",
  758. "code": 222,
  759. "space": "dhcp4",
  760. "csv-format": "true",
  761. "data": "12345"</userinput>
  762. }, ...
  763. ],
  764. ...
  765. }
  766. </screen>
  767. </para>
  768. <para>New options can take more complex forms than simple use of
  769. primitives (uint8, string, ipv4-address etc): it is possible to
  770. define an option comprising a number of existing primitives.
  771. Assume we want to define a new option that will consist of
  772. an IPv4 address, followed by unsigned 16 bit integer, followed by
  773. a boolean value, followed by a text string. Such an option could
  774. be defined in the following way:
  775. <screen>
  776. "Dhcp4": {
  777. "option-def": [
  778. {
  779. <userinput>"name": "bar",
  780. "code": 223,
  781. "space": "dhcp4",
  782. "type": "record",
  783. "array": "false",
  784. "record-types": "ipv4-address, uint16, boolean, string",
  785. "encapsulate": ""</userinput>
  786. }, ...
  787. ],
  788. ...
  789. }
  790. </screen>
  791. The <command>type</command> is set to "record" to indicate that the option contains
  792. multiple values of different types. These types are given as a comma-separated
  793. list in the <command>record-types</command> field and should be those listed in <xref linkend="dhcp-types"/>.
  794. </para>
  795. <para>
  796. The values of the option are set as follows:
  797. <screen>
  798. "Dhcp4": {
  799. "option-data": [
  800. {
  801. <userinput>"name": "bar",
  802. "space": "dhcp4",
  803. "code": 223,
  804. "csv-format": "true",
  805. "data": "192.0.2.100, 123, true, Hello World"</userinput>
  806. }
  807. ],
  808. ...
  809. }</screen>
  810. <command>csv-format</command> is set "true" to indicate that the <command>data</command> field comprises a command-separated
  811. list of values. The values in the <command>data</command> must correspond to the types set in
  812. the <command>record-types</command> field of the option definition.
  813. </para>
  814. <note>
  815. <para>
  816. It is recommended that boolean values are specified using "true" and "false"
  817. strings. This helps to prevent errors when typing multiple comma separated
  818. values, as it make it easier to identify the type of the value being typed,
  819. and compare it with the order of data fields. Nevertheless, it is possible
  820. to use integer values: "1" and "0", instead of "true" and "false".
  821. If other integer value are used, the configuration is rejected.
  822. </para>
  823. </note>
  824. </section>
  825. <section id="dhcp4-vendor-opts">
  826. <title>DHCPv4 Vendor Specific Options</title>
  827. <para>
  828. Currently there are three option spaces defined: "dhcp4" (used by the DHCPv4 daemon)
  829. and "dhcp6" (for the DHCPv6 daemon); there is also "vendor-encapsulated-options-space",
  830. which is empty by default, but options
  831. can be defined in it. Those options are called vendor-specific
  832. information options. The following examples show how to define
  833. an option "foo" with code 1 that consists of an IPv4 address, an
  834. unsigned 16 bit integer and a string. The "foo" option is conveyed
  835. in a vendor specific information option.
  836. </para>
  837. <para>
  838. The first step is to define the format of the option:
  839. <screen>
  840. "Dhcp4": {
  841. "option-def": [
  842. {
  843. <userinput>"name": "foo",
  844. "code": 1,
  845. "space": "vendor-encapsulated-options-space",
  846. "type": "record",
  847. "array": "false",
  848. "record-types": "ipv4-address, uint16, string",
  849. "encapsulates": ""</userinput>
  850. }
  851. ],
  852. ...
  853. }</screen>
  854. (Note that the option space is set to "vendor-encapsulated-options-space".)
  855. Once the option format is defined, the next step is to define actual values
  856. for that option:
  857. <screen>
  858. "Dhcp4": {
  859. "option-data": [
  860. {
  861. <userinput>"name": "foo"
  862. "space": "vendor-encapsulated-options-space",
  863. "code": 1,
  864. "csv-format": "true",
  865. "data": "192.0.2.3, 123, Hello World"</userinput>
  866. }
  867. ],
  868. ...
  869. }</screen>
  870. We also set up a dummy value for "vendor-encapsulated-options", the option that conveys our sub-option "foo".
  871. This is required else the option will not be included in messages sent to the client.
  872. <screen>
  873. "Dhcp4": {
  874. "option-data": [
  875. {
  876. <userinput>"name": "vendor-encapsulated-options"
  877. "space": "dhcp4",
  878. "code": 43,
  879. "csv-format": "false",
  880. "data": ""</userinput>
  881. }
  882. ],
  883. ...
  884. }</screen>
  885. </para>
  886. <note>
  887. <para>
  888. With this version of Kea, the "vendor-encapsulated-options" option
  889. must be specified in the configuration although it has no configurable
  890. parameters. If it is not specified, the server will assume that it is
  891. not configured and will not send it to a client. In the future there
  892. will be no need to include this option in the configuration.
  893. </para>
  894. </note>
  895. </section>
  896. <section id="dhcp4-option-spaces">
  897. <title>Nested DHCPv4 Options (Custom Option Spaces)</title>
  898. <para>It is sometimes useful to define completely new option
  899. space. This is the case when user creates new option in the
  900. standard option space ("dhcp4 or "dhcp6") and wants this option
  901. to convey sub-options. Since they are in a separate space,
  902. sub-option codes will have a separate numbering scheme and may
  903. overlap with the codes of standard options.
  904. </para>
  905. <para>Note that creation of a new option space when defining
  906. sub-options for a standard option is not required, because it is
  907. created by default if the standard option is meant to convey any
  908. sub-options (see <xref linkend="dhcp4-vendor-opts"/>).
  909. </para>
  910. <para>
  911. Assume that we want to have a DHCPv4 option called "container" with
  912. code 222 that conveys two sub-options with codes 1 and 2.
  913. First we need to define the new sub-options:
  914. <screen>
  915. "Dhcp4": {
  916. "option-def": [
  917. {
  918. <userinput>"name": "subopt1",
  919. "code": 1,
  920. "space": "isc",
  921. "type": "ipv4-address".
  922. "record-types": "",
  923. "array": "false",
  924. "encapsulate ""
  925. },
  926. {
  927. "name": "subopt2",
  928. "code": 2,
  929. "space": "isc",
  930. "type": "string",
  931. "record-types": "",
  932. "array": "false"
  933. "encapsulate": ""</userinput>
  934. }
  935. ],
  936. ...
  937. }</screen>
  938. Note that we have defined the options to belong to a new option space
  939. (in this case, "isc").
  940. </para>
  941. <para>
  942. The next step is to define a regular DHCPv4 option with our desired
  943. code and specify that it should include options from the new option space:
  944. <screen>
  945. "Dhcp4": {
  946. "option-def": [
  947. ...,
  948. {
  949. <userinput>"name": "container",
  950. "code": 222,
  951. "space": "dhcp4",
  952. "type": "empty",
  953. "array": "false",
  954. "record-types": "",
  955. "encapsulate": "isc"</userinput>
  956. }
  957. ],
  958. ...
  959. }</screen>
  960. The name of the option space in which the sub-options are defined
  961. is set in the "encapsulate" field. The "type" field is set to "empty"
  962. to indicate that this option does not carry any data other than
  963. sub-options.
  964. </para>
  965. <para>
  966. Finally, we can set values for the new options:
  967. <screen>
  968. "Dhcp4": {
  969. "option-data": [
  970. {
  971. <userinput>"name": "subopt1",
  972. "space": "isc",
  973. "code": 1,
  974. "csv-format": "true",
  975. "data": "192.0.2.3"</userinput>
  976. },
  977. }
  978. <userinput>"name": "subopt2",
  979. "space": "isc",
  980. "code": 2,
  981. "csv-format": "true",
  982. "data": "Hello world"</userinput>
  983. },
  984. {
  985. <userinput>"name": "container",
  986. "space": "dhcp4",
  987. "code": 222,
  988. "csv-format": "true",
  989. "data": ""</userinput>
  990. }
  991. ],
  992. ...
  993. }
  994. </screen>
  995. Even though the "container" option does not carry any data except
  996. sub-options, the "data" field must be explicitly set to an empty value.
  997. This is required because in the current version of Kea, the
  998. default configuration values are not propagated to the configuration parsers:
  999. if the "data" is not set the parser will assume that this
  1000. parameter is not specified and an error will be reported.
  1001. </para>
  1002. <para>Note that it is possible to create an option which carries some data
  1003. in addition to the sub-options defined in the encapsulated option space. For example,
  1004. if the "container" option from the previous example was required to carry an uint16
  1005. value as well as the sub-options, the "type" value would have to be set to "uint16" in
  1006. the option definition. (Such an option would then have the following
  1007. data structure: DHCP header, uint16 value, sub-options.) The value specified
  1008. with the "data" parameter - which should be a valid integer enclosed in quotes,
  1009. e.g. "123" - would then be assigned to the uint16 field in the "container" option.
  1010. </para>
  1011. </section>
  1012. <section id="dhcp4-stateless-configuration">
  1013. <title>Stateless Configuration of DHCPv4 clients</title>
  1014. <para>The DHCPv4 server supports the stateless client configuration whereby the
  1015. client has an IP address configured (e.g. using manual configuration) and only
  1016. contacts the server to obtain other configuration parameters, e.g. DNS servers' addresses.
  1017. In order to obtain the stateless configuration parameters the client sends the
  1018. DHCPINFORM message to the server with the "ciaddr" set to the address that the
  1019. client is currently using. The server unicasts the DHCPACK message to the
  1020. client that includes the stateless configuration ("yiaddr" not set).
  1021. </para>
  1022. <para>The server will respond to the DHCPINFORM when the client is associated
  1023. with the particular subnet defined in the server's configuration. The example
  1024. subnet configuration will look like this:
  1025. <screen>
  1026. "Dhcp4": {
  1027. "subnet4": [
  1028. {
  1029. "subnet": "192.0.2.0/24"
  1030. "option-data": [ {"
  1031. "name": "domain-name-servers",
  1032. "code": 6,
  1033. "data": "192.0.2.200,192.0.2.201",
  1034. "csv-format": "true",
  1035. "space": "dhcp4"
  1036. } ]
  1037. }
  1038. ]
  1039. }</screen>
  1040. </para>
  1041. <para>This subnet specifies the single option which will be included in
  1042. the DHCPACK message to the client in response to DHCPINFORM. Note that
  1043. the subnet definition does not require the address pool configuration
  1044. if it will be used solely for the stateless configuration.
  1045. </para>
  1046. <para>This server will associate the subnet with the client if one of
  1047. the following conditions is met:
  1048. <itemizedlist>
  1049. <listitem>
  1050. <simpara>The DHCPINFORM is relayed and the giaddr matches the
  1051. configured subnet.</simpara>
  1052. </listitem>
  1053. <listitem>
  1054. <simpara>The DHCPINFORM is unicast from the client and the ciaddr
  1055. matches the configured subnet.</simpara>
  1056. </listitem>
  1057. <listitem>
  1058. <simpara>The DHCPINFORM is unicast from the client, the ciaddr is
  1059. not set but the source address of the IP packet matches the
  1060. configured subnet.</simpara>
  1061. </listitem>
  1062. <listitem>
  1063. <simpara>The DHCPINFORM is not relayed and the IP address on the
  1064. interface on which the message is received matches the configured
  1065. subnet.</simpara>
  1066. </listitem>
  1067. </itemizedlist>
  1068. </para>
  1069. </section>
  1070. <section id="dhcp4-client-classifier">
  1071. <title>Client Classification in DHCPv4</title>
  1072. <note>
  1073. <para>
  1074. The DHCPv4 server has been extended to support limited client classification.
  1075. Although the current capability is modest, it is expected to be expanded
  1076. in the future. However, it is envisaged that the majority of client classification
  1077. extensions will be using hooks extensions.
  1078. </para>
  1079. </note>
  1080. <para>In certain cases it is useful to differentiate between different
  1081. types of clients and treat them differently. The process of doing
  1082. classification is conducted in two steps. The first step is to assess
  1083. incoming packet and assign it to zero or more classes. This classification
  1084. is currently simple, but is expected to grow in capability soon. Currently
  1085. the server checks whether incoming packet has vendor class identifier
  1086. option (60). If it has, content of that option is prepended with
  1087. &quot;VENDOR_CLASS_&quot; then is interpreted as a class. For example,
  1088. modern cable modems will send this option with value &quot;docsis3.0&quot;
  1089. and as a result the packet will belong to class &quot;VENDOR_CLASS_docsis3.0&quot;.
  1090. </para>
  1091. <para>It is envisaged that the client classification will be used for changing the
  1092. behavior of almost any part of the DHCP message processing, including assigning
  1093. leases from different pools, assigning different option (or different values of
  1094. the same options) etc. For now, there are only two mechanisms that are taking
  1095. advantage of client classification: specific processing for cable modems and
  1096. subnet selection.</para>
  1097. <para>
  1098. For clients that belong to the VENDOR_CLASS_docsis3.0 class, the siaddr
  1099. field is set to the value of next-server (if specified in a subnet). If
  1100. there is boot-file-name option specified, its value is also set in the
  1101. file field in the DHCPv4 packet. For eRouter1.0 class, the siaddr is
  1102. always set to 0.0.0.0. That capability is expected to be moved to
  1103. external hook library that will be dedicated to cable modems.
  1104. </para>
  1105. <para>
  1106. Kea can be instructed to limit access to given subnets based on class information.
  1107. This is particularly useful for cases where two types of devices share the
  1108. same link and are expected to be served from two different subnets. The
  1109. primary use case for such a scenario is cable networks. There are two
  1110. classes of devices: the cable modem itself, which should be handled a lease
  1111. from subnet A and all other devices behind the modem that should get a lease
  1112. from subnet B. That segregation is essential to prevent overly curious
  1113. users from playing with their cable modems. For details on how to set up
  1114. class restrictions on subnets, see <xref linkend="dhcp4-subnet-class"/>.
  1115. </para>
  1116. <section id="dhcp4-subnet-class">
  1117. <title>Limiting Access to IPv4 Subnet to Certain Classes</title>
  1118. <para>
  1119. In certain cases it beneficial to restrict access to certain subnets
  1120. only to clients that belong to a given subnet. For details on client
  1121. classes, see <xref linkend="dhcp4-client-classifier"/>. This is an
  1122. extension of a previous example from <xref linkend="dhcp4-address-config"/>.
  1123. Let's assume that the server is connected to a network segment that uses
  1124. the 192.0.2.0/24 prefix. The Administrator of that network has decided
  1125. that addresses from range 192.0.2.10 to 192.0.2.20 are going to be
  1126. managed by the Dhcp4 server. Only clients belonging to client class
  1127. VENDOR_CLASS_docsis3.0 are allowed to use this subnet. Such a
  1128. configuration can be achieved in the following way:
  1129. <screen>
  1130. "Dhcp4": {
  1131. "subnet4": [
  1132. {
  1133. <userinput>subnet: "192.0.2.0/24",
  1134. "pool": [ "192.0.2.10 - 192.0.2.20" ],
  1135. "client-class": "VENDOR_CLASS_docsis3.0"</userinput>
  1136. }
  1137. ],
  1138. ...
  1139. }</screen>
  1140. </para>
  1141. <para>
  1142. Care should be taken with client classification as it is easy to prevent
  1143. clients that do not meet class criteria to be denied any service altogether.
  1144. </para>
  1145. </section>
  1146. </section>
  1147. <section id="dhcp4-ddns-config">
  1148. <title>Configuring DHCPv4 for DDNS</title>
  1149. <para>
  1150. As mentioned earlier, kea-dhcp4 can be configured to generate requests to the
  1151. DHCP-DDNS server to update DNS entries. These requests are known as
  1152. NameChangeRequests or NCRs. Each NCR contains the following information:
  1153. <orderedlist>
  1154. <listitem><para>
  1155. Whether it is a request to add (update) or remove DNS entries
  1156. </para></listitem>
  1157. <listitem><para>
  1158. Whether the change requests forward DNS updates (A records), reverse
  1159. DNS updates (PTR records), or both.
  1160. </para></listitem>
  1161. <listitem><para>
  1162. The FQDN, lease address, and DHCID
  1163. </para></listitem>
  1164. </orderedlist>
  1165. The parameters for controlling the generation of NCRs for submission to the
  1166. DHCP-DDNS server
  1167. are contained in the <command>dhcp-ddns</command> section of the kea-dhcp4 server
  1168. configuration. The default values for this section are as follows:
  1169. <screen>
  1170. "Dhcp4": {
  1171. "dhcp-ddns": {
  1172. <userinput>"enable-updates": "true",
  1173. "server-ip": "127.0.0.1",
  1174. "server-port": 53001,
  1175. "sender-ip": "",
  1176. "sender-port: 0,
  1177. "max-queue-size": 1024,
  1178. "ncr-protocol": "UDP",
  1179. "ncr-format": "JSON",
  1180. "override-no-update": "false",
  1181. "override-client-update": "false",
  1182. "replace-client-name": "false",
  1183. "generated-prefix": "myhost",
  1184. "qualifying-suffix": "example.com"</userinput>
  1185. },
  1186. ...
  1187. }
  1188. </screen>
  1189. </para>
  1190. <section id="dhcpv4-d2-io-config">
  1191. <title>DHCP-DDNS Server Connectivity</title>
  1192. <para>
  1193. In order for NCRs to reach the DHCP-DDNS server, kea-dhcp4 must be able
  1194. to communicate with it. kea-dhcp4 uses the following configuration
  1195. parameters to control how it communications with DHCP-DDNS:
  1196. <itemizedlist>
  1197. <listitem><simpara>
  1198. <command>enable-updates</command> - determines whether or not kea-dhcp4 will
  1199. generate NCRs. By default, this value is false hence DDNS updates are
  1200. disabled. To enable DDNS updates set this value to true:
  1201. </simpara></listitem>
  1202. <listitem><simpara>
  1203. <command>server-ip</command> - IP address on which DHCP-DDNS listens for requests. The default is
  1204. the local loopback interface at address 127.0.0.1. You may specify
  1205. either an IPv4 or IPv6 address.
  1206. </simpara></listitem>
  1207. <listitem><simpara>
  1208. <command>server-port</command> - port on which DHCP-DDNS listens for requests. The default value
  1209. is 53001.
  1210. </simpara></listitem>
  1211. <listitem><simpara>
  1212. <command>sender-ip</command> - IP address which kea-dhcp4 should use to send requests to the DHCP-DDNS server.
  1213. The default value is blank which instructs kea-dhcp4 to select a suitable
  1214. address.
  1215. </simpara></listitem>
  1216. <listitem><simpara>
  1217. <command>sender-port</command> - port which kea-dhcp4 should use to send requests to the DHCP-DDNS server. The
  1218. default value of 0 instructs kea-dhcp4 to select suitable port.
  1219. </simpara></listitem>
  1220. <listitem><simpara>
  1221. <command>max-queue-size</command> - maximum number of requests allowed to queue waiting to
  1222. be sent to the DHCP-DDNS server. This value guards against requests accumulating
  1223. uncontrollably if they are being generated faster than they can be
  1224. delivered. If the number of requests queued for transmission reaches
  1225. this value, DDNS updating will be turned off until the queue backlog has
  1226. been sufficiently reduced. The intention is allow the kea-dhcp4 server to
  1227. continue lease operations without running the risk that its memory usage
  1228. grows without limit. The default value is 1024.
  1229. </simpara></listitem>
  1230. <listitem><simpara>
  1231. <command>ncr-format</command> - socket protocol use when sending requests to the DHCP-DDNS server. Currently
  1232. only UDP is supported. TCP may be available in an upcoming release.
  1233. </simpara></listitem>
  1234. <listitem><simpara>
  1235. <command>ncr-protocol</command> - packet format to use when sending requests to the DHCP-DDNS server.
  1236. Currently only JSON format is supported. Other formats may be available
  1237. in future releases.
  1238. </simpara></listitem>
  1239. </itemizedlist>
  1240. By default, the DHCP-DDNS server is assumed to running on the same machine as kea-dhcp4, and
  1241. all of the default values mentioned above should be sufficient.
  1242. If, however, the DHCP-DDNS server has been configured to listen on a different address or
  1243. port, these values must altered accordingly. For example, if the DHCP-DDNS server has been
  1244. configured to listen on 192.168.1.10 port 900, the following configuration
  1245. would be required:
  1246. <screen>
  1247. "Dhcp4": {
  1248. "dhcp-ddns: {
  1249. <userinput>"server-ip": "192.168.1.10",
  1250. "server-port": 900</userinput>,
  1251. ...
  1252. },
  1253. ...
  1254. }
  1255. </screen>
  1256. </para>
  1257. </section>
  1258. <section id="dhcpv4-d2-rules-config">
  1259. <title>When Does the kea-dhcp4 Server Generate DDNS Requests?</title>
  1260. <para>kea-dhcp4 follows the behavior prescribed for DHCP servers in
  1261. <ulink url="http://tools.ietf.org/html/rfc4702">RFC 4702</ulink>.
  1262. It is important to keep in mind that kea-dhcp4 provides the initial decision
  1263. making of when and what to update and forwards that information to the DHCP-DDNS server in
  1264. the form of NCRs. Carrying out the actual DNS updates and dealing with
  1265. such things as conflict resolution are within the purview of the DHCP-DDNS server itself (<xref linkend="dhcp-ddns-server"/>).
  1266. This section describes when kea-dhcp4 will generate NCRs and the
  1267. configuration parameters that can be used to influence this decision.
  1268. It assumes that the "enable-updates" parameter is true.
  1269. </para>
  1270. <para>
  1271. In general, kea-dhcp4 will generate DDNS update requests when:
  1272. <orderedlist>
  1273. <listitem><para>
  1274. A new lease is granted in response to a DHCP REQUEST
  1275. </para></listitem>
  1276. <listitem><para>
  1277. An existing lease is renewed but the FQDN associated with it has
  1278. changed.
  1279. </para></listitem>
  1280. <listitem><para>
  1281. An existing lease is released in response to a DHCP RELEASE
  1282. </para></listitem>
  1283. </orderedlist>
  1284. In the second case, lease renewal, two DDNS requests will be issued: one
  1285. request to remove entries for the previous FQDN and a second request to
  1286. add entries for the new FQDN. In the last case, a lease release, a
  1287. single DDNS request to remove its entries will be made. The decision
  1288. making involved when granting a new lease (the first case) is more
  1289. involved and is discussed next.
  1290. </para>
  1291. <para>
  1292. When a new lease is granted, kea-dhcp4 will generate a DDNS
  1293. update request if the DHCP REQUEST contains either the FQDN option
  1294. (code 81) or the Host Name option (code 12). If both are present,
  1295. the server will use the FQDN option. By default kea-dhcp4
  1296. will respect the FQDN N and S flags specified by the client as shown
  1297. in the following table:
  1298. </para>
  1299. <table id="fqdn-flag-table">
  1300. <title>Default FQDN Flag Behavior</title>
  1301. <tgroup cols='4' align='left'>
  1302. <colspec colname='cflags'/>
  1303. <colspec colname='meaning'/>
  1304. <colspec colname='response'/>
  1305. <colspec colname='sflags'/>
  1306. <thead>
  1307. <row>
  1308. <entry>Client Flags:N-S</entry>
  1309. <entry>Client Intent</entry>
  1310. <entry>Server Response</entry>
  1311. <entry>Server Flags:N-S-O</entry>
  1312. </row>
  1313. </thead>
  1314. <tbody>
  1315. <row>
  1316. <entry>0-0</entry>
  1317. <entry>
  1318. Client wants to do forward updates, server should do reverse updates
  1319. </entry>
  1320. <entry>Server generates reverse-only request</entry>
  1321. <entry>1-0-0</entry>
  1322. </row>
  1323. <row>
  1324. <entry>0-1</entry>
  1325. <entry>Server should do both forward and reverse updates</entry>
  1326. <entry>Server generates request to update both directions</entry>
  1327. <entry>0-1-0</entry>
  1328. </row>
  1329. <row>
  1330. <entry>1-0</entry>
  1331. <entry>Client wants no updates done</entry>
  1332. <entry>Server does not generate a request</entry>
  1333. <entry>1-0-0</entry>
  1334. </row>
  1335. </tbody>
  1336. </tgroup>
  1337. </table>
  1338. <para>
  1339. The first row in the table above represents "client delegation". Here
  1340. the DHCP client states that it intends to do the forward DNS updates and
  1341. the server should do the reverse updates. By default, kea-dhcp4 will honor
  1342. the client's wishes and generate a DDNS request to the DHCP-DDNS server to update only
  1343. reverse DNS data. The parameter <command>override-client-update</command> can be used
  1344. to instruct the server to override client delegation requests. When
  1345. this parameter is true, kea-dhcp4 will disregard requests for client
  1346. delegation and generate a DDNS request to update both forward and
  1347. reverse DNS data. In this case, the N-S-O flags in the server's
  1348. response to the client will be 0-1-1 respectively.
  1349. </para>
  1350. <para>
  1351. (Note that the flag combination N=1, S=1 is prohibited according to
  1352. <ulink utl="http://tools.ietf.org/html/rfc4702">RFC 4702</ulink>. If such a combination is received from the client, the packet
  1353. will be dropped by kea-dhcp4.)
  1354. </para>
  1355. <para>
  1356. To override client delegation, set the following values in your configuration
  1357. file:
  1358. </para>
  1359. <screen>
  1360. "Dhcp4": {
  1361. "dhcp-ddns": {
  1362. <userinput>"override-client-update": "true"</userinput>,
  1363. ...
  1364. },
  1365. ...
  1366. }
  1367. </screen>
  1368. <para>
  1369. The third row in the table above describes the case in which the client
  1370. requests that no DNS updates be done. The parameter, <command>override-no-update</command>,
  1371. can be used to instruct the server to disregard the client's wishes. When
  1372. this parameter is true, kea-dhcp4 will generate DDNS update request to the DHCP-DDNS server
  1373. even if the client requests that no updates be done. The N-S-O flags in the
  1374. server's response to the client will be 0-1-1.
  1375. </para>
  1376. <para>
  1377. To override client delegation, the following values should be set in your configuration:
  1378. </para>
  1379. <screen>
  1380. "Dhcp4": {
  1381. "dhcp-ddns": {
  1382. <userinput>"override-no-update": "true"</userinput>,
  1383. ...
  1384. },
  1385. ...
  1386. }
  1387. </screen>
  1388. <para>
  1389. kea-dhcp4 will always generate DDNS update requests if the client request
  1390. only contains the Host Name option. In addition it will include an FQDN
  1391. option in the response to the client with the FQDN N-S-O flags set to
  1392. 0-1-0 respectively. The domain name portion of the FQDN option will be
  1393. the name submitted to D2 in the DDNS update request.
  1394. </para>
  1395. </section>
  1396. <section id="dhcpv4-fqdn-name-generation">
  1397. <title>kea-dhcp4 name generation for DDNS update requests</title>
  1398. <para>Each NameChangeRequest must of course include the fully qualified domain
  1399. name whose DNS entries are to be affected. kea-dhcp4 can be configured to
  1400. supply a portion or all of that name based upon what it receives from
  1401. the client in the DHCP REQUEST.</para>
  1402. <para>
  1403. The rules for determining the FQDN option are as follows:
  1404. <orderedlist>
  1405. <listitem><para>
  1406. If configured to do, so ignore the REQUEST contents and generate a
  1407. FQDN using a configurable prefix and suffix.
  1408. </para></listitem>
  1409. <listitem><para>
  1410. If the REQUEST contains the client FQDN option, the candidate
  1411. name is taken from there, otherwise it is taken from the Host Name option.
  1412. The candidate name may then be modified:
  1413. <orderedlist>
  1414. <listitem><para>
  1415. If the candidate name is a fully qualified domain name, use it.
  1416. </para></listitem>
  1417. <listitem><para>
  1418. If the candidate name is a partial (i.e. unqualified) name then
  1419. add a configurable suffix to the name and use the result as the FQDN.
  1420. </para></listitem>
  1421. <listitem><para>
  1422. If the candidate name is a empty, generate a FQDN using a
  1423. configurable prefix and suffix.
  1424. </para></listitem>
  1425. </orderedlist>
  1426. </para></listitem>
  1427. </orderedlist>
  1428. To instruct kea-dhcp4 to always generate the FQDN for a client, set the
  1429. parameter <command>replace-client-name</command> to true as follows:
  1430. </para>
  1431. <screen>
  1432. "Dhcp4": {
  1433. "dhcp-ddns": {
  1434. <userinput>"replace-client-name": "true"</userinput>,
  1435. ...
  1436. },
  1437. ...
  1438. }
  1439. </screen>
  1440. <para>
  1441. The prefix used in the generation of a FQDN is specified by the
  1442. <command>generated-prefix</command> parameter. The default value is "myhost". To alter
  1443. its value simply set it to the desired string:
  1444. </para>
  1445. <screen>
  1446. "Dhcp4": {
  1447. "dhcp-ddns": {
  1448. <userinput>"generated-prefix": "another.host"</userinput>,
  1449. ...
  1450. },
  1451. ...
  1452. }
  1453. </screen>
  1454. <para>
  1455. The suffix used when generating a FQDN or when qualifying a partial name
  1456. is specified by the <command>qualifying-suffix</command> parameter. There
  1457. is no default value. To set its value simply set it to the desired string:
  1458. </para>
  1459. <screen>
  1460. "Dhcp4": {
  1461. "dhcp-ddns": {
  1462. <userinput>"qualifying-suffix": "foo.example.org"</userinput>,
  1463. ...
  1464. },
  1465. ...
  1466. }
  1467. </screen>
  1468. </section>
  1469. <para>
  1470. When generating a name, kea-dhcp4 will construct name of the format:
  1471. </para>
  1472. <para>
  1473. [generated-prefix]-[address-text].[qualifying-suffix].
  1474. </para>
  1475. <para>
  1476. where address-text is simply the lease IP address converted to a
  1477. hyphenated string. For example, if lease address is 172.16.1.10 and
  1478. assuming default values for <command>generated-prefix</command> and <command>qualifying-suffix</command>, the
  1479. generated FQDN would be:
  1480. </para>
  1481. <para>
  1482. myhost-172-16-1-10.example.com.
  1483. </para>
  1484. </section>
  1485. <section id="dhcp4-next-server">
  1486. <title>Next Server (siaddr)</title>
  1487. <para>In some cases, clients want to obtain configuration from the TFTP server.
  1488. Although there is a dedicated option for it, some devices may use siaddr field
  1489. in the DHCPv4 packet for that purpose. That specific field can be configured
  1490. using <command>next-server</command> directive. It is possible to define it in global scope or
  1491. for a given subnet only. If both are defined, subnet value takes precedence.
  1492. The value in subnet can be set to 0.0.0.0, which means that <command>next-server</command> should
  1493. not be sent. It may also be set to empty string, which means the same as if
  1494. it was not defined at all, i.e. use the global value.
  1495. </para>
  1496. <screen>
  1497. "Dhcp4": {
  1498. <userinput>"next-server": "192.0.2.123"</userinput>,
  1499. ...,
  1500. "subnet4": {
  1501. [
  1502. <userinput>"next-server": "192.0.2.234"</userinput>,
  1503. ...
  1504. ]
  1505. }
  1506. }
  1507. </screen>
  1508. </section>
  1509. <section id="dhcp4-echo-client-id">
  1510. <title>Echoing Client-ID (RFC 6842)</title>
  1511. <para>The original DHCPv4 specification
  1512. (<ulink url="http://tools.ietf.org/html/rfc2131">RFC 2131</ulink>)
  1513. states that the DHCPv4
  1514. server must not send back client-id options when responding to
  1515. clients. However, in some cases that confused clients that did
  1516. not have MAC address or client-id; see
  1517. <ulink url="http://tools.ietf.org/html/rfc6842">RFC 6842</ulink>.
  1518. for details. That
  1519. behavior has changed with the publication of
  1520. <ulink url="http://tools.ietf.org/html/rfc6842">RFC 6842</ulink>.
  1521. which updated
  1522. <ulink url="http://tools.ietf.org/html/rfc2131">RFC 2131</ulink>.
  1523. That update now states that the server must
  1524. send client-id if client sent it. That is the default behaviour
  1525. that Kea offers. However, in some cases older devices that do
  1526. not support
  1527. <ulink url="http://tools.ietf.org/html/rfc6842">RFC 6842</ulink>.
  1528. may refuse to accept responses that include
  1529. client-id option. To enable backward compatibility, an optional
  1530. configuration parameter has been introduced. To configure it,
  1531. use the following configuration statement:</para>
  1532. <screen>
  1533. "Dhcp4": {
  1534. <userinput>"echo-client-id": "false"</userinput>,
  1535. ...
  1536. }
  1537. </screen>
  1538. </section>
  1539. </section> <!-- end of configuring kea-dhcp4 server section with many subsections -->
  1540. <section id="dhcp4-serverid">
  1541. <title>Server Identifier in DHCPv4</title>
  1542. <para>
  1543. The DHCPv4 protocol uses a "server identifier" to allow clients
  1544. to discriminate between several servers present on the same link: this
  1545. value is an IPv4 address of the server. The server chooses the IPv4 address
  1546. of the interface on which the message from the client (or relay) has been
  1547. received. A single server instance will use multiple server identifiers
  1548. if it is receiving queries on multiple interfaces.
  1549. </para>
  1550. <para>
  1551. Currently there is no mechanism to override the default server identifiers
  1552. by an administrator. In the future, the configuration mechanism will be used
  1553. to specify the custom server identifier.
  1554. </para>
  1555. </section>
  1556. <section id="dhcp4-subnet-selection">
  1557. <title>How the DHCPv4 Server Selects a Subnet for the Client</title>
  1558. <para>
  1559. The DHCPv4 server differentiates between the directly connected clients,
  1560. clients trying to renew leases and clients sending their messages through
  1561. relays. For the directly connected clients the server will check the
  1562. configuration of the interface on which the message has been received, and
  1563. if the server configuration doesn't match any configured subnet the
  1564. message is discarded.</para>
  1565. <para>Assuming that the server's interface is configured with the
  1566. IPv4 address 192.0.2.3, the server will only process messages received through
  1567. this interface from a directly connected client if there is a subnet
  1568. configured to which this IPv4 address belongs, e.g. 192.0.2.0/24.
  1569. The server will use this subnet to assign IPv4 address for the client.
  1570. </para>
  1571. <para>
  1572. The rule above does not apply when the client unicasts its message, i.e.
  1573. is trying to renew its lease. Such message is accepted through any
  1574. interface. The renewing client sets ciaddr to the currently used IPv4
  1575. address. The server uses this address to select the subnet for the client
  1576. (in particular, to extend the lease using this address).
  1577. </para>
  1578. <para>
  1579. If the message is relayed it is accepted through any interface. The giaddr
  1580. set by the relay agent is used to select the subnet for the client.
  1581. </para>
  1582. <para>
  1583. It is also possible to specify a relay IPv4 address for a given subnet. It
  1584. can be used to match incoming packets into a subnet in uncommon configurations,
  1585. e.g. shared subnets. See <xref linkend="dhcp4-relay-override"/> for details.
  1586. </para>
  1587. <note>
  1588. <para>The subnet selection mechanism described in this section is based
  1589. on the assumption that client classification is not used. The classification
  1590. mechanism alters the way in which subnet is selected for the client,
  1591. depending on the classes that the client belongs to.</para>
  1592. </note>
  1593. <section id="dhcp4-relay-override">
  1594. <title>Using a Specific Relay Agent for a Subnet</title>
  1595. <para>
  1596. The relay has to have an interface connected to the link on which
  1597. the clients are being configured. Typically the relay has an IPv4
  1598. address configured on that interface that belongs to the subnet that
  1599. the server will assign addresses from. In such typical case, the
  1600. server is able to use IPv4 address inserted by the relay (in the giaddr
  1601. field of the DHCPv4 packet) to select the appropriate subnet.
  1602. </para>
  1603. <para>
  1604. However, that is not always the case. In certain uncommon - but
  1605. valid - deployments, the relay address may not match the subnet. This
  1606. usually means that there is more than one subnet allocated for a given
  1607. link. The two most common examples where this is the case are long lasting
  1608. network renumbering (where both old and new address space is still being
  1609. used) and a cable network. In a cable network both cable modems and the
  1610. devices behind them are physically connected to the same link, yet
  1611. they use distinct addressing. In such case, the DHCPv4 server needs
  1612. additional information (the IPv4 address of the relay) to properly select
  1613. an appropriate subnet.
  1614. </para>
  1615. <para>
  1616. The following example assumes that there is a subnet 192.0.2.0/24
  1617. that is accessible via relay that uses 10.0.0.1 as its IPv4 address.
  1618. The server will be able to select this subnet for any incoming packets
  1619. that came from a relay that has an address in 192.0.2.0/24 subnet.
  1620. It will also select that subnet for a relay with address 10.0.0.1.
  1621. <screen>
  1622. "Dhcp4": {
  1623. "subnet4: [
  1624. {
  1625. "subnet": "192.0.2.0/24",
  1626. "pool": [ "192.0.2.10 - 192.0.2.20" ],
  1627. <userinput>"relay": {
  1628. "ip-address": "10.0.0.1"
  1629. }</userinput>,
  1630. ...
  1631. }
  1632. ],
  1633. ...
  1634. }
  1635. </screen>
  1636. </para>
  1637. </section>
  1638. <section id="dhcp4-srv-example-client-class-relay">
  1639. <title>Segregating IPv4 Clients in a Cable Network</title>
  1640. <para>
  1641. In certain cases, it is useful to mix relay address information,
  1642. introduced in <xref linkend="dhcp4-relay-override"/> with client
  1643. classification, explained in <xref linkend="dhcp4-subnet-class"/>.
  1644. One specific example is cable network, where typically modems
  1645. get addresses from a different subnet than all devices connected
  1646. behind them.
  1647. </para>
  1648. <para>
  1649. Let's assume that there is one CMTS (Cable Modem Termination System)
  1650. with one CM MAC (a physical link that modems are connected to).
  1651. We want the modems to get addresses from the 10.1.1.0/24 subnet, while
  1652. everything connected behind modems should get addresses from another
  1653. subnet (192.0.2.0/24). The CMTS that acts as a relay uses address
  1654. 10.1.1.1. The following configuration can serve that configuration:
  1655. <screen>
  1656. "Dhcp4": {
  1657. "subnet4: [
  1658. {
  1659. "subnet": "10.1.1.0/24",
  1660. "pool": [ "10.1.1.2 - 10.1.1.20" ],
  1661. <userinput>"client-class" "docsis3.0",
  1662. "relay": {
  1663. "ip-address": "10.1.1.1"
  1664. }</userinput>
  1665. },
  1666. {
  1667. "subnet": "192.0.2.0/24",
  1668. "pool": [ "192.0.2.10 - 192.0.2.20" ],
  1669. <userinput>"relay": {
  1670. "ip-address": "10.1.1.1"
  1671. }</userinput>
  1672. }
  1673. ],
  1674. ...
  1675. }
  1676. </screen>
  1677. </para>
  1678. </section>
  1679. </section>
  1680. <section id="dhcp4-std">
  1681. <title>Supported Standards</title>
  1682. <para>The following standards and draft standards are currently supported:</para>
  1683. <itemizedlist>
  1684. <listitem>
  1685. <simpara><ulink url="http://tools.ietf.org/html/rfc2131">RFC 2131</ulink>: Supported messages are DISCOVER (1), OFFER (2),
  1686. REQUEST (3), RELEASE (7), INFORM (8), ACK (5), and NAK(6).</simpara>
  1687. </listitem>
  1688. <listitem>
  1689. <simpara><ulink url="http://tools.ietf.org/html/rfc2132">RFC 2132</ulink>:
  1690. Supported options are: PAD (0),
  1691. END(255), Message Type(53), DHCP Server Identifier (54),
  1692. Domain Name (15), DNS Servers (6), IP Address Lease Time
  1693. (51), Subnet mask (1), and Routers (3).</simpara>
  1694. </listitem>
  1695. <listitem>
  1696. <simpara><ulink url="http://tools.ietf.org/html/rfc3046">RFC 3046</ulink>:
  1697. Relay Agent Information option is supported.</simpara>
  1698. </listitem>
  1699. <listitem>
  1700. <simpara><ulink url="http://tools.ietf.org/html/rfc3925">RFC 3925</ulink>:
  1701. Vendor-Identifying Vendor Class and Vendor-Identifying Vendor-Specific
  1702. Information option are supported.</simpara>
  1703. </listitem>
  1704. <listitem>
  1705. <simpara><ulink url="http://tools.ietf.org/html/rfc6842">RFC 6842</ulink>:
  1706. Server by default sends back client-id option. That capability may be
  1707. disabled. See <xref linkend="dhcp4-echo-client-id"/> for details.
  1708. </simpara>
  1709. </listitem>
  1710. </itemizedlist>
  1711. </section>
  1712. <section id="dhcp4-limit">
  1713. <title>DHCPv4 Server Limitations</title>
  1714. <para>These are the current limitations of the DHCPv4 server
  1715. software. Most of them are reflections of the current stage of
  1716. development and should be treated as <quote>not implemented
  1717. yet</quote>, rather than actual limitations. However, some of them
  1718. are implications of the design choices made. Those are clearly
  1719. marked as such.</para>
  1720. <itemizedlist>
  1721. <listitem> <!-- see tickets #3234, #3281 -->
  1722. <simpara>
  1723. Removal of a subnet during server reconfiguration may cause renumbering
  1724. of auto-generated subnet identifiers, as described in section
  1725. <xref linkend="ipv4-subnet-id"/>.
  1726. </simpara>
  1727. </listitem>
  1728. <listitem>
  1729. <simpara>Host reservation (static addresses) is not supported yet.</simpara>
  1730. </listitem>
  1731. <listitem>
  1732. <simpara>Full featured client classification is not supported yet.</simpara>
  1733. </listitem>
  1734. <listitem>
  1735. <simpara>
  1736. BOOTP (<ulink url="http://tools.ietf.org/html/rfc951">RFC 951</ulink>)
  1737. is not supported. This is a design choice. BOOTP support is not planned.
  1738. </simpara>
  1739. </listitem>
  1740. <listitem>
  1741. <simpara>On Linux and BSD system families the DHCP messages are sent
  1742. and received over the raw sockets (using LPF and BPF) and all packet
  1743. headers (including data link layer, IP and UDP headers) are created and
  1744. parsed by Kea, rather than the system kernel. Currently, Kea can
  1745. only parse the data link layer headers with a format adhering to
  1746. IEEE 802.3 standard and assumes this data link layer header format
  1747. for all interfaces. Hence, Kea will fail to work on interfaces
  1748. which use different data link layer header formats (e.g. Infiniband).
  1749. </simpara>
  1750. </listitem>
  1751. <listitem>
  1752. <simpara>The DHCPv4 server does not verify that
  1753. assigned address is unused. According to <ulink url="http://tools.ietf.org/html/rfc2131">RFC 2131</ulink>, the
  1754. allocating server should verify that address is not used by
  1755. sending ICMP echo request.</simpara>
  1756. </listitem>
  1757. <listitem>
  1758. <simpara>Address duplication report (DECLINE) is not supported yet.</simpara>
  1759. </listitem>
  1760. <listitem>
  1761. <simpara>
  1762. The server doesn't act upon expired leases. In particular,
  1763. when a lease expires, the server doesn't request the removal
  1764. of the DNS records associated with it. Expired leases can be
  1765. recycled.
  1766. </simpara>
  1767. </listitem>
  1768. </itemizedlist>
  1769. </section>
  1770. <!--
  1771. <section id="dhcp4-srv-examples">
  1772. <title>Kea DHCPv4 server examples</title>
  1773. <para>
  1774. This section provides easy to use example. Each example can be read
  1775. separately. It is not intended to be read sequentially as there will
  1776. be many repetitions between examples. They are expected to serve as
  1777. easy to use copy-paste solutions to many common deployments.
  1778. </para>
  1779. @todo: add simple configuration for direct clients
  1780. @todo: add configuration for relayed clients
  1781. @todo: add client classification example
  1782. </section> -->
  1783. </chapter>