dhcp4-srv.xml 154 KB

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