dhcp4-srv.xml 81 KB

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