dhcp4-srv.xml 84 KB

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