dhcp4-srv.xml 156 KB

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