dhcp4-srv.xml 142 KB

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