dhcp4-srv.xml 113 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
  4. <!ENTITY mdash "&#x2014;" >
  5. ]>
  6. <chapter id="dhcp4">
  7. <title>The DHCPv4 Server</title>
  8. <section id="dhcp4-start-stop">
  9. <title>Starting and Stopping the DHCPv4 Server</title>
  10. <!-- @todo Rewrite this section once #3422 is done -->
  11. <para>
  12. It is recommended that the Kea DHCPv4 server be started and stopped
  13. using <command>keactrl</command> (described in <xref linkend="keactrl"/>).
  14. However, it is also possible to run the server directly: it accepts
  15. the following command-line switches:
  16. </para>
  17. <itemizedlist>
  18. <listitem>
  19. <simpara>
  20. <command>-c <replaceable>file</replaceable></command> -
  21. specifies the configuration file. This is the only mandatory
  22. switch.</simpara>
  23. </listitem>
  24. <listitem>
  25. <simpara>
  26. <command>-d</command> - specifies whether the server
  27. logging should be switched to debug/verbose mode. In verbose mode,
  28. the logging severity and debuglevel specified in the configuration
  29. file are ignored and "debug" severity and the maximum debuglevel
  30. (99) are assumed. The flag is convenient, for temporarily
  31. switching the server into maximum verbosity, e.g. when
  32. debugging.</simpara>
  33. </listitem>
  34. <listitem>
  35. <simpara>
  36. <command>-p <replaceable>port</replaceable></command> -
  37. specifies UDP port the server will listen on. This is only
  38. useful during testing, as the DHCPv4 server listening on
  39. ports other than default DHCPv4 ports will not be able to
  40. handle regular DHCPv4 queries.</simpara>
  41. </listitem>
  42. <listitem>
  43. <simpara>
  44. <command>-v</command> - prints out Kea version and exits.
  45. </simpara>
  46. </listitem>
  47. <listitem>
  48. <simpara>
  49. <command>-V</command> - prints out Kea extended version with
  50. additional parameters and exits.
  51. </simpara>
  52. </listitem>
  53. </itemizedlist>
  54. <para>
  55. As for any Kea executable binary, the <filename>config.report</filename>
  56. file produced by <userinput>./configure</userinput> is embbeded.
  57. The command extracting it is:
  58. <screen>
  59. strings <userinput>path</userinput>/kea-dhcp4 | sed -n 's/;;;; //p'
  60. </screen>
  61. Beware the <userinput>path</userinput> to use for a binary
  62. in the build tree finishes by <filename>.libs</filename>.
  63. </para>
  64. <para>
  65. When running in a console, the server can be shut down by
  66. pressing ctrl-c. It detects the key combination and shuts
  67. down gracefully.
  68. </para>
  69. <para>
  70. On start-up, the server will detect available network interfaces
  71. and will attempt to open UDP sockets on all interfaces
  72. mentioned in the configuration file.
  73. </para>
  74. <para>
  75. Since the DHCPv4 server opens privileged ports, it requires root
  76. access. Make sure you run this daemon as root.
  77. </para>
  78. </section>
  79. <section id="dhcp4-configuration">
  80. <title>DHCPv4 Server Configuration</title>
  81. <section>
  82. <title>Introduction</title>
  83. <para>
  84. This section explains how to configure the DHCPv4 server using the
  85. Kea configuration backend. (Kea configuration using any other
  86. backends is outside of scope of this document.) Before DHCPv4
  87. is started, its configuration file has to be created. The
  88. basic configuration is as follows:
  89. <screen>
  90. {
  91. # DHCPv4 configuration starts in this line
  92. "Dhcp4": {
  93. # First we set up global values
  94. "valid-lifetime": 4000,
  95. "renew-timer": 1000,
  96. "rebind-timer": 2000,
  97. # Next we setup the interfaces to be used by the server.
  98. "interfaces-config": {
  99. "interfaces": [ "eth0" ]
  100. },
  101. # And we specify the type of lease database
  102. "lease-database": {
  103. "type": "memfile",
  104. "persist": true,
  105. "name": "/var/kea/dhcp4.leases"
  106. },
  107. # Finally, we list the subnets from which we will be leasing addresses.
  108. "subnet4": [
  109. {
  110. "subnet": "192.0.2.0/24",
  111. "pools": [
  112. { "pool": "192.0.2.1 - 192.0.2.200" }
  113. ]
  114. }
  115. ]
  116. # DHCPv4 configuration ends with this line
  117. }
  118. } </screen>
  119. </para>
  120. <para>The following paragraphs provide a brief overview of the parameters in
  121. the above example and
  122. their format. Subsequent sections of this chapter go into much greater detail
  123. for these and other parameters.</para>
  124. <para>The lines starting with a hash (#) are comments and are ignored by
  125. the server; they do not impact its
  126. operation in any way.</para>
  127. <para>The configuration starts in the first line with the initial
  128. opening curly bracket (or brace). Each configuration consists of
  129. one or more objects. In this specific example, we have only one
  130. object called Dhcp4. This is a simplified configuration, as usually
  131. there will be additional objects, like <command>Logging</command> or
  132. <command>DhcpDns</command>, but we omit them now for clarity. The Dhcp4
  133. configuration starts with the <command>"Dhcp4": {</command> line
  134. and ends with the corresponding closing brace (in the above example,
  135. the brace after the last comment). Everything defined between those
  136. lines is considered to be the Dhcp4 configuration.</para>
  137. <para>In the general case, the order in which those parameters appear does not
  138. matter. There are two caveats here though. The first one is to remember that
  139. the configuration file must be well formed JSON. That means that the parameters
  140. for any given scope must be separated by a comma and there must not be a comma
  141. after the last parameter. When reordering a configuration file, keep in mind that
  142. moving a parameter to or from the last position in a given scope may also require
  143. moving the comma. The second caveat is that it is uncommon &mdash; although
  144. legal JSON &mdash; to
  145. repeat the same parameter multiple times. If that happens, the last occurrence of a
  146. given parameter in a given scope is used while all previous instances are
  147. ignored. This is unlikely to cause any confusion as there are no real life
  148. reasons to keep multiple copies of the same parameter in your configuration
  149. file.</para>
  150. <para>Moving onto the DHCPv4 configuration elements, the very first few elements
  151. define some global parameters. <command>valid-lifetime</command> defines for how long the addresses (leases) given out by the
  152. server are valid. If nothing changes, a client that got an address is allowed to
  153. use it for 4000 seconds. (Note that integer numbers are specified as is,
  154. without any quotes around them.) <command>renew-timer</command> and
  155. <command>rebind-timer</command> are values that
  156. define T1 and T2 timers that govern when the client will begin the renewal and
  157. rebind procedures. Note that <command>renew-timer</command> and
  158. <command>rebind-timer</command> are optional. If they are not specified the
  159. client will select values for T1 and T2 timers according to the
  160. <ulink url="http://tools.ietf.org/html/rfc2131">RFC 2131</ulink>.</para>
  161. <para>The <command>interfaces-config</command> map specifies the server
  162. configuration concerning the network interfaces, on which the server should
  163. listen to the DHCP messages. The <command>interfaces</command> parameter
  164. specifies a list of network interfaces on which the server should listen.
  165. Lists are opened and closed with square brackets, with elements separated
  166. by commas. Had we wanted to listen on two interfaces, the
  167. <command>interfaces-config</command> would look like this:
  168. <screen>
  169. "interfaces-config": {
  170. "interfaces": [ "eth0", "eth1" ]
  171. },
  172. </screen>
  173. </para>
  174. <para>The next couple of lines define the lease database, the place where the server
  175. stores its lease information. This particular example tells the server to use
  176. <command>memfile</command>, which is the simplest (and fastest) database
  177. backend. It uses an in-memory database and stores leases on disk in a CSV
  178. file. This is a very simple configuration. Usually, lease database configuration
  179. is more extensive and contains additional parameters. Note that
  180. <command>lease-database</command>
  181. is an object and opens up a new scope, using an opening brace.
  182. Its parameters (just one in this example -- <command>type</command>)
  183. follow. Had there been more than one, they would be separated by commas. This
  184. scope is closed with a closing brace. As more parameters follow, a trailing
  185. comma is present.</para>
  186. <para>Finally, we need to define a list of IPv4 subnets. This is the
  187. most important DHCPv4 configuration structure as the server uses that
  188. information to process clients' requests. It defines all subnets from
  189. which the server is expected to receive DHCP requests. The subnets are
  190. specified with the <command>subnet4</command> parameter. It is a list,
  191. so it starts and ends with square brackets. Each subnet definition in
  192. the list has several attributes associated with it, so it is a structure
  193. and is opened and closed with braces. At a minimum, a subnet definition
  194. has to have at least two parameters: <command>subnet</command> (that
  195. defines the whole subnet) and <command>pools</command> (which is a list of
  196. dynamically allocated pools that are governed by the DHCP server).</para>
  197. <para>The example contains a single subnet. Had more than one been defined,
  198. additional elements
  199. in the <command>subnet4</command> parameter would be specified and
  200. separated by commas. For example, to define three subnets, the following
  201. syntax would be used:
  202. <screen>
  203. "subnet4": [
  204. {
  205. "pools": [ { "pool": "192.0.2.1 - 192.0.2.200" } ],
  206. "subnet": "192.0.2.0/24"
  207. },
  208. {
  209. "pools": [ { "pool": "192.0.3.100 - 192.0.3.200" } ],
  210. "subnet": "192.0.3.0/24"
  211. },
  212. {
  213. "pools": [ { "pool": "192.0.4.1 - 192.0.4.254" } ],
  214. "subnet": "192.0.4.0/24"
  215. }
  216. ]
  217. </screen>
  218. </para>
  219. <para>After all parameters are specified, we have two contexts open:
  220. global and Dhcp4, hence we need two closing curly brackets to close them.
  221. In a real life configuration file there most likely would be additional
  222. components defined such as Logging or DhcpDdns, so the closing brace would
  223. be followed by a comma and another object definition.</para>
  224. </section>
  225. <section>
  226. <title>Lease Storage</title>
  227. <para>All leases issued by the server are stored in the lease database.
  228. Currently there are three database backends available:
  229. memfile (which is the default backend), MySQL and PostgreSQL.</para>
  230. <section>
  231. <title>Memfile, Basic Storage for Leases</title>
  232. <para>The server is able to store lease data in different repositories. Larger
  233. deployments may elect to store leases in a database. <xref
  234. linkend="database-configuration4"/> describes this option. In typical
  235. smaller deployments though, the server will use a CSV file rather than a database to
  236. store lease information. As well as requiring less administration, an
  237. advantage of using a file for storage is that it
  238. eliminates a dependency on third-party database software.</para>
  239. <para>The configuration of the file backend (Memfile) is controlled through
  240. the Dhcp4/lease-database parameters. The <command>type</command> parameter
  241. is mandatory and it specifies which storage for leases the server should use.
  242. The value of <userinput>"memfile"</userinput> indicates that the file should
  243. be used as the storage. The following list presents the remaining, not mandatory
  244. parameters, which can be used to configure the Memfile backend.
  245. <itemizedlist>
  246. <listitem>
  247. <simpara><command>persist</command>: controls whether the new leases and
  248. updates to existing leases are written to the file. It is strongly
  249. recommended that the value of this parameter is set to
  250. <userinput>true</userinput> at all times, during the server's normal
  251. operation. Not writing leases to disk will mean that if a server is restarted
  252. (e.g. after a power failure), it will not know what addresses have been
  253. assigned. As a result, it may hand out addresses to new clients that are
  254. already in use. The value of <userinput>false</userinput> is mostly useful
  255. for performance testing purposes. The default value of the
  256. <command>persist</command> parameter is <userinput>true</userinput>,
  257. which enables writing lease updates
  258. to the lease file.
  259. </simpara>
  260. </listitem>
  261. <listitem>
  262. <simpara><command>name</command>: specifies an absolute location of the lease
  263. file in which new leases and lease updates will be recorded. The default value
  264. for this parameter is <userinput>"[kea-install-dir]/var/kea/kea-leases4.csv"
  265. </userinput>.</simpara>
  266. </listitem>
  267. <listitem>
  268. <simpara><command>lfc-interval</command>: specifies the interval in seconds, at
  269. which the server (Memfile backend) will perform a lease file cleanup (LFC),
  270. which removes the redundant (historical) information from the lease file
  271. and effectively reduces the lease file size. The cleanup process is described
  272. in more detailed fashion further in this section. The default value of the
  273. <command>lfc-interval</command> is <userinput>0</userinput>, which disables
  274. the LFC.</simpara>
  275. </listitem>
  276. </itemizedlist>
  277. </para>
  278. <para>The example configuration of the Memfile backend is presented below:
  279. <screen>
  280. "Dhcp4": {
  281. "lease-database": {
  282. <userinput>"type": "memfile"</userinput>,
  283. <userinput>"persist": true</userinput>,
  284. <userinput>"name": "/tmp/kea-leases4.csv",</userinput>
  285. <userinput>"lfc-interval": 1800</userinput>
  286. }
  287. }
  288. </screen>
  289. This configuration selects the <filename>/tmp/kea-leases4.csv</filename> as
  290. the storage for lease information and enables persistence (writing lease updates
  291. to this file). It also configures the backend perform the periodic cleanup
  292. of the lease files, executed every 30 minutes.
  293. </para>
  294. <para>It is important to know how the lease file contents are organized
  295. to understand why the periodic lease file cleanup is needed. Every time when
  296. the server updates a lease or creates a new lease for the client, the new
  297. lease information must be recorded in the lease file. For performance reasons,
  298. the server does not supersede the existing client's lease, as it would require
  299. the lookup of the specific lease entry, but simply appends the new lease
  300. information at the end of the lease file. The previous lease entries for the
  301. client are not removed. When the server loads leases from the lease file, e.g.
  302. at the server startup, it assumes that the latest lease entry for the client
  303. is the valid one. The previous entries are discarded. This means that the
  304. server can re-construct the accurate information about the leases even though
  305. there may be many lease entries for each client. However, storing many entries
  306. for each client results in bloated lease file and impairs the performance of
  307. the server's startup and reconfiguration, as it needs to process larger number
  308. of lease entries.
  309. </para>
  310. <para>The lease file cleanup removes all previous entries for each client and
  311. leaves only the latest ones. The interval at which the cleanup is performed
  312. is configurable, and it should be selected according to the frequency of lease
  313. renewals initiated by the clients. The more frequent renewals are, the lesser
  314. value of the <command>lfc-interval</command> should be. Note however, that the
  315. LFC takes time and thus it is possible (although unlikely) that new cleanup
  316. is started while the previous cleanup instance is still running, if the
  317. <command>lfc-interval</command> is too short. The server would recover from
  318. this by skipping the new cleanup when it detects that the previous cleanup
  319. is still in progress. But, this implies that the actual cleanups will be
  320. triggered more rarely than configured. Moreover, triggering a new cleanup
  321. adds an overhead to the server, which will not be able to respond to new
  322. requests for a short period of time when the new cleanup process is spawned.
  323. Therefore, it is recommended that the <command>lfc-interval</command> value
  324. is selected in a way that would allow for completing the cleanup before the
  325. new cleanup is triggered.
  326. </para>
  327. <para>The LFC is performed by a separate process (in background) to avoid
  328. performance impact on the server process. In order to avoid the conflicts
  329. between the two processes both using the same lease files, the LFC process
  330. operates on the copy of the original lease file, rather than on the lease
  331. file used by the server to record lease updates. There are also other files
  332. being created as a side effect of the lease file cleanup. The detailed
  333. description of the LFC is located on the Kea wiki:
  334. <ulink url="http://kea.isc.org/wiki/LFCDesign"/>.
  335. </para>
  336. </section>
  337. <section id="database-configuration4">
  338. <title>Database Configuration</title>
  339. <note>
  340. <para>Database access information must be configured for the DHCPv4 server,
  341. even if it has already been configured for the DHCPv6 server. The servers
  342. store their information independently, so each server can use a separate
  343. database or both servers can use the same database.</para>
  344. </note>
  345. <para>Database configuration is controlled through the Dhcp4/lease-database
  346. parameters. The type of the database must be set to "mysql" or "postgresql",
  347. e.g.
  348. <screen>
  349. "Dhcp4": { "lease-database": { <userinput>"type": "mysql"</userinput>, ... }, ... }
  350. </screen>
  351. Next, the name of the database to hold the leases must be set: this is the
  352. name used when the lease database was created (see <xref linkend="mysql-database-create"/>
  353. or <xref linkend="pgsql-database-create"/>).
  354. <screen>
  355. "Dhcp4": { "lease-database": { <userinput>"name": "<replaceable>database-name</replaceable>" </userinput>, ... }, ... }
  356. </screen>
  357. If the database is located on a different system to the DHCPv4 server, the
  358. database host name must also be specified (although it should be noted that this
  359. configuration may have a severe impact on server performance):
  360. <screen>
  361. "Dhcp4": { "lease-database": { <userinput>"host": <replaceable>remote-host-name</replaceable></userinput>, ... }, ... }
  362. </screen>
  363. The usual state of affairs will be to have the database on the same machine as
  364. the DHCPv4 server. In this case, set the value to the empty string:
  365. <screen>
  366. "Dhcp4": { "lease-database": { <userinput>"host" : ""</userinput>, ... }, ... }
  367. </screen>
  368. </para>
  369. <para>Finally, the credentials of the account under which the server will
  370. access the database should be set:
  371. <screen>
  372. "Dhcp4": { "lease-database": { <userinput>"user": "<replaceable>user-name</replaceable>"</userinput>,
  373. <userinput>"password": "<replaceable>password</replaceable>"</userinput>,
  374. ... },
  375. ... }
  376. </screen>
  377. If there is no password to the account, set the password to the empty string
  378. "". (This is also the default.)</para>
  379. </section>
  380. </section>
  381. <section id="dhcp4-interface-configuration">
  382. <title>Interface configuration</title>
  383. <para>The DHCPv4 server has to be configured to listen on specific network
  384. interfaces. The simplest network interface configuration tells the server to
  385. listen on all available interfaces:
  386. <screen>
  387. "Dhcp4": {
  388. "interfaces-config": {
  389. "interfaces": [ <userinput>"*"</userinput> ]
  390. }
  391. ...
  392. },
  393. </screen>
  394. The asterisk plays the role of a wildcard and means "listen on all interfaces".
  395. However, it is usually a good idea to explicitly specify interface names:
  396. <screen>
  397. "Dhcp4": {
  398. "interfaces-config": {
  399. "interfaces": [ <userinput>"eth1", "eth3"</userinput> ]
  400. },
  401. ...
  402. }
  403. </screen>
  404. </para>
  405. <para>It is possible to use wildcard interface name (asterisk) concurrently
  406. with explicit interface names:
  407. <screen>
  408. "Dhcp4": {
  409. "interfaces-config": {
  410. "interfaces": [ <userinput>"eth1", "eth3", "*"</userinput> ]
  411. },
  412. ...
  413. }
  414. </screen>
  415. It is anticipated that this form of usage will only be used when it is desired to
  416. temporarily override a list of interface names and listen on all interfaces.
  417. </para>
  418. <para>Some deployments of the DHCP servers require that the servers listen
  419. on the interfaces with multiple IPv4 addresses configured. In these situations,
  420. the address to use can be selected by appending an IPv4 address to the interface
  421. name in the following manner:
  422. <screen>
  423. "Dhcp4": {
  424. "interfaces-config": {
  425. "interfaces": [ <userinput>"eth1/10.0.0.1", "eth3/192.0.2.3"</userinput> ]
  426. },
  427. ...
  428. }
  429. </screen>
  430. </para>
  431. <para>If it is desired that the server listens on multiple IPv4 addresses assigned
  432. to the same interface, multiple addresses can be specified for this interface
  433. as in the example below:
  434. <screen>
  435. "Dhcp4": {
  436. "interfaces-config": {
  437. "interfaces": [ <userinput>"eth1/10.0.0.1", "eth1/10.0.0.2"</userinput> ]
  438. },
  439. ...
  440. }
  441. </screen>
  442. </para>
  443. <para>Alternatively, if the server should listen on all addresses for the particular
  444. interface, an interface name without any address should be specified.</para>
  445. <para>Kea supports responding to directly connected clients which don't have
  446. an address configured on the interface yet. This requires that the server
  447. injects the hardware address of the destination into the data link layer
  448. of the packet being sent to the client. The DHCPv4 server utilizes the
  449. raw sockets to achieve this, and builds the entire IP/UDP stack for the
  450. outgoing packets. The down side of raw socket use, however, is that incoming
  451. and outgoing packets bypass the firewalls (e.g. iptables). It is also
  452. troublesome to handle traffic on multiple IPv4 addresses assigned to the
  453. same interface, as raw sockets are bound to the interface and advanced
  454. packet filtering techniques (e.g. using the BPF) have to be used to
  455. receive unicast traffic on the desired addresses assigned to the interface,
  456. rather than capturing whole traffic reaching the interface to which the raw
  457. socket is bound. Therefore, in the deployments where the server doesn't
  458. have to provision the directly connected clients and only receives the
  459. unicast packets from the relay agents, it is desired to configure the
  460. DHCP server to utilize the IP/UDP datagram sockets, instead of raw sockets.
  461. The following configuration demonstrates how this can be achieved:
  462. <screen>
  463. "Dhcp4": {
  464. "interfaces-config": {
  465. "interfaces": [ <userinput>"eth1", "eth3"</userinput> ],
  466. "dhcp-socket-type": "udp"
  467. },
  468. ...
  469. }
  470. </screen>
  471. The <command>dhcp-socket-type</command> specifies that the IP/UDP sockets will
  472. be opened on all interfaces on which the server listens, i.e. "eth1" and
  473. "eth3" in our case. If the <command>dhcp-socket-type</command> is set to
  474. <userinput>raw</userinput>, it configures the server to use raw sockets
  475. instead. If the <command>dhcp-socket-type</command> value is not specified, the
  476. default value <userinput>raw</userinput> is used.
  477. </para>
  478. <para>Using UDP sockets automatically disables the reception of brodcast
  479. packets from directly connected clients. This effectively means that the
  480. UDP sockets can be used for relayed traffic only. When using the raw sockets,
  481. both the traffic from the directly connected clients and the relayed traffic
  482. will be handled. Caution should be taken when configuring the server to open
  483. multiple raw sockets on the interface with several IPv4 addresses assigned.
  484. If the directly connected client sends the message to the brodcast address
  485. all sockets on this link will receive this message and multiple responses
  486. will be sent to the client. Hence, the configuration with multiple IPv4
  487. addresses assigned to the interface should not be used when the directly
  488. connected clients are operating on that link. To use a single address on
  489. such interface, the "interface-name/address" notation should be used.
  490. </para>
  491. <note>
  492. <para>Specifying the value <userinput>raw</userinput> as the socket type,
  493. doesn't guarantee that the raw sockets will be used! The use of raw sockets
  494. to handle the traffic from the directly connected clients is currently
  495. supported on Linux and BSD systems only. If the raw sockets are not
  496. supported on the particular OS, the server will issue a warning and
  497. fall back to use the IP/UDP sockets.</para>
  498. </note>
  499. </section>
  500. <section id="ipv4-subnet-id">
  501. <title>IPv4 Subnet Identifier</title>
  502. <para>
  503. The subnet identifier is a unique number associated with a particular subnet.
  504. In principle, it is used to associate clients' leases with their respective subnets.
  505. When a subnet identifier is not specified for a subnet being configured, it will
  506. be automatically assigned by the configuration mechanism. The identifiers
  507. are assigned from 1 and are monotonically increased for each subsequent
  508. subnet: 1, 2, 3 ....
  509. </para>
  510. <para>
  511. If there are multiple subnets configured with auto-generated identifiers and
  512. one of them is removed, the subnet identifiers may be renumbered. For example:
  513. if there are four subnets and the third is removed the last subnet will be assigned
  514. the identifier that the third subnet had before removal. As a result, the leases
  515. stored in the lease database for subnet 3 are now associated with
  516. subnet 4, something that may have unexpected consequences. It is planned
  517. to implement a mechanism to preserve auto-generated subnet ids in a
  518. future version of Kea. However, the only remedy for this issue
  519. at present is to
  520. manually specify a unique identifier for each subnet.
  521. </para>
  522. <para>
  523. The following configuration will assign the specified subnet
  524. identifier to the newly configured subnet:
  525. <screen>
  526. "Dhcp4": {
  527. "subnet4": [
  528. {
  529. "subnet": "192.0.2.0/24",
  530. <userinput>"id": 1024</userinput>,
  531. ...
  532. }
  533. ]
  534. }
  535. </screen>
  536. This identifier will not change for this subnet unless the "id" parameter is
  537. removed or set to 0. The value of 0 forces auto-generation of the subnet
  538. identifier.
  539. </para>
  540. <!-- @todo: describe whether database needs to be updated after changing
  541. id -->
  542. </section>
  543. <section id="dhcp4-address-config">
  544. <title>Configuration of IPv4 Address Pools</title>
  545. <para>
  546. The essential role of DHCPv4 server is address assignment. The server has to
  547. be configured with at least one subnet and one pool of dynamic addresses to
  548. be managed. For example, assume that the server is connected to a network
  549. segment that uses the 192.0.2.0/24 prefix. The Administrator of that network
  550. has decided that addresses from range 192.0.2.10 to 192.0.2.20 are going to
  551. be managed by the Dhcp4 server. Such a configuration can be achieved in the
  552. following way:
  553. <screen>
  554. "Dhcp4": {
  555. <userinput>"subnet4": [
  556. {
  557. "subnet": "192.0.2.0/24",
  558. "pools": [
  559. { "pool": "192.0.2.10 - 192.0.2.20" }
  560. ],
  561. ...
  562. }
  563. ]</userinput>
  564. }</screen>
  565. Note that subnet is defined as a simple string, but the <command>pools</command> parameter is
  566. actually a list of pools: for this reason, the pools definition is enclosed
  567. in square brackets, even though only one range of addresses is
  568. specified in this example.</para>
  569. <para>Each pool is a structure that contains the parameters
  570. that describe a single pool. Currently there is only one parameter,
  571. <command>pool</command>, which gives the range of addresses
  572. in the pool. Additional parameters will be added in future
  573. releases of Kea.</para>
  574. <para>It is possible to define more than one pool in a subnet: continuing
  575. the previous example, further assume that 192.0.2.64/26 should be also be
  576. managed by the server. It could be written as 192.0.2.64 to
  577. 192.0.2.127. Alternatively, it can be expressed more simply as
  578. 192.0.2.64/26. Both formats are supported by Dhcp4 and can be mixed in the
  579. pool list. For example, one could define the following pools:
  580. <screen>
  581. "Dhcp4": {
  582. "subnet4": [
  583. {
  584. "subnet": "192.0.2.0/24",
  585. <userinput>"pools": [
  586. { "pool": "192.0.2.10-192.0.2.20" },
  587. { "pool": "192.0.2.64/26" }
  588. ]</userinput>,
  589. ...
  590. }
  591. ],
  592. ...
  593. }
  594. </screen>
  595. The number of pools is not limited, but for performance reasons it is recommended to
  596. use as few as possible. White space in pool definitions is ignored, so
  597. spaces before and after the hyphen are optional. They can be used to improve readability.
  598. </para>
  599. <para>
  600. The server may be configured to serve more than one subnet:
  601. <screen>
  602. "Dhcp4": {
  603. "subnet4": [
  604. {
  605. "subnet": "192.0.2.0/24",
  606. "pools": [ { "pool": "192.0.2.1 - 192.0.2.200" } ],
  607. ...
  608. },
  609. {
  610. "subnet": "192.0.3.0/24",
  611. "pools": [ { "pool": "192.0.3.100 - 192.0.3.200" } ],
  612. ...
  613. },
  614. {
  615. "subnet": "192.0.4.0/24",
  616. "pools": [ { "pool": "192.0.4.1 - 192.0.4.254" } ],
  617. ...
  618. }
  619. ]
  620. }
  621. </screen>
  622. </para>
  623. <para>
  624. When configuring a DHCPv4 server using prefix/length notation, please pay
  625. attention to the boundary values. When specifying that the server can use
  626. a given pool, it will also be able to allocate the first (typically network
  627. address) and the last (typically broadcast address) address from that pool.
  628. In the aforementioned example of pool 192.0.3.0/24, both 192.0.3.0 and
  629. 192.0.3.255 addresses may be assigned as well. This may be invalid in some
  630. network configurations. If you want to avoid this, please use the "min-max" notation.
  631. </para>
  632. </section>
  633. <section id="dhcp4-std-options">
  634. <title>Standard DHCPv4 options</title>
  635. <para>
  636. One of the major features of the DHCPv4 server is to provide configuration
  637. options to clients. Although there are several options that require
  638. special behavior, most options are sent by the server only if the client
  639. explicitly requests them. The following example shows how to
  640. configure the addresses of DNS servers, which is one of the most frequently used
  641. options. Options specified in this way are considered global and apply
  642. to all configured subnets.
  643. <screen>
  644. "Dhcp4": {
  645. "option-data": [
  646. {
  647. <userinput>"name": "domain-name-servers",
  648. "code": 6,
  649. "space": "dhcp4",
  650. "csv-format": true,
  651. "data": "192.0.2.1, 192.0.2.2"</userinput>
  652. },
  653. ...
  654. ]
  655. }
  656. </screen>
  657. </para>
  658. <para>
  659. The <command>name</command> parameter specifies the
  660. option name. For a complete list of currently supported names,
  661. see <xref linkend="dhcp4-std-options-list"/> below.
  662. The <command>code</command> parameter specifies the option code, which must match one of the
  663. values from that list. The next line specifies the option space, which must always
  664. be set to "dhcp4" as these are standard DHCPv4 options. For
  665. other option spaces, including custom option spaces, see <xref
  666. linkend="dhcp4-option-spaces"/>. The next line specifies the format in
  667. which the data will be entered: use of CSV (comma
  668. separated values) is recommended. The sixth line gives the actual value to
  669. be sent to clients. Data is specified as normal text, with
  670. values separated by commas if more than one value is
  671. allowed.
  672. </para>
  673. <para>
  674. Options can also be configured as hexadecimal values. If
  675. <command>csv-format</command> is
  676. set to false, option data must be specified as a hexadecimal string. The
  677. following commands configure the domain-name-servers option for all
  678. subnets with the following addresses: 192.0.3.1 and 192.0.3.2.
  679. Note that <command>csv-format</command> is set to false.
  680. <screen>
  681. "Dhcp4": {
  682. "option-data": [
  683. {
  684. <userinput>"name": "domain-name-servers",
  685. "code": 6,
  686. "space": "dhcp4",
  687. "csv-format": false,
  688. "data": "C0 00 03 01 C0 00 03 02"</userinput>
  689. },
  690. ...
  691. ],
  692. ...
  693. }</screen>
  694. </para>
  695. <para>
  696. Most of the parameters in the "option-data" structure are optional and
  697. can be omitted in some circumstances as discussed in the
  698. <xref linkend="dhcp4-option-data-defaults"/>.
  699. </para>
  700. <para>
  701. It is possible to specify or override options on a per-subnet basis. If
  702. clients connected to most of your subnets are expected to get the
  703. same values of a given option, you should use global options: you
  704. can then override specific values for a small number of subnets.
  705. On the other hand, if you use different values in each subnet,
  706. it does not make sense to specify global option values
  707. (Dhcp4/option-data), rather you should set only subnet-specific values
  708. (Dhcp4/subnet[X]/option-data[Y]).
  709. </para>
  710. <para>
  711. The following commands override the global
  712. DNS servers option for a particular subnet, setting a single DNS
  713. server with address 192.0.2.3.
  714. <screen>
  715. "Dhcp4": {
  716. "subnet4": [
  717. {
  718. <userinput>"option-data": [
  719. {
  720. "name": "domain-name-servers",
  721. "code": 6,
  722. "space": "dhcp4",
  723. "csv-format": true,
  724. "data": "192.0.2.3"
  725. },
  726. ...
  727. ]</userinput>,
  728. ...
  729. },
  730. ...
  731. ],
  732. ...
  733. }
  734. </screen>
  735. </para>
  736. <para>
  737. The currently supported standard DHCPv4 options are
  738. listed in <xref linkend="dhcp4-std-options-list"/>
  739. and <xref linkend="dhcp4-std-options-list-part2"/>.
  740. The "Name" and "Code"
  741. are the values that should be used as a name in the option-data
  742. structures. "Type" designates the format of the data: the meanings of
  743. the various types is given in <xref linkend="dhcp-types"/>.
  744. </para>
  745. <para>
  746. Some options are designated as arrays, which means that more than one
  747. value is allowed in such an option. For example the option time-servers
  748. allows the specification of more than one IPv4 address, so allowing
  749. clients to obtain the addresses of multiple NTP servers.
  750. </para>
  751. <!-- @todo: describe record types -->
  752. <para>
  753. The <xref linkend="dhcp4-custom-options"/> describes the configuration
  754. syntax to create custom option definitions (formats). It is generally not
  755. allowed to create custom definitions for standard options, even if the
  756. definition being created matches the actual option format defined in the
  757. RFCs. There is an exception from this rule for standard options for which
  758. Kea does not provide a definition yet. In order to use such options,
  759. a server administrator must create a definition as described in
  760. <xref linkend="dhcp4-custom-options"/> in the 'dhcp4' option space. This
  761. definition should match the option format described in the relevant
  762. RFC but the configuration mechanism will allow any option format as it has
  763. no means to validate the format at the moment.
  764. </para>
  765. <para>
  766. <table frame="all" id="dhcp4-std-options-list">
  767. <title>List of standard DHCPv4 options</title>
  768. <tgroup cols='4'>
  769. <colspec colname='name'/>
  770. <colspec colname='code' align='center'/>
  771. <colspec colname='type' align='center'/>
  772. <colspec colname='array' align='center'/>
  773. <thead>
  774. <row>
  775. <entry>Name</entry>
  776. <entry>Code</entry>
  777. <entry>Type</entry>
  778. <entry>Array?</entry>
  779. </row>
  780. </thead>
  781. <tbody>
  782. <row><entry>subnet-mask</entry><entry>1</entry><entry>ipv4-address</entry><entry>false</entry></row>
  783. <row><entry>time-offset</entry><entry>2</entry><entry>int32</entry><entry>false</entry></row>
  784. <row><entry>routers</entry><entry>3</entry><entry>ipv4-address</entry><entry>true</entry></row>
  785. <row><entry>time-servers</entry><entry>4</entry><entry>ipv4-address</entry><entry>true</entry></row>
  786. <row><entry>name-servers</entry><entry>5</entry><entry>ipv4-address</entry><entry>false</entry></row>
  787. <row><entry>domain-name-servers</entry><entry>6</entry><entry>ipv4-address</entry><entry>true</entry></row>
  788. <row><entry>log-servers</entry><entry>7</entry><entry>ipv4-address</entry><entry>true</entry></row>
  789. <row><entry>cookie-servers</entry><entry>8</entry><entry>ipv4-address</entry><entry>true</entry></row>
  790. <row><entry>lpr-servers</entry><entry>9</entry><entry>ipv4-address</entry><entry>true</entry></row>
  791. <row><entry>impress-servers</entry><entry>10</entry><entry>ipv4-address</entry><entry>true</entry></row>
  792. <row><entry>resource-location-servers</entry><entry>11</entry><entry>ipv4-address</entry><entry>true</entry></row>
  793. <row><entry>host-name</entry><entry>12</entry><entry>string</entry><entry>false</entry></row>
  794. <row><entry>boot-size</entry><entry>13</entry><entry>uint16</entry><entry>false</entry></row>
  795. <row><entry>merit-dump</entry><entry>14</entry><entry>string</entry><entry>false</entry></row>
  796. <row><entry>domain-name</entry><entry>15</entry><entry>fqdn</entry><entry>false</entry></row>
  797. <row><entry>swap-server</entry><entry>16</entry><entry>ipv4-address</entry><entry>false</entry></row>
  798. <row><entry>root-path</entry><entry>17</entry><entry>string</entry><entry>false</entry></row>
  799. <row><entry>extensions-path</entry><entry>18</entry><entry>string</entry><entry>false</entry></row>
  800. <row><entry>ip-forwarding</entry><entry>19</entry><entry>boolean</entry><entry>false</entry></row>
  801. <row><entry>non-local-source-routing</entry><entry>20</entry><entry>boolean</entry><entry>false</entry></row>
  802. <row><entry>policy-filter</entry><entry>21</entry><entry>ipv4-address</entry><entry>true</entry></row>
  803. <row><entry>max-dgram-reassembly</entry><entry>22</entry><entry>uint16</entry><entry>false</entry></row>
  804. <row><entry>default-ip-ttl</entry><entry>23</entry><entry>uint8</entry><entry>false</entry></row>
  805. <row><entry>path-mtu-aging-timeout</entry><entry>24</entry><entry>uint32</entry><entry>false</entry></row>
  806. <row><entry>path-mtu-plateau-table</entry><entry>25</entry><entry>uint16</entry><entry>true</entry></row>
  807. <row><entry>interface-mtu</entry><entry>26</entry><entry>uint16</entry><entry>false</entry></row>
  808. <row><entry>all-subnets-local</entry><entry>27</entry><entry>boolean</entry><entry>false</entry></row>
  809. <row><entry>broadcast-address</entry><entry>28</entry><entry>ipv4-address</entry><entry>false</entry></row>
  810. <row><entry>perform-mask-discovery</entry><entry>29</entry><entry>boolean</entry><entry>false</entry></row>
  811. <row><entry>mask-supplier</entry><entry>30</entry><entry>boolean</entry><entry>false</entry></row>
  812. <row><entry>router-discovery</entry><entry>31</entry><entry>boolean</entry><entry>false</entry></row>
  813. <row><entry>router-solicitation-address</entry><entry>32</entry><entry>ipv4-address</entry><entry>false</entry></row>
  814. <row><entry>static-routes</entry><entry>33</entry><entry>ipv4-address</entry><entry>true</entry></row>
  815. <row><entry>trailer-encapsulation</entry><entry>34</entry><entry>boolean</entry><entry>false</entry></row>
  816. <row><entry>arp-cache-timeout</entry><entry>35</entry><entry>uint32</entry><entry>false</entry></row>
  817. <row><entry>ieee802-3-encapsulation</entry><entry>36</entry><entry>boolean</entry><entry>false</entry></row>
  818. <row><entry>default-tcp-ttl</entry><entry>37</entry><entry>uint8</entry><entry>false</entry></row>
  819. <row><entry>tcp-keepalive-interval</entry><entry>38</entry><entry>uint32</entry><entry>false</entry></row>
  820. <row><entry>tcp-keepalive-garbage</entry><entry>39</entry><entry>boolean</entry><entry>false</entry></row>
  821. </tbody>
  822. </tgroup>
  823. </table>
  824. </para>
  825. <para>
  826. <table frame="all" id="dhcp4-std-options-list-part2">
  827. <title>List of standard DHCPv4 options (continued)</title>
  828. <tgroup cols='4'>
  829. <colspec colname='name'/>
  830. <colspec colname='code'/>
  831. <colspec colname='type'/>
  832. <colspec colname='array'/>
  833. <thead>
  834. <row>
  835. <entry>Name</entry>
  836. <entry>Code</entry>
  837. <entry>Type</entry>
  838. <entry>Array?</entry>
  839. </row>
  840. </thead>
  841. <tbody>
  842. <row><entry>nis-domain</entry><entry>40</entry><entry>string</entry><entry>false</entry></row>
  843. <row><entry>nis-servers</entry><entry>41</entry><entry>ipv4-address</entry><entry>true</entry></row>
  844. <row><entry>ntp-servers</entry><entry>42</entry><entry>ipv4-address</entry><entry>true</entry></row>
  845. <row><entry>vendor-encapsulated-options</entry><entry>43</entry><entry>empty</entry><entry>false</entry></row>
  846. <row><entry>netbios-name-servers</entry><entry>44</entry><entry>ipv4-address</entry><entry>true</entry></row>
  847. <row><entry>netbios-dd-server</entry><entry>45</entry><entry>ipv4-address</entry><entry>true</entry></row>
  848. <row><entry>netbios-node-type</entry><entry>46</entry><entry>uint8</entry><entry>false</entry></row>
  849. <row><entry>netbios-scope</entry><entry>47</entry><entry>string</entry><entry>false</entry></row>
  850. <row><entry>font-servers</entry><entry>48</entry><entry>ipv4-address</entry><entry>true</entry></row>
  851. <row><entry>x-display-manager</entry><entry>49</entry><entry>ipv4-address</entry><entry>true</entry></row>
  852. <row><entry>dhcp-requested-address</entry><entry>50</entry><entry>ipv4-address</entry><entry>false</entry></row>
  853. <!-- Lease time should not be configured by a user.
  854. <row><entry>dhcp-lease-time</entry><entry>51</entry><entry>uint32</entry><entry>false</entry></row>
  855. -->
  856. <row><entry>dhcp-option-overload</entry><entry>52</entry><entry>uint8</entry><entry>false</entry></row>
  857. <!-- Message Type, Server Identifier and Parameter Request List should not be configured by a user.
  858. <row><entry>dhcp-message-type</entry><entry>53</entry><entry>uint8</entry><entry>false</entry></row>
  859. <row><entry>dhcp-server-identifier</entry><entry>54</entry><entry>ipv4-address</entry><entry>false</entry></row>
  860. <row><entry>dhcp-parameter-request-list</entry><entry>55</entry><entry>uint8</entry><entry>true</entry></row>
  861. -->
  862. <row><entry>dhcp-message</entry><entry>56</entry><entry>string</entry><entry>false</entry></row>
  863. <row><entry>dhcp-max-message-size</entry><entry>57</entry><entry>uint16</entry><entry>false</entry></row>
  864. <!-- Renewal and rebinding time should not be configured by a user.
  865. <row><entry>dhcp-renewal-time</entry><entry>58</entry><entry>uint32</entry><entry>false</entry></row>
  866. <row><entry>dhcp-rebinding-time</entry><entry>59</entry><entry>uint32</entry><entry>false</entry></row>
  867. -->
  868. <row><entry>vendor-class-identifier</entry><entry>60</entry><entry>binary</entry><entry>false</entry></row>
  869. <!-- Client identifier should not be configured by a user.
  870. <row><entry>dhcp-client-identifier</entry><entry>61</entry><entry>binary</entry><entry>false</entry></row>
  871. -->
  872. <row><entry>nwip-domain-name</entry><entry>62</entry><entry>string</entry><entry>false</entry></row>
  873. <row><entry>nwip-suboptions</entry><entry>63</entry><entry>binary</entry><entry>false</entry></row>
  874. <row><entry>tftp-server-name</entry><entry>66</entry><entry>string</entry><entry>false</entry></row>
  875. <row><entry>boot-file-name</entry><entry>67</entry><entry>string</entry><entry>false</entry></row>
  876. <row><entry>user-class</entry><entry>77</entry><entry>binary</entry><entry>false</entry></row>
  877. <row><entry>fqdn</entry><entry>81</entry><entry>record</entry><entry>false</entry></row>
  878. <row><entry>dhcp-agent-options</entry><entry>82</entry><entry>empty</entry><entry>false</entry></row>
  879. <row><entry>authenticate</entry><entry>90</entry><entry>binary</entry><entry>false</entry></row>
  880. <row><entry>client-last-transaction-time</entry><entry>91</entry><entry>uint32</entry><entry>false</entry></row>
  881. <row><entry>associated-ip</entry><entry>92</entry><entry>ipv4-address</entry><entry>true</entry></row>
  882. <row><entry>subnet-selection</entry><entry>118</entry><entry>ipv4-address</entry><entry>false</entry></row>
  883. <row><entry>domain-search</entry><entry>119</entry><entry>binary</entry><entry>false</entry></row>
  884. <row><entry>vivco-suboptions</entry><entry>124</entry><entry>binary</entry><entry>false</entry></row>
  885. <row><entry>vivso-suboptions</entry><entry>125</entry><entry>binary</entry><entry>false</entry></row>
  886. </tbody>
  887. </tgroup>
  888. </table>
  889. </para>
  890. <para>
  891. <table frame="all" id="dhcp-types">
  892. <title>List of standard DHCP option types</title>
  893. <tgroup cols='2'>
  894. <colspec colname='name'/>
  895. <colspec colname='meaning'/>
  896. <thead>
  897. <row><entry>Name</entry><entry>Meaning</entry></row>
  898. </thead>
  899. <tbody>
  900. <row><entry>binary</entry><entry>An arbitrary string of bytes, specified as a set of hexadecimal digits.</entry></row>
  901. <row><entry>boolean</entry><entry>Boolean value with allowed values true or false</entry></row>
  902. <row><entry>empty</entry><entry>No value, data is carried in suboptions</entry></row>
  903. <row><entry>fqdn</entry><entry>Fully qualified domain name (e.g. www.example.com)</entry></row>
  904. <row><entry>ipv4-address</entry><entry>IPv4 address in the usual dotted-decimal notation (e.g. 192.0.2.1)</entry></row>
  905. <row><entry>ipv6-address</entry><entry>IPv6 address in the usual colon notation (e.g. 2001:db8::1)</entry></row>
  906. <row><entry>record</entry><entry>Structured data that may comprise any types (except "record" and "empty")</entry></row>
  907. <row><entry>string</entry><entry>Any text</entry></row>
  908. <row><entry>uint8</entry><entry>8 bit unsigned integer with allowed values 0 to 255</entry></row>
  909. <row><entry>uint16</entry><entry>16 bit unsigned integer with allowed values 0 to 65535</entry></row>
  910. <row><entry>uint32</entry><entry>32 bit unsigned integer with allowed values 0 to 4294967295</entry></row>
  911. </tbody>
  912. </tgroup>
  913. </table>
  914. </para>
  915. </section>
  916. <section id="dhcp4-custom-options">
  917. <title>Custom DHCPv4 options</title>
  918. <para>Kea supports custom (non-standard) DHCPv4 options. Assume
  919. that we want to define a new DHCPv4 option called "foo" which
  920. will have code 222 and will convey a single unsigned 32 bit
  921. integer value. We can define such an option by using the
  922. following entry in the configuration file:
  923. <screen>
  924. "Dhcp4": {
  925. "option-def": [
  926. {
  927. <userinput>"name": "foo",
  928. "code": 222,
  929. "type": "uint32",
  930. "array": false,
  931. "record-types": "",
  932. "space": "dhcp4",
  933. "encapsulate": ""</userinput>
  934. }, ...
  935. ],
  936. ...
  937. }
  938. </screen>
  939. The <command>false</command> value of the <command>array</command>
  940. parameter determines that the option does NOT comprise an array of
  941. "uint32" values but rather a single value. Two other parameters have been
  942. left blank: <command>record-types</command> and
  943. <command>encapsulate</command>. The former specifies the comma separated
  944. list of option data fields if the option comprises a record of data
  945. fields. This should be non-empty if the <command>type</command> is set to
  946. "record". Otherwise it must be left blank. The latter parameter specifies
  947. the name of the option space being encapsulated by the particular
  948. option. If the particular option does not encapsulate any option space it
  949. should be left blank. Note that the above set of comments define the
  950. format of the new option and do not set its values.
  951. </para>
  952. <note>
  953. <para>
  954. In the current release the default values are not propagated to the
  955. parser when the new configuration is being set. Therefore, all
  956. parameters must be specified at all times, even if their values are
  957. left blank.
  958. </para>
  959. </note>
  960. <para>Once the new option format is defined, its value is set
  961. in the same way as for a standard option. For example the following
  962. commands set a global value that applies to all subnets.
  963. <screen>
  964. "Dhcp4": {
  965. "option-data": [
  966. {
  967. <userinput>"name": "foo",
  968. "code": 222,
  969. "space": "dhcp4",
  970. "csv-format": true,
  971. "data": "12345"</userinput>
  972. }, ...
  973. ],
  974. ...
  975. }
  976. </screen>
  977. </para>
  978. <para>New options can take more complex forms than simple use of
  979. primitives (uint8, string, ipv4-address etc): it is possible to
  980. define an option comprising a number of existing primitives.
  981. Assume we want to define a new option that will consist of
  982. an IPv4 address, followed by an unsigned 16 bit integer, followed by
  983. a boolean value, followed by a text string. Such an option could
  984. be defined in the following way:
  985. <screen>
  986. "Dhcp4": {
  987. "option-def": [
  988. {
  989. <userinput>"name": "bar",
  990. "code": 223,
  991. "space": "dhcp4",
  992. "type": "record",
  993. "array": false,
  994. "record-types": "ipv4-address, uint16, boolean, string",
  995. "encapsulate": ""</userinput>
  996. }, ...
  997. ],
  998. ...
  999. }
  1000. </screen>
  1001. The <command>type</command> is set to "record" to indicate that the option contains
  1002. multiple values of different types. These types are given as a comma-separated
  1003. list in the <command>record-types</command> field and should be those listed in <xref linkend="dhcp-types"/>.
  1004. </para>
  1005. <para>
  1006. The values of the option are set as follows:
  1007. <screen>
  1008. "Dhcp4": {
  1009. "option-data": [
  1010. {
  1011. <userinput>"name": "bar",
  1012. "space": "dhcp4",
  1013. "code": 223,
  1014. "csv-format": true,
  1015. "data": "192.0.2.100, 123, true, Hello World"</userinput>
  1016. }
  1017. ],
  1018. ...
  1019. }</screen>
  1020. <command>csv-format</command> is set to <command>true</command> to indicate
  1021. that the <command>data</command> field comprises a command-separated list
  1022. of values. The values in the <command>data</command> must correspond to
  1023. the types set in the <command>record-types</command> field of the option
  1024. definition.
  1025. </para>
  1026. <note>
  1027. <para>In the general case, boolean values are specified as <command>true</command> or
  1028. <command>false</command>, without quotes. Some specific boolean parameters may
  1029. accept also <command>"true"</command>, <command>"false"</command>,
  1030. <command>0</command>, <command>1</command>, <command>"0"</command> and
  1031. <command>"1"</command>. Future Kea versions will accept all those values
  1032. for all boolean parameters.</para>
  1033. </note>
  1034. </section>
  1035. <section id="dhcp4-vendor-opts">
  1036. <title>DHCPv4 Vendor Specific Options</title>
  1037. <para>
  1038. Currently there are three option spaces defined: "dhcp4" (used by the DHCPv4 daemon)
  1039. and "dhcp6" (for the DHCPv6 daemon); there is also "vendor-encapsulated-options-space",
  1040. which is empty by default, but options
  1041. can be defined in it. Those options are called vendor-specific
  1042. information options. The following examples show how to define
  1043. an option "foo" with code 1 that consists of an IPv4 address, an
  1044. unsigned 16 bit integer and a string. The "foo" option is conveyed
  1045. in a vendor specific information option.
  1046. </para>
  1047. <para>
  1048. The first step is to define the format of the option:
  1049. <screen>
  1050. "Dhcp4": {
  1051. "option-def": [
  1052. {
  1053. <userinput>"name": "foo",
  1054. "code": 1,
  1055. "space": "vendor-encapsulated-options-space",
  1056. "type": "record",
  1057. "array": false,
  1058. "record-types": "ipv4-address, uint16, string",
  1059. "encapsulates": ""</userinput>
  1060. }
  1061. ],
  1062. ...
  1063. }</screen>
  1064. (Note that the option space is set to "vendor-encapsulated-options-space".)
  1065. Once the option format is defined, the next step is to define actual values
  1066. for that option:
  1067. <screen>
  1068. "Dhcp4": {
  1069. "option-data": [
  1070. {
  1071. <userinput>"name": "foo",
  1072. "space": "vendor-encapsulated-options-space",
  1073. "code": 1,
  1074. "csv-format": true,
  1075. "data": "192.0.2.3, 123, Hello World"</userinput>
  1076. }
  1077. ],
  1078. ...
  1079. }</screen>
  1080. We also set up a dummy value for "vendor-encapsulated-options", the option that conveys our sub-option "foo".
  1081. This is required else the option will not be included in messages sent to the client.
  1082. <screen>
  1083. "Dhcp4": {
  1084. "option-data": [
  1085. {
  1086. <userinput>"name": "vendor-encapsulated-options",
  1087. "space": "dhcp4",
  1088. "code": 43,
  1089. "csv-format": false,
  1090. "data": ""</userinput>
  1091. }
  1092. ],
  1093. ...
  1094. }</screen>
  1095. </para>
  1096. <note>
  1097. <para>
  1098. With this version of Kea, the "vendor-encapsulated-options" option
  1099. must be specified in the configuration although it has no configurable
  1100. parameters. If it is not specified, the server will assume that it is
  1101. not configured and will not send it to a client. In the future there
  1102. will be no need to include this option in the configuration.
  1103. </para>
  1104. </note>
  1105. </section>
  1106. <section id="dhcp4-option-spaces">
  1107. <title>Nested DHCPv4 Options (Custom Option Spaces)</title>
  1108. <para>It is sometimes useful to define completely new option
  1109. space. This is the case when user creates new option in the
  1110. standard option space ("dhcp4 or "dhcp6") and wants this option
  1111. to convey sub-options. Since they are in a separate space,
  1112. sub-option codes will have a separate numbering scheme and may
  1113. overlap with the codes of standard options.
  1114. </para>
  1115. <para>Note that creation of a new option space when defining
  1116. sub-options for a standard option is not required, because it is
  1117. created by default if the standard option is meant to convey any
  1118. sub-options (see <xref linkend="dhcp4-vendor-opts"/>).
  1119. </para>
  1120. <para>
  1121. Assume that we want to have a DHCPv4 option called "container" with
  1122. code 222 that conveys two sub-options with codes 1 and 2.
  1123. First we need to define the new sub-options:
  1124. <screen>
  1125. "Dhcp4": {
  1126. "option-def": [
  1127. {
  1128. <userinput>"name": "subopt1",
  1129. "code": 1,
  1130. "space": "isc",
  1131. "type": "ipv4-address",
  1132. "record-types": "",
  1133. "array": false,
  1134. "encapsulate ""
  1135. },
  1136. {
  1137. "name": "subopt2",
  1138. "code": 2,
  1139. "space": "isc",
  1140. "type": "string",
  1141. "record-types": "",
  1142. "array": false,
  1143. "encapsulate": ""</userinput>
  1144. }
  1145. ],
  1146. ...
  1147. }</screen>
  1148. Note that we have defined the options to belong to a new option space
  1149. (in this case, "isc").
  1150. </para>
  1151. <para>
  1152. The next step is to define a regular DHCPv4 option with our desired
  1153. code and specify that it should include options from the new option space:
  1154. <screen>
  1155. "Dhcp4": {
  1156. "option-def": [
  1157. ...,
  1158. {
  1159. <userinput>"name": "container",
  1160. "code": 222,
  1161. "space": "dhcp4",
  1162. "type": "empty",
  1163. "array": false,
  1164. "record-types": "",
  1165. "encapsulate": "isc"</userinput>
  1166. }
  1167. ],
  1168. ...
  1169. }</screen>
  1170. The name of the option space in which the sub-options are defined
  1171. is set in the "encapsulate" field. The "type" field is set to "empty"
  1172. to indicate that this option does not carry any data other than
  1173. sub-options.
  1174. </para>
  1175. <para>
  1176. Finally, we can set values for the new options:
  1177. <screen>
  1178. "Dhcp4": {
  1179. "option-data": [
  1180. {
  1181. <userinput>"name": "subopt1",
  1182. "space": "isc",
  1183. "code": 1,
  1184. "csv-format": true,
  1185. "data": "192.0.2.3"</userinput>
  1186. },
  1187. }
  1188. <userinput>"name": "subopt2",
  1189. "space": "isc",
  1190. "code": 2,
  1191. "csv-format": true,
  1192. "data": "Hello world"</userinput>
  1193. },
  1194. {
  1195. <userinput>"name": "container",
  1196. "space": "dhcp4",
  1197. "code": 222,
  1198. "csv-format": true,
  1199. "data": ""</userinput>
  1200. }
  1201. ],
  1202. ...
  1203. }
  1204. </screen>
  1205. Even though the "container" option does not carry any data except
  1206. sub-options, the "data" field must be explicitly set to an empty value.
  1207. This is required because in the current version of Kea, the
  1208. default configuration values are not propagated to the configuration parsers:
  1209. if the "data" is not set the parser will assume that this
  1210. parameter is not specified and an error will be reported.
  1211. </para>
  1212. <para>Note that it is possible to create an option which carries some data
  1213. in addition to the sub-options defined in the encapsulated option space. For example,
  1214. if the "container" option from the previous example was required to carry an uint16
  1215. value as well as the sub-options, the "type" value would have to be set to "uint16" in
  1216. the option definition. (Such an option would then have the following
  1217. data structure: DHCP header, uint16 value, sub-options.) The value specified
  1218. with the "data" parameter &mdash; which should be a valid integer enclosed in quotes,
  1219. e.g. "123" &mdash; would then be assigned to the uint16 field in the "container" option.
  1220. </para>
  1221. </section>
  1222. <section id="dhcp4-option-data-defaults">
  1223. <title>Unspecified parameters for DHCPv4 option configuration</title>
  1224. <para>In many cases it is not required to specify all parameters for
  1225. an option configuration and the default values may be used. However, it is
  1226. important to understand the implications of not specifing some of them
  1227. as it may result in configuration errors. The list below explains
  1228. the behavior of the server when a particular parameter is not explicitly
  1229. specified:
  1230. <itemizedlist>
  1231. <listitem>
  1232. <simpara><command>name</command> - the server requires an option name or
  1233. option code to identify an option. If this parameter is unspecified, the
  1234. option code must be specified.
  1235. </simpara>
  1236. </listitem>
  1237. <listitem>
  1238. <simpara><command>code</command> - the server requires an option name or
  1239. option code to identify an option. This parameter may be left unspecified if
  1240. the <command>name</command> parameter is specified. However, this also
  1241. requires that the particular option has its definition (it is either a
  1242. standard option or an administrator created a definition for the option
  1243. using an 'option-def' structure), as the option definition associates an
  1244. option with a particular name. It is possible to configure an option
  1245. for which there is no definition (unspecified option format).
  1246. Configuration of such options requires the use of option code.
  1247. </simpara>
  1248. </listitem>
  1249. <listitem>
  1250. <simpara><command>space</command> - if the option space is unspecified it
  1251. will default to 'dhcp4' which is an option space holding DHCPv4 standard
  1252. options.
  1253. </simpara>
  1254. </listitem>
  1255. <listitem>
  1256. <simpara><command>data</command> - if the option data is unspecified it
  1257. defaults to an empty value. The empty value is mostly used for the
  1258. options which have no payload (boolean options), but it is legal to specify
  1259. empty values for some options which carry variable length data and which
  1260. spec allows for the length of 0. For such options, the data parameter
  1261. may be omitted in the configuration.</simpara>
  1262. </listitem>
  1263. <listitem>
  1264. <simpara><command>csv-format</command> - if this value is not specified
  1265. and the definition for the particular option exists, the server will assume
  1266. that the option data is specified as a list of comma separated values to be
  1267. assigned to individual fields of the DHCP option. If the definition
  1268. does not exist for this option, the server will assume that the data
  1269. parameter contains the option payload in the binary format (represented
  1270. as a string of hexadecimal digits). Note that not specifying this
  1271. parameter doesn't imply that it defaults to a fixed value, but
  1272. the configuration data interpretation also depends on the presence
  1273. of the option definition. An administrator must be aware if the
  1274. definition for the particular option exists when this parameter
  1275. is not specified. It is generally recommended to not specify this
  1276. parameter only for the options for which the definition exists, e.g.
  1277. standard options. Setting <command>csv-format</command> to an explicit
  1278. value will cause the server to strictly check the format of the option
  1279. data specified.
  1280. </simpara>
  1281. </listitem>
  1282. </itemizedlist>
  1283. </para>
  1284. </section>
  1285. <section id="dhcp4-stateless-configuration">
  1286. <title>Stateless Configuration of DHCPv4 clients</title>
  1287. <para>The DHCPv4 server supports the stateless client configuration whereby the
  1288. client has an IP address configured (e.g. using manual configuration) and only
  1289. contacts the server to obtain other configuration parameters, e.g. DNS servers' addresses.
  1290. In order to obtain the stateless configuration parameters the client sends the
  1291. DHCPINFORM message to the server with the "ciaddr" set to the address that the
  1292. client is currently using. The server unicasts the DHCPACK message to the
  1293. client that includes the stateless configuration ("yiaddr" not set).
  1294. </para>
  1295. <para>The server will respond to the DHCPINFORM when the client is associated
  1296. with the particular subnet defined in the server's configuration. The example
  1297. subnet configuration will look like this:
  1298. <screen>
  1299. "Dhcp4": {
  1300. "subnet4": [
  1301. {
  1302. "subnet": "192.0.2.0/24"
  1303. "option-data": [ {
  1304. "name": "domain-name-servers",
  1305. "code": 6,
  1306. "data": "192.0.2.200,192.0.2.201",
  1307. "csv-format": true,
  1308. "space": "dhcp4"
  1309. } ]
  1310. }
  1311. ]
  1312. }</screen>
  1313. </para>
  1314. <para>This subnet specifies the single option which will be included in
  1315. the DHCPACK message to the client in response to DHCPINFORM. Note that
  1316. the subnet definition does not require the address pool configuration
  1317. if it will be used solely for the stateless configuration.
  1318. </para>
  1319. <para>This server will associate the subnet with the client if one of
  1320. the following conditions is met:
  1321. <itemizedlist>
  1322. <listitem>
  1323. <simpara>The DHCPINFORM is relayed and the giaddr matches the
  1324. configured subnet.</simpara>
  1325. </listitem>
  1326. <listitem>
  1327. <simpara>The DHCPINFORM is unicast from the client and the ciaddr
  1328. matches the configured subnet.</simpara>
  1329. </listitem>
  1330. <listitem>
  1331. <simpara>The DHCPINFORM is unicast from the client, the ciaddr is
  1332. not set but the source address of the IP packet matches the
  1333. configured subnet.</simpara>
  1334. </listitem>
  1335. <listitem>
  1336. <simpara>The DHCPINFORM is not relayed and the IP address on the
  1337. interface on which the message is received matches the configured
  1338. subnet.</simpara>
  1339. </listitem>
  1340. </itemizedlist>
  1341. </para>
  1342. </section>
  1343. <section id="dhcp4-client-classifier">
  1344. <title>Client Classification in DHCPv4</title>
  1345. <note>
  1346. <para>
  1347. The DHCPv4 server has been extended to support limited client classification.
  1348. Although the current capability is modest, it is expected to be expanded
  1349. in the future. However, it is envisaged that the majority of client classification
  1350. extensions will be using hooks extensions.
  1351. </para>
  1352. </note>
  1353. <para>In certain cases it is useful to differentiate between different
  1354. types of clients and treat them differently. The process of doing
  1355. classification is conducted in two steps. The first step is to assess an
  1356. incoming packet and assign it to zero or more classes. This classification
  1357. is currently simple, but is expected to grow in capability soon. Currently
  1358. the server checks whether an incoming packet includes the vendor class identifier
  1359. option (60). If it does, the content of that option is prepended with
  1360. &quot;VENDOR_CLASS_&quot; then it is interpreted as a class. For example,
  1361. modern cable modems will send this option with value &quot;docsis3.0&quot;
  1362. and as a result the packet will belong to class &quot;VENDOR_CLASS_docsis3.0&quot;.
  1363. </para>
  1364. <para>It is envisaged that the client classification will be used for changing the
  1365. behavior of almost any part of the DHCP message processing, including assigning
  1366. leases from different pools, assigning different options (or different values of
  1367. the same options) etc. For now, there are only two mechanisms that are taking
  1368. advantage of client classification: specific processing for cable modems and
  1369. subnet selection.</para>
  1370. <para>
  1371. For clients that belong to the VENDOR_CLASS_docsis3.0 class, the siaddr
  1372. field is set to the value of next-server (if specified in a subnet). If
  1373. there is a boot-file-name option specified, its value is also set in the
  1374. file field in the DHCPv4 packet. For eRouter1.0 class, the siaddr is
  1375. always set to 0.0.0.0. That capability is expected to be moved to
  1376. an external hook library that will be dedicated to cable modems.
  1377. </para>
  1378. <para>
  1379. Kea can be instructed to limit access to given subnets based on class information.
  1380. This is particularly useful for cases where two types of devices share the
  1381. same link and are expected to be served from two different subnets. The
  1382. primary use case for such a scenario is cable networks. There are two
  1383. classes of devices: the cable modem itself, which should be handed a lease
  1384. from subnet A and all other devices behind the modem that should get a lease
  1385. from subnet B. That segregation is essential to prevent overly curious
  1386. users from playing with their cable modems. For details on how to set up
  1387. class restrictions on subnets, see <xref linkend="dhcp4-subnet-class"/>.
  1388. </para>
  1389. <section id="dhcp4-subnet-class">
  1390. <title>Limiting Access to IPv4 Subnet to Certain Classes</title>
  1391. <para>
  1392. In certain cases it beneficial to restrict access to certain subnets
  1393. only to clients that belong to a given subnet. For details on client
  1394. classes, see <xref linkend="dhcp4-client-classifier"/>. This is an
  1395. extension of a previous example from <xref linkend="dhcp4-address-config"/>.
  1396. Let's assume that the server is connected to a network segment that uses
  1397. the 192.0.2.0/24 prefix. The Administrator of that network has decided
  1398. that addresses from range 192.0.2.10 to 192.0.2.20 are going to be
  1399. managed by the Dhcp4 server. Only clients belonging to client class
  1400. VENDOR_CLASS_docsis3.0 are allowed to use this subnet. Such a
  1401. configuration can be achieved in the following way:
  1402. <screen>
  1403. "Dhcp4": {
  1404. "subnet4": [
  1405. {
  1406. <userinput>"subnet": "192.0.2.0/24",
  1407. "pools": [ { "pool": "192.0.2.10 - 192.0.2.20" } ],
  1408. "client-class": "VENDOR_CLASS_docsis3.0"</userinput>
  1409. }
  1410. ],
  1411. ...
  1412. }</screen>
  1413. </para>
  1414. <para>
  1415. Care should be taken with client classification as it is easy for
  1416. clients that do not meet class criteria to be denied any service altogether.
  1417. </para>
  1418. </section>
  1419. </section>
  1420. <section id="dhcp4-ddns-config">
  1421. <title>Configuring DHCPv4 for DDNS</title>
  1422. <para>
  1423. As mentioned earlier, kea-dhcp4 can be configured to generate requests to the
  1424. DHCP-DDNS server (referred to here as "D2" ) to update DNS entries. These requests are known as
  1425. NameChangeRequests or NCRs. Each NCR contains the following information:
  1426. <orderedlist>
  1427. <listitem><para>
  1428. Whether it is a request to add (update) or remove DNS entries
  1429. </para></listitem>
  1430. <listitem><para>
  1431. Whether the change requests forward DNS updates (A records), reverse
  1432. DNS updates (PTR records), or both.
  1433. </para></listitem>
  1434. <listitem><para>
  1435. The FQDN, lease address, and DHCID
  1436. </para></listitem>
  1437. </orderedlist>
  1438. The parameters for controlling the generation of NCRs for submission to D2
  1439. are contained in the <command>dhcp-ddns</command> section of the kea-dhcp4 server
  1440. configuration. The mandatory parameters for the DHCP DDNS configuration
  1441. are <command>enable-updates</command> which is unconditionally
  1442. required, and <command>qualifying-suffix</command> which has no
  1443. default value and is required when <command>enable-updates</command>
  1444. is set to <command>true</command>.
  1445. The two (disabled and enabled) minimal DHCP DDNS configurations are:
  1446. <screen>
  1447. "Dhcp4": {
  1448. "dhcp-ddns": {
  1449. <userinput>"enable-updates": false</userinput>
  1450. },
  1451. ...
  1452. }
  1453. </screen>
  1454. and for example:
  1455. <screen>
  1456. "Dhcp4": {
  1457. "dhcp-ddns": {
  1458. <userinput>"enable-updates": true,
  1459. "qualifying-suffix": "example."</userinput>
  1460. },
  1461. ...
  1462. }
  1463. </screen>
  1464. The default values for the "dhcp-ddns" section are as follows:
  1465. <itemizedlist>
  1466. <listitem><simpara>
  1467. <command>"server-ip": "127.0.0.1"</command>
  1468. </simpara></listitem>
  1469. <listitem><simpara>
  1470. <command>"server-port": 53001</command>
  1471. </simpara></listitem>
  1472. <listitem><simpara>
  1473. <command>"sender-ip": ""</command>
  1474. </simpara></listitem>
  1475. <listitem><simpara>
  1476. <command>"sender-port": 0</command>
  1477. </simpara></listitem>
  1478. <listitem><simpara>
  1479. <command>"max-queue-size": 1024</command>
  1480. </simpara></listitem>
  1481. <listitem><simpara>
  1482. <command>"ncr-protocol": "UDP"</command>
  1483. </simpara></listitem>
  1484. <listitem><simpara>
  1485. <command>"ncr-format": "JSON"</command>
  1486. </simpara></listitem>
  1487. <listitem><simpara>
  1488. <command>"override-no-update": false</command>
  1489. </simpara></listitem>
  1490. <listitem><simpara>
  1491. <command>"override-client-update": false</command>
  1492. </simpara></listitem>
  1493. <listitem><simpara>
  1494. <command>"replace-client-name": false</command>
  1495. </simpara></listitem>
  1496. <listitem><simpara>
  1497. <command>"generated-prefix": "myhost"</command>
  1498. </simpara></listitem>
  1499. </itemizedlist>
  1500. </para>
  1501. <section id="dhcpv4-d2-io-config">
  1502. <title>DHCP-DDNS Server Connectivity</title>
  1503. <para>
  1504. In order for NCRs to reach the D2 server, kea-dhcp4 must be able
  1505. to communicate with it. kea-dhcp4 uses the following configuration
  1506. parameters to control how it communications with D2:
  1507. <itemizedlist>
  1508. <listitem><simpara>
  1509. <command>enable-updates</command> - determines whether or not kea-dhcp4 will
  1510. generate NCRs. By default, this value is false hence DDNS updates are
  1511. disabled. To enable DDNS updates set this value to true:
  1512. </simpara></listitem>
  1513. <listitem><simpara>
  1514. <command>server-ip</command> - IP address on which D2 listens for requests. The default is
  1515. the local loopback interface at address 127.0.0.1. You may specify
  1516. either an IPv4 or IPv6 address.
  1517. </simpara></listitem>
  1518. <listitem><simpara>
  1519. <command>server-port</command> - port on which D2 listens for requests. The default value
  1520. is 53001.
  1521. </simpara></listitem>
  1522. <listitem><simpara>
  1523. <command>sender-ip</command> - IP address which kea-dhcp4 should use to send requests to D2.
  1524. The default value is blank which instructs kea-dhcp4 to select a suitable
  1525. address.
  1526. </simpara></listitem>
  1527. <listitem><simpara>
  1528. <command>sender-port</command> - port which kea-dhcp4 should use to send requests to D2. The
  1529. default value of 0 instructs kea-dhcp4 to select a suitable port.
  1530. </simpara></listitem>
  1531. <listitem><simpara>
  1532. <command>max-queue-size</command> - maximum number of requests allowed to queue waiting to
  1533. be sent to D2. This value guards against requests accumulating
  1534. uncontrollably if they are being generated faster than they can be
  1535. delivered. If the number of requests queued for transmission reaches
  1536. this value, DDNS updating will be turned off until the queue backlog has
  1537. been sufficiently reduced. The intention is to allow the kea-dhcp4 server to
  1538. continue lease operations without running the risk that its memory usage
  1539. grows without limit. The default value is 1024.
  1540. </simpara></listitem>
  1541. <listitem><simpara>
  1542. <command>ncr-format</command> - socket protocol use when sending requests to D2. Currently
  1543. only UDP is supported. TCP may be available in an upcoming release.
  1544. </simpara></listitem>
  1545. <listitem><simpara>
  1546. <command>ncr-protocol</command> - packet format to use when sending requests to D2.
  1547. Currently only JSON format is supported. Other formats may be available
  1548. in future releases.
  1549. </simpara></listitem>
  1550. </itemizedlist>
  1551. By default, kea-dhcp-ddns is assumed to be running on the same machine as kea-dhcp4, and
  1552. all of the default values mentioned above should be sufficient.
  1553. If, however, D2 has been configured to listen on a different address or
  1554. port, these values must be altered accordingly. For example, if D2 has been
  1555. configured to listen on 192.168.1.10 port 900, the following configuration
  1556. would be required:
  1557. <screen>
  1558. "Dhcp4": {
  1559. "dhcp-ddns": {
  1560. <userinput>"server-ip": "192.168.1.10",
  1561. "server-port": 900</userinput>,
  1562. ...
  1563. },
  1564. ...
  1565. }
  1566. </screen>
  1567. </para>
  1568. </section>
  1569. <section id="dhcpv4-d2-rules-config">
  1570. <title>When Does the kea-dhcp4 Server Generate DDNS Requests?</title>
  1571. <para>kea-dhcp4 follows the behavior prescribed for DHCP servers in
  1572. <ulink url="http://tools.ietf.org/html/rfc4702">RFC 4702</ulink>.
  1573. It is important to keep in mind that kea-dhcp4 provides the initial decision
  1574. making of when and what to update and forwards that information to D2 in
  1575. the form of NCRs. Carrying out the actual DNS updates and dealing with
  1576. such things as conflict resolution are within the purview of D2 itself (<xref linkend="dhcp-ddns-server"/>).
  1577. This section describes when kea-dhcp4 will generate NCRs and the
  1578. configuration parameters that can be used to influence this decision.
  1579. It assumes that the "enable-updates" parameter is true.
  1580. </para>
  1581. <para>
  1582. In general, kea-dhcp4 will generate DDNS update requests when:
  1583. <orderedlist>
  1584. <listitem><para>
  1585. A new lease is granted in response to a DHCP REQUEST
  1586. </para></listitem>
  1587. <listitem><para>
  1588. An existing lease is renewed but the FQDN associated with it has
  1589. changed.
  1590. </para></listitem>
  1591. <listitem><para>
  1592. An existing lease is released in response to a DHCP RELEASE
  1593. </para></listitem>
  1594. </orderedlist>
  1595. In the second case, lease renewal, two DDNS requests will be issued: one
  1596. request to remove entries for the previous FQDN and a second request to
  1597. add entries for the new FQDN. In the last case, a lease release, a
  1598. single DDNS request to remove its entries will be made. The decision
  1599. making involved when granting a new lease (the first case) is more
  1600. involved and is discussed next.
  1601. </para>
  1602. <para>
  1603. When a new lease is granted, kea-dhcp4 will generate a DDNS
  1604. update request if the DHCP REQUEST contains either the FQDN option
  1605. (code 81) or the Host Name option (code 12). If both are present,
  1606. the server will use the FQDN option. By default kea-dhcp4
  1607. will respect the FQDN N and S flags specified by the client as shown
  1608. in the following table:
  1609. </para>
  1610. <table id="fqdn-flag-table">
  1611. <title>Default FQDN Flag Behavior</title>
  1612. <tgroup cols='4' align='left'>
  1613. <colspec colname='cflags'/>
  1614. <colspec colname='meaning'/>
  1615. <colspec colname='response'/>
  1616. <colspec colname='sflags'/>
  1617. <thead>
  1618. <row>
  1619. <entry>Client Flags:N-S</entry>
  1620. <entry>Client Intent</entry>
  1621. <entry>Server Response</entry>
  1622. <entry>Server Flags:N-S-O</entry>
  1623. </row>
  1624. </thead>
  1625. <tbody>
  1626. <row>
  1627. <entry>0-0</entry>
  1628. <entry>
  1629. Client wants to do forward updates, server should do reverse updates
  1630. </entry>
  1631. <entry>Server generates reverse-only request</entry>
  1632. <entry>1-0-0</entry>
  1633. </row>
  1634. <row>
  1635. <entry>0-1</entry>
  1636. <entry>Server should do both forward and reverse updates</entry>
  1637. <entry>Server generates request to update both directions</entry>
  1638. <entry>0-1-0</entry>
  1639. </row>
  1640. <row>
  1641. <entry>1-0</entry>
  1642. <entry>Client wants no updates done</entry>
  1643. <entry>Server does not generate a request</entry>
  1644. <entry>1-0-0</entry>
  1645. </row>
  1646. </tbody>
  1647. </tgroup>
  1648. </table>
  1649. <para>
  1650. The first row in the table above represents "client delegation". Here
  1651. the DHCP client states that it intends to do the forward DNS updates and
  1652. the server should do the reverse updates. By default, kea-dhcp4 will honor
  1653. the client's wishes and generate a DDNS request to the DHCP-DDNS server to update only
  1654. reverse DNS data. The parameter <command>override-client-update</command> can be used
  1655. to instruct the server to override client delegation requests. When
  1656. this parameter is true, kea-dhcp4 will disregard requests for client
  1657. delegation and generate a DDNS request to update both forward and
  1658. reverse DNS data. In this case, the N-S-O flags in the server's
  1659. response to the client will be 0-1-1 respectively.
  1660. </para>
  1661. <para>
  1662. (Note that the flag combination N=1, S=1 is prohibited according to
  1663. <ulink url="http://tools.ietf.org/html/rfc4702">RFC 4702</ulink>. If such a combination is received from the client, the packet
  1664. will be dropped by kea-dhcp4.)
  1665. </para>
  1666. <para>
  1667. To override client delegation, set the following values in your configuration
  1668. file:
  1669. </para>
  1670. <screen>
  1671. "Dhcp4": {
  1672. "dhcp-ddns": {
  1673. <userinput>"override-client-update": true</userinput>,
  1674. ...
  1675. },
  1676. ...
  1677. }
  1678. </screen>
  1679. <para>
  1680. The third row in the table above describes the case in which the client
  1681. requests that no DNS updates be done. The parameter, <command>override-no-update</command>,
  1682. can be used to instruct the server to disregard the client's wishes. When
  1683. this parameter is true, kea-dhcp4 will generate a DDNS update request to kea-dhcp-ddns
  1684. even if the client requests that no updates be done. The N-S-O flags in the
  1685. server's response to the client will be 0-1-1.
  1686. </para>
  1687. <para>
  1688. To override client delegation, the following values should be set in your configuration:
  1689. </para>
  1690. <screen>
  1691. "Dhcp4": {
  1692. "dhcp-ddns": {
  1693. <userinput>"override-no-update": true</userinput>,
  1694. ...
  1695. },
  1696. ...
  1697. }
  1698. </screen>
  1699. <para>
  1700. kea-dhcp4 will always generate DDNS update requests if the client request
  1701. only contains the Host Name option. In addition it will include an FQDN
  1702. option in the response to the client with the FQDN N-S-O flags set to
  1703. 0-1-0 respectively. The domain name portion of the FQDN option will be
  1704. the name submitted to D2 in the DDNS update request.
  1705. </para>
  1706. </section>
  1707. <section id="dhcpv4-fqdn-name-generation">
  1708. <title>kea-dhcp4 name generation for DDNS update requests</title>
  1709. <para>Each NameChangeRequest must of course include the fully qualified domain
  1710. name whose DNS entries are to be affected. kea-dhcp4 can be configured to
  1711. supply a portion or all of that name based upon what it receives from
  1712. the client in the DHCP REQUEST.</para>
  1713. <para>
  1714. The rules for determining the FQDN option are as follows:
  1715. <orderedlist>
  1716. <listitem><para>
  1717. If configured to do, so ignore the REQUEST contents and generate a
  1718. FQDN using a configurable prefix and suffix.
  1719. </para></listitem>
  1720. <listitem><para>
  1721. If the REQUEST contains the client FQDN option, the candidate
  1722. name is taken from there, otherwise it is taken from the Host Name option.
  1723. The candidate name may then be modified:
  1724. <orderedlist>
  1725. <listitem><para>
  1726. If the candidate name is a fully qualified domain name, use it.
  1727. </para></listitem>
  1728. <listitem><para>
  1729. If the candidate name is a partial (i.e. unqualified) name then
  1730. add a configurable suffix to the name and use the result as the FQDN.
  1731. </para></listitem>
  1732. <listitem><para>
  1733. If the candidate name is a empty, generate a FQDN using a
  1734. configurable prefix and suffix.
  1735. </para></listitem>
  1736. </orderedlist>
  1737. </para></listitem>
  1738. </orderedlist>
  1739. To instruct kea-dhcp4 to always generate the FQDN for a client, set the
  1740. parameter <command>replace-client-name</command> to true as follows:
  1741. </para>
  1742. <screen>
  1743. "Dhcp4": {
  1744. "dhcp-ddns": {
  1745. <userinput>"replace-client-name": true</userinput>,
  1746. ...
  1747. },
  1748. ...
  1749. }
  1750. </screen>
  1751. <para>
  1752. The prefix used in the generation of a FQDN is specified by the
  1753. <command>generated-prefix</command> parameter. The default value is "myhost". To alter
  1754. its value simply set it to the desired string:
  1755. </para>
  1756. <screen>
  1757. "Dhcp4": {
  1758. "dhcp-ddns": {
  1759. <userinput>"generated-prefix": "another.host"</userinput>,
  1760. ...
  1761. },
  1762. ...
  1763. }
  1764. </screen>
  1765. <para>
  1766. The suffix used when generating a FQDN or when qualifying a
  1767. partial name is specified by
  1768. the <command>qualifying-suffix</command> parameter. This
  1769. parameter has no default value, thus it is mandatory when
  1770. DDNS updates are enabled.
  1771. To set its value simply set it to the desired string:
  1772. </para>
  1773. <screen>
  1774. "Dhcp4": {
  1775. "dhcp-ddns": {
  1776. <userinput>"qualifying-suffix": "foo.example.org"</userinput>,
  1777. ...
  1778. },
  1779. ...
  1780. }
  1781. </screen>
  1782. </section>
  1783. <para>
  1784. When generating a name, kea-dhcp4 will construct name of the format:
  1785. </para>
  1786. <para>
  1787. [generated-prefix]-[address-text].[qualifying-suffix].
  1788. </para>
  1789. <para>
  1790. where address-text is simply the lease IP address converted to a
  1791. hyphenated string. For example, if the lease address is 172.16.1.10,
  1792. the qualifying suffix "example.com", and the default value is used for
  1793. <command>generated-prefix</command>, the generated FQDN would be:
  1794. </para>
  1795. <para>
  1796. myhost-172-16-1-10.example.com.
  1797. </para>
  1798. </section>
  1799. <section id="dhcp4-next-server">
  1800. <title>Next Server (siaddr)</title>
  1801. <para>In some cases, clients want to obtain configuration from the TFTP server.
  1802. Although there is a dedicated option for it, some devices may use the siaddr field
  1803. in the DHCPv4 packet for that purpose. That specific field can be configured
  1804. using <command>next-server</command> directive. It is possible to define it in the global scope or
  1805. for a given subnet only. If both are defined, the subnet value takes precedence.
  1806. The value in subnet can be set to 0.0.0.0, which means that <command>next-server</command> should
  1807. not be sent. It may also be set to an empty string, which means the same as if
  1808. it was not defined at all, i.e. use the global value.
  1809. </para>
  1810. <screen>
  1811. "Dhcp4": {
  1812. <userinput>"next-server": "192.0.2.123"</userinput>,
  1813. ...,
  1814. "subnet4": [
  1815. {
  1816. <userinput>"next-server": "192.0.2.234"</userinput>,
  1817. ...
  1818. }
  1819. ]
  1820. }
  1821. </screen>
  1822. </section>
  1823. <section id="dhcp4-echo-client-id">
  1824. <title>Echoing Client-ID (RFC 6842)</title>
  1825. <para>The original DHCPv4 specification
  1826. (<ulink url="http://tools.ietf.org/html/rfc2131">RFC 2131</ulink>)
  1827. states that the DHCPv4
  1828. server must not send back client-id options when responding to
  1829. clients. However, in some cases that confused clients that did
  1830. not have MAC address or client-id; see
  1831. <ulink url="http://tools.ietf.org/html/rfc6842">RFC 6842</ulink>.
  1832. for details. That
  1833. behavior has changed with the publication of
  1834. <ulink url="http://tools.ietf.org/html/rfc6842">RFC 6842</ulink>.
  1835. which updated
  1836. <ulink url="http://tools.ietf.org/html/rfc2131">RFC 2131</ulink>.
  1837. That update now states that the server must
  1838. send client-id if the client sent it. That is the default behaviour
  1839. that Kea offers. However, in some cases older devices that do
  1840. not support
  1841. <ulink url="http://tools.ietf.org/html/rfc6842">RFC 6842</ulink>.
  1842. may refuse to accept responses that include the
  1843. client-id option. To enable backward compatibility, an optional
  1844. configuration parameter has been introduced. To configure it,
  1845. use the following configuration statement:</para>
  1846. <screen>
  1847. "Dhcp4": {
  1848. <userinput>"echo-client-id": false</userinput>,
  1849. ...
  1850. }
  1851. </screen>
  1852. </section>
  1853. </section> <!-- end of configuring kea-dhcp4 server section with many subsections -->
  1854. <!-- Host reservation is a large topic. There will be many subsections,
  1855. so it should be a section on its own. -->
  1856. <section id="host-reservation-v4">
  1857. <title>Host reservation in DHCPv4</title>
  1858. <para>There are many cases where it is useful to provide a configuration on
  1859. a per host basis. The most obvious one is to reserve specific, static
  1860. address for exclusive use by a given client (host) &dash; returning client will
  1861. receive the same address from the server every time, and other clients will
  1862. generally not receive that address. Note that there may be cases when the
  1863. new reservation has been made for the client for the address being currently
  1864. in use by another client. We call this situation a "conflict". The conflicts
  1865. get resolved automatically over time as described in the subsequent sections.
  1866. Once conflict is resolved,the client will keep receiving the reserved
  1867. configuration when it renews.</para>
  1868. <para>Another example when the host reservations are applicable is when a host
  1869. that has specific requirements, e.g. a printer that needs additional DHCP options.
  1870. Yet another possible use case is to define unique names for hosts. Although not all
  1871. of the presented use cases are implemented yet, Kea software will support them in the
  1872. near future.</para>
  1873. <para>Hosts reservations are defined as parameters for each subnet. Each host
  1874. has to be identified by its hardware/MAC address. There is an optional
  1875. <command>reservations</command> array in the <command>Subnet4</command>
  1876. element. Each element in that array is a structure, that holds information
  1877. about reservrations for a single host. In particular, such a structure has
  1878. to have an indentifer that uniquely identifies a host. In DHCPv4 context, such an
  1879. identifier is a hardware or MAC address. In most cases, also an address
  1880. will be specified. It is possible to specify a hostname. Additional
  1881. capabilities are planned.</para>
  1882. <para>The following example shows how to reserve addresses for specific
  1883. hosts:
  1884. <screen>
  1885. "subnet4": [
  1886. {
  1887. "pools": [ { "pool": "192.0.2.1 - 192.0.2.200" } ],
  1888. "subnet": "192.0.2.0/24",
  1889. "interface": "eth0",
  1890. <userinput>"reservations": [
  1891. {
  1892. "hw-address": "1a:1b:1c:1d:1e:1f",
  1893. "ip-address": "192.0.2.202"
  1894. },
  1895. {
  1896. "hw-address": "0a:0b:0c:0d:0e:0f",
  1897. "ip-address": "192.0.2.100",
  1898. "hostname": "alice-laptop"
  1899. }
  1900. ]</userinput>
  1901. }
  1902. ]
  1903. </screen>
  1904. The first entry reserves the 192.0.2.202 address for the client that uses
  1905. MAC adress of 1a:1b:1c:1d:1e:1f. The second entry reserves the address
  1906. 192.0.2.100 and the hostname of alice-laptop for client using MAC
  1907. address 0a:0b:0c:0d:0e:0f. Note that if you plan to do DNS updates, it
  1908. is strongly recommended for the hostnames to be unique.
  1909. </para>
  1910. <para>Making a reservation for a mobile host that may visit multiple subnets
  1911. requires a separate host definition in each subnet it is expected to visit.
  1912. It is not allowed to define multiple host definitions with the same hardware
  1913. address in a single subnet. It is a valid configuration, if such definitions
  1914. are specified in different subnets, though.
  1915. </para>
  1916. <para>Adding host reservation incurs a performance penalty. In principle,
  1917. when the server that does not support host reservation responds to a query,
  1918. it needs to check whether there is a lease for a given address being
  1919. considered for allocation or renewal. The server that also supports host
  1920. reservation, has to perform additional checks: not only if the address is
  1921. currently used (if there is a lease for it), but also whether the address
  1922. could be used by someone else (if there is a reservation for it). That
  1923. additional check incurs performance penalty.</para>
  1924. <section id="reservation4-types">
  1925. <title>Address reservation types</title>
  1926. <para>In a typical scenario there is an IPv4 subnet defined,
  1927. e.g. 192.0.2.0/24, with certain part of it dedicated for dynamic allocation
  1928. by the DHCPv4 server. That dynamic part is referred to as a dynamic pool or
  1929. simply a pool. In principle, the host reservation can reserve any address
  1930. that belongs to the subnet. The reservations that specify addresses that
  1931. belong to configured pools are called <command>in-pool reservations</command>.
  1932. In contrast, those that do not belong to dynamic pools are called
  1933. <command>out-of-pool reservations</command>. There is no formal difference
  1934. in the reservation syntax. As of 0.9.1, both reservation types are
  1935. handled uniformly. However, upcoming releases may offer improved performance
  1936. if there are only out-of-pool reservations as the server will be able
  1937. to skip reservation checks when dealing with existing leases. Therefore,
  1938. system administrators are encouraged to use out-of-pool reservations, if
  1939. possible.</para>
  1940. </section>
  1941. <section id="reservation4-conflict">
  1942. <title>Conflicts in DHCPv4 reservations</title>
  1943. <para>As the reservations and lease information are stored separately,
  1944. conflicts may arise. Consider the following series of events. The server
  1945. has configured the dynamic pool of addresses from the range of 192.0.2.10 to
  1946. 192.0.2.20. The Host A requests an address and gets 19.0.2.10. Now the system
  1947. administrator decides to reserve the address for the Host B. He decides to
  1948. reserve 192.0.2.10 for that purpose. In general, reserving an address that
  1949. is currently assigned to someone else is not recommended, but there are
  1950. valid use cases where such an operation is warranted.</para>
  1951. <para>The server now has a conflict to resolve. Let's analyze the
  1952. situation here. If the Host B boots up and requests an address, the server is
  1953. not able to assign the reserved address 192.0.2.10 for the Host B. A naive
  1954. approach would to be immediately remove the existing lease for the Host A
  1955. and create a new one for the Host B. That would not solve the problem,
  1956. though, because as soon as the Host B gets the address, it will detect
  1957. that the address is already in use by the Host A and would send
  1958. the DHCPDECLINE message. Therefore, in this situation, the server has
  1959. to temporarily assign a different address (not matching what has been
  1960. reserved) to the Host B.</para>
  1961. <!-- let's keep this text around. It describes how that is working in v6
  1962. <para>When the Host A renews its address, the server will discover that
  1963. the address being renewed is now reserved for someone else (host
  1964. B). Therefore the server will remove the lease and will inform the Host A
  1965. that it is no longer allowed to use it by sending DHCPNAK message. Host A
  1966. will then revert to server discovery and will eventually get a different
  1967. address. The address 192.0.2.10 is now no longer used. When host B tries
  1968. to renew its temporarily assigned address, the server will detect that
  1969. it has a valid lease, but there is a reservation for a different address.
  1970. The server will send DHCPNAK to inform host B that its address is no
  1971. longer usable. The server will also remove its temporary lease. It will
  1972. revert to the server discovery phase and will eventually send a
  1973. DHCPREQUEST message. This time the server will find out that there is a
  1974. reservation for that host and the reserved address 192.0.2.10 is not used,
  1975. so it will be granted.</para> -->
  1976. <para>When the Host A renews its address, the server will discover that
  1977. the address being renewed is now reserved for another host - the Host
  1978. B. Therefore the server will inform the Host A that it is no longer
  1979. allowed to use it by sending DHCPNAK message. The server will not remove the
  1980. lease, though, as there's small chance that the DHCPNAK may be lost if the
  1981. network is lossy. If that happens, the client will not receive any
  1982. responses, so it will retransmit its DHCPREQUEST packet. Once the
  1983. DHCPNAK is received by the Host A, it will then revert to the server
  1984. discovery and will eventually get a different address. Besides
  1985. allocating a new lease, the server will also remove the old one. As
  1986. a result, the address 192.0.2.10 will be no longer used. When Host B
  1987. tries to renew its temporarily assigned address, the server will detect
  1988. that it has a valid lease, but there is a reservation for a different
  1989. address. The server will send DHCPNAK to inform Host B that its address
  1990. is no longer usable, but will keep its lease (again, the DHCPNAK may be
  1991. lost, so the server will keep it, until the client returns for a new
  1992. address). The Host B will revert to the server discovery phase and will
  1993. eventually send a DHCPREQUEST message. This time the server will find
  1994. out that there is a reservation for that host and the reserved address
  1995. 192.0.2.10 is not used, so it will be granted. It will also remove the
  1996. lease for the temporarily assigned address that the Host B previously
  1997. obtained.</para>
  1998. <para>This recovery will succeed, even if other hosts will attempt to get
  1999. the reserved address. Had the Host C requested address 192.0.2.10 after
  2000. the reservation was made, the server will either offer a different
  2001. address (when responding to DHCPDISCOVER) or would send DHCPNAK
  2002. (when responding to DHCPREQUEST).</para>
  2003. <para>This recovery mechanism allows the server to fully recover from a
  2004. case where reservations conflict with the existing leases. This procedure
  2005. takes time and will roughly take as long as renew-timer value specified.
  2006. The best way to avoid such recovery is to not define new reservations that
  2007. conflict with existing leases. Another recommendation is to use
  2008. out-of-pool reservations. If the reserved address does not belong to a
  2009. pool, there is no way that other clients could get this address (note that
  2010. having multiple reservations for the same address is not allowed).
  2011. </para>
  2012. </section>
  2013. <section id="reservation4-hostname">
  2014. <title>Reserving a hostname</title>
  2015. <para>When the reservation for the client includes the <command>hostname
  2016. </command>, the server will assign this hostname to the client and send
  2017. it back in the Client FQDN or Hostname option, depending on which of them
  2018. the client has sent to the server. The reserved hostname always takes
  2019. precedence over the hostname supplied by the client or the autogenerated
  2020. (from the IPv4 address) hostname.</para>
  2021. <para>The server qualifies the reserved hostname with the value
  2022. of the <command>qualifying-suffix</command> parameter. For example, the
  2023. following subnet configuration:
  2024. <screen>
  2025. {
  2026. "subnet4": [ {
  2027. "subnet": "10.0.0.0/24",
  2028. "pools": [ { "pool": "10.0.0.10-10.0.0.100" } ],
  2029. "reservations": [
  2030. {
  2031. "hw-address": "aa:bb:cc:dd:ee:ff",
  2032. "hostname": "alice-laptop"
  2033. }
  2034. ]
  2035. }],
  2036. "dhcp-ddns": {
  2037. "enable-updates": true,
  2038. "qualifying-suffix": "example.isc.org."
  2039. }
  2040. }
  2041. </screen>
  2042. will result in assigning the "alice-laptop.example.isc.org." hostname to the
  2043. client using the MAC address "aa:bb:cc:dd:ee:ff". If the <command>qualifying-suffix
  2044. </command> is not specified, the default (empty) value will be used, and
  2045. in this case the value specified as a <command>hostname</command> will
  2046. be treated as fully qualified name. Thus, by leaving the
  2047. <command>qualifying-suffix</command> empty it is possible to qualify
  2048. hostnames for the different clients with different domain names:
  2049. <screen>
  2050. {
  2051. "subnet4": [ {
  2052. "subnet": "10.0.0.0/24",
  2053. "pools": [ { "pool": "10.0.0.10-10.0.0.100" } ],
  2054. "reservations": [
  2055. {
  2056. "hw-address": "aa:bb:cc:dd:ee:ff",
  2057. "hostname": "alice-laptop.isc.org."
  2058. },
  2059. {
  2060. "hw-address": "12:34:56:78:99:AA",
  2061. "hostname": "mark-desktop.example.org."
  2062. }
  2063. ]
  2064. }],
  2065. "dhcp-ddns": {
  2066. "enable-updates": true,
  2067. }
  2068. }
  2069. </screen>
  2070. </para>
  2071. </section>
  2072. <section id="reservation4-options">
  2073. <title>Reserving specific options</title>
  2074. <!-- @todo: replace this with the actual text once #3572 is implemented -->
  2075. <para>Currently it is not possible to specify options in host
  2076. reservation. Such a feature will be added in the upcoming Kea
  2077. releases.</para>
  2078. </section>
  2079. <section id="reservation4-mode">
  2080. <title>Fine Tuning IPv4 Host Reservation</title>
  2081. <note>
  2082. <para><command>reservation-mode</command> configuration parameter in DHCPv4
  2083. server is accepted, but not used in the Kea 0.9.1 beta. Full implementation
  2084. will be available in the upcoming releases.</para>
  2085. </note>
  2086. <para>Host reservation capability introduces additional restrictions for the
  2087. allocation engine during lease selection and renewal. In particular, three
  2088. major checks are necessary. First, when selecting a new lease, it is not
  2089. sufficient for a candidate lease to be not used by another DHCP client. It
  2090. also must not be reserved for another client. Second, when renewing a lease,
  2091. additional check must be performed whether the address being renewed is not
  2092. reserved for another client. Finally, when a host renews an address, the server
  2093. has to check whether there's a reservation for this host, so the exisiting
  2094. (dynamically allocated) address should be revoked and the reserved one be
  2095. used instead.
  2096. </para>
  2097. <para>Some of those checks may be unnecessary in certain deployments. Not
  2098. performing them may improve performance. The Kea server provides the
  2099. <command>reservation-mode</command> configuration parameter to select the
  2100. types of reservations allowed for the particular subnet. Each reservation
  2101. type has different constraints for the checks to be performed by the
  2102. server when allocating or renewing a lease for the client.
  2103. Allowed values are:
  2104. <itemizedlist>
  2105. <listitem><simpara> <command>all</command> - enables all host reservation
  2106. types. This is the default value. This setting is the safest and the most
  2107. flexible. It allows in-pool and out-of-pool reservations. As all checks
  2108. are conducted, it is also the slowest.
  2109. </simpara></listitem>
  2110. <listitem><simpara> <command>out-of-pool</command> - allows only out of
  2111. pool host reservations. With this setting in place, the server may assume
  2112. that all host reservations are for addresses that do not belong to the
  2113. dynamic pool. Therefore it can skip the reservation checks when dealing
  2114. with in-pool addresses, thus improving performance. Do not use this mode
  2115. if any of your reservations use in-pool address. Caution is advised when
  2116. using this setting. Kea 0.9.1 does not sanity check the reservations against
  2117. <command>reservation-mode</command>. Misconfiguration may cause problems.
  2118. </simpara></listitem>
  2119. <listitem><simpara>
  2120. <command>disabled</command> - host reservation support is disabled. As there
  2121. are no reservations, the server will skip all checks. Any reservations defined
  2122. will be completely ignored. As the checks are skipped, the server may
  2123. operate faster in this mode.
  2124. </simpara></listitem>
  2125. </itemizedlist>
  2126. </para>
  2127. <para>
  2128. An example configuration that disables reservation looks like follows:
  2129. <screen>
  2130. "Dhcp4": {
  2131. "subnet4": [
  2132. {
  2133. "subnet": "192.0.2.0/24",
  2134. <userinput>"reservation-mode": "disabled"</userinput>,
  2135. ...
  2136. }
  2137. ]
  2138. }
  2139. </screen>
  2140. </para>
  2141. </section>
  2142. </section>
  2143. <!-- end of host reservations section -->
  2144. <section id="dhcp4-serverid">
  2145. <title>Server Identifier in DHCPv4</title>
  2146. <para>
  2147. The DHCPv4 protocol uses a "server identifier" to allow clients
  2148. to discriminate between several servers present on the same link: this
  2149. value is an IPv4 address of the server. The server chooses the IPv4 address
  2150. of the interface on which the message from the client (or relay) has been
  2151. received. A single server instance will use multiple server identifiers
  2152. if it is receiving queries on multiple interfaces.
  2153. </para>
  2154. <para>
  2155. Currently there is no mechanism to override the default server identifiers
  2156. by an administrator. In the future, the configuration mechanism will be used
  2157. to specify the custom server identifier.
  2158. </para>
  2159. </section>
  2160. <section id="dhcp4-subnet-selection">
  2161. <title>How the DHCPv4 Server Selects a Subnet for the Client</title>
  2162. <para>
  2163. The DHCPv4 server differentiates between the directly connected clients,
  2164. clients trying to renew leases and clients sending their messages through
  2165. relays. For the directly connected clients the server will check the
  2166. configuration for the interface on which the message has been received, and
  2167. if the server configuration doesn't match any configured subnet the
  2168. message is discarded.</para>
  2169. <para>Assuming that the server's interface is configured with the
  2170. IPv4 address 192.0.2.3, the server will only process messages received through
  2171. this interface from a directly connected client if there is a subnet
  2172. configured to which this IPv4 address belongs, e.g. 192.0.2.0/24.
  2173. The server will use this subnet to assign IPv4 address for the client.
  2174. </para>
  2175. <para>
  2176. The rule above does not apply when the client unicasts its message, i.e.
  2177. is trying to renew its lease. Such a message is accepted through any
  2178. interface. The renewing client sets ciaddr to the currently used IPv4
  2179. address. The server uses this address to select the subnet for the client
  2180. (in particular, to extend the lease using this address).
  2181. </para>
  2182. <para>
  2183. If the message is relayed it is accepted through any interface. The giaddr
  2184. set by the relay agent is used to select the subnet for the client.
  2185. </para>
  2186. <para>
  2187. It is also possible to specify a relay IPv4 address for a given subnet. It
  2188. can be used to match incoming packets into a subnet in uncommon configurations,
  2189. e.g. shared subnets. See <xref linkend="dhcp4-relay-override"/> for details.
  2190. </para>
  2191. <note>
  2192. <para>The subnet selection mechanism described in this section is based
  2193. on the assumption that client classification is not used. The classification
  2194. mechanism alters the way in which a subnet is selected for the client,
  2195. depending on the classes to which the client belongs.</para>
  2196. </note>
  2197. <section id="dhcp4-relay-override">
  2198. <title>Using a Specific Relay Agent for a Subnet</title>
  2199. <para>
  2200. The relay has to have an interface connected to the link on which
  2201. the clients are being configured. Typically the relay has an IPv4
  2202. address configured on that interface that belongs to the subnet from which
  2203. the server will assign addresses. In the typical case, the
  2204. server is able to use the IPv4 address inserted by the relay (in the giaddr
  2205. field of the DHCPv4 packet) to select the appropriate subnet.
  2206. </para>
  2207. <para>
  2208. However, that is not always the case. In certain uncommon &mdash;
  2209. valid &mdash; deployments, the relay address may not match the subnet. This
  2210. usually means that there is more than one subnet allocated for a given
  2211. link. The two most common examples where this is the case are long lasting
  2212. network renumbering (where both old and new address space is still being
  2213. used) and a cable network. In a cable network both cable modems and the
  2214. devices behind them are physically connected to the same link, yet
  2215. they use distinct addressing. In such a case, the DHCPv4 server needs
  2216. additional information (the IPv4 address of the relay) to properly select
  2217. an appropriate subnet.
  2218. </para>
  2219. <para>
  2220. The following example assumes that there is a subnet 192.0.2.0/24
  2221. that is accessible via a relay that uses 10.0.0.1 as its IPv4 address.
  2222. The server will be able to select this subnet for any incoming packets
  2223. that came from a relay that has an address in 192.0.2.0/24 subnet.
  2224. It will also select that subnet for a relay with address 10.0.0.1.
  2225. <screen>
  2226. "Dhcp4": {
  2227. "subnet4": [
  2228. {
  2229. "subnet": "192.0.2.0/24",
  2230. "pools": [ { "pool": "192.0.2.10 - 192.0.2.20" } ],
  2231. <userinput>"relay": {
  2232. "ip-address": "10.0.0.1"
  2233. }</userinput>,
  2234. ...
  2235. }
  2236. ],
  2237. ...
  2238. }
  2239. </screen>
  2240. </para>
  2241. </section>
  2242. <section id="dhcp4-srv-example-client-class-relay">
  2243. <title>Segregating IPv4 Clients in a Cable Network</title>
  2244. <para>
  2245. In certain cases, it is useful to mix relay address information,
  2246. introduced in <xref linkend="dhcp4-relay-override"/> with client
  2247. classification, explained in <xref linkend="dhcp4-subnet-class"/>.
  2248. One specific example is cable network, where typically modems
  2249. get addresses from a different subnet than all devices connected
  2250. behind them.
  2251. </para>
  2252. <para>
  2253. Let's assume that there is one CMTS (Cable Modem Termination System)
  2254. with one CM MAC (a physical link that modems are connected to).
  2255. We want the modems to get addresses from the 10.1.1.0/24 subnet, while
  2256. everything connected behind modems should get addresses from another
  2257. subnet (192.0.2.0/24). The CMTS that acts as a relay uses address
  2258. 10.1.1.1. The following configuration can serve that configuration:
  2259. <screen>
  2260. "Dhcp4": {
  2261. "subnet4": [
  2262. {
  2263. "subnet": "10.1.1.0/24",
  2264. "pools": [ { "pool": "10.1.1.2 - 10.1.1.20" } ],
  2265. <userinput>"client-class" "docsis3.0",
  2266. "relay": {
  2267. "ip-address": "10.1.1.1"
  2268. }</userinput>
  2269. },
  2270. {
  2271. "subnet": "192.0.2.0/24",
  2272. "pools": [ { "pool": "192.0.2.10 - 192.0.2.20" } ],
  2273. <userinput>"relay": {
  2274. "ip-address": "10.1.1.1"
  2275. }</userinput>
  2276. }
  2277. ],
  2278. ...
  2279. }
  2280. </screen>
  2281. </para>
  2282. </section>
  2283. </section>
  2284. <section id="dhcp4-std">
  2285. <title>Supported DHCP Standards</title>
  2286. <para>The following standards are currently supported:</para>
  2287. <itemizedlist>
  2288. <listitem>
  2289. <simpara><emphasis>Dynamic Host Configuration Protocol</emphasis>,
  2290. <ulink url="http://tools.ietf.org/html/rfc2131">RFC 2131</ulink>:
  2291. Supported messages are DISCOVER (1), OFFER (2),
  2292. REQUEST (3), RELEASE (7), INFORM (8), ACK (5), and NAK(6).</simpara>
  2293. </listitem>
  2294. <listitem>
  2295. <simpara><emphasis>DHCP Options and BOOTP Vendor Extensions</emphasis>,
  2296. <ulink url="http://tools.ietf.org/html/rfc2132">RFC 2132</ulink>:
  2297. Supported options are: PAD (0),
  2298. END(255), Message Type(53), DHCP Server Identifier (54),
  2299. Domain Name (15), DNS Servers (6), IP Address Lease Time
  2300. (51), Subnet mask (1), and Routers (3).</simpara>
  2301. </listitem>
  2302. <listitem>
  2303. <simpara><emphasis>DHCP Relay Agent Information Option</emphasis>,
  2304. <ulink url="http://tools.ietf.org/html/rfc3046">RFC 3046</ulink>:
  2305. Relay Agent Information option is supported.</simpara>
  2306. </listitem>
  2307. <listitem>
  2308. <simpara><emphasis>Vendor-Identifying Vendor Options for
  2309. Dynamic Host Configuration Protocol version 4</emphasis>,
  2310. <ulink url="http://tools.ietf.org/html/rfc3925">RFC 3925</ulink>:
  2311. Vendor-Identifying Vendor Class and Vendor-Identifying Vendor-Specific
  2312. Information options are supported.</simpara>
  2313. </listitem>
  2314. <listitem>
  2315. <simpara><emphasis>Client Identifier Option in DHCP Server Replies</emphasis>,
  2316. <ulink url="http://tools.ietf.org/html/rfc6842">RFC 6842</ulink>:
  2317. Server by default sends back client-id option. That capability may be
  2318. disabled. See <xref linkend="dhcp4-echo-client-id"/> for details.
  2319. </simpara>
  2320. </listitem>
  2321. </itemizedlist>
  2322. </section>
  2323. <section id="dhcp4-limit">
  2324. <title>DHCPv4 Server Limitations</title>
  2325. <para>These are the current limitations of the DHCPv4 server
  2326. software. Most of them are reflections of the current stage of
  2327. development and should be treated as <quote>not implemented
  2328. yet</quote>, rather than actual limitations. However, some of them
  2329. are implications of the design choices made. Those are clearly
  2330. marked as such.</para>
  2331. <itemizedlist>
  2332. <listitem> <!-- see tickets #3234, #3281 -->
  2333. <simpara>
  2334. Removal of a subnet during server reconfiguration may cause renumbering
  2335. of auto-generated subnet identifiers, as described in section
  2336. <xref linkend="ipv4-subnet-id"/>.
  2337. </simpara>
  2338. </listitem>
  2339. <listitem>
  2340. <simpara>Host reservation (static addresses) is not supported yet.</simpara>
  2341. </listitem>
  2342. <listitem>
  2343. <simpara>Full featured client classification is not supported yet.</simpara>
  2344. </listitem>
  2345. <listitem>
  2346. <simpara>
  2347. BOOTP (<ulink url="http://tools.ietf.org/html/rfc951">RFC 951</ulink>)
  2348. is not supported. This is a design choice. BOOTP support is not planned.
  2349. </simpara>
  2350. </listitem>
  2351. <listitem>
  2352. <simpara>On Linux and BSD system families the DHCP messages are sent
  2353. and received over the raw sockets (using LPF and BPF) and all packet
  2354. headers (including data link layer, IP and UDP headers) are created and
  2355. parsed by Kea, rather than the system kernel. Currently, Kea can
  2356. only parse the data link layer headers with a format adhering to
  2357. IEEE 802.3 standard and assumes this data link layer header format
  2358. for all interfaces. Hence, Kea will fail to work on interfaces
  2359. which use different data link layer header formats (e.g. Infiniband).
  2360. </simpara>
  2361. </listitem>
  2362. <listitem>
  2363. <simpara>The DHCPv4 server does not verify that
  2364. assigned address is unused. According to <ulink url="http://tools.ietf.org/html/rfc2131">RFC 2131</ulink>, the
  2365. allocating server should verify that address is not used by
  2366. sending ICMP echo request.</simpara>
  2367. </listitem>
  2368. <listitem>
  2369. <simpara>Address duplication report (DECLINE) is not supported yet.</simpara>
  2370. </listitem>
  2371. <listitem>
  2372. <simpara>
  2373. The server doesn't act upon expired leases. In particular,
  2374. when a lease expires, the server doesn't request the removal
  2375. of the DNS records associated with it. Expired leases can be
  2376. recycled.
  2377. </simpara>
  2378. </listitem>
  2379. </itemizedlist>
  2380. </section>
  2381. <!--
  2382. <section id="dhcp4-srv-examples">
  2383. <title>Kea DHCPv4 server examples</title>
  2384. <para>
  2385. This section provides easy to use example. Each example can be read
  2386. separately. It is not intended to be read sequentially as there will
  2387. be many repetitions between examples. They are expected to serve as
  2388. easy to use copy-paste solutions to many common deployments.
  2389. </para>
  2390. @todo: add simple configuration for direct clients
  2391. @todo: add configuration for relayed clients
  2392. @todo: add client classification example
  2393. </section> -->
  2394. </chapter>