dhcp4-srv.xml 113 KB

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