dhcp4-srv.xml 79 KB

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