dhcp4-srv.xml 79 KB

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