dhcp4-srv.xml 77 KB

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