dhcp4-srv.xml 78 KB

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