1dhcpd.conf(5) File Formats Manual dhcpd.conf(5)
2
3
4
6 dhcpd.conf - dhcpd configuration file
7
9 The dhcpd.conf file contains configuration information for dhcpd, the
10 Internet Systems Consortium DHCP Server.
11
12 The dhcpd.conf file is a free-form ASCII text file. It is parsed by
13 the recursive-descent parser built into dhcpd. The file may contain
14 extra tabs and newlines for formatting purposes. Keywords in the file
15 are case-insensitive. Comments may be placed anywhere within the file
16 (except within quotes). Comments begin with the # character and end
17 at the end of the line.
18
19 The file essentially consists of a list of statements. Statements
20 fall into two broad categories - parameters and declarations.
21
22 Parameter statements either say how to do something (e.g., how long a
23 lease to offer), whether to do something (e.g., should dhcpd provide
24 addresses to unknown clients), or what parameters to provide to the
25 client (e.g., use gateway 220.177.244.7).
26
27 Declarations are used to describe the topology of the network, to
28 describe clients on the network, to provide addresses that can be
29 assigned to clients, or to apply a group of parameters to a group of
30 declarations. In any group of parameters and declarations, all param‐
31 eters must be specified before any declarations which depend on those
32 parameters may be specified.
33
34 Declarations about network topology include the shared-network and the
35 subnet declarations. If clients on a subnet are to be assigned
36 addresses dynamically, a range declaration must appear within the sub‐
37 net declaration. For clients with statically assigned addresses, or
38 for installations where only known clients will be served, each such
39 client must have a host declaration. If parameters are to be applied
40 to a group of declarations which are not related strictly on a per-sub‐
41 net basis, the group declaration can be used.
42
43 For every subnet which will be served, and for every subnet to which
44 the dhcp server is connected, there must be one subnet declaration,
45 which tells dhcpd how to recognize that an address is on that subnet.
46 A subnet declaration is required for each subnet even if no addresses
47 will be dynamically allocated on that subnet.
48
49 Some installations have physical networks on which more than one IP
50 subnet operates. For example, if there is a site-wide requirement
51 that 8-bit subnet masks be used, but a department with a single physi‐
52 cal ethernet network expands to the point where it has more than 254
53 nodes, it may be necessary to run two 8-bit subnets on the same ether‐
54 net until such time as a new physical network can be added. In this
55 case, the subnet declarations for these two networks must be enclosed
56 in a shared-network declaration.
57
58 Note that even when the shared-network declaration is absent, an empty
59 one is created by the server to contain the subnet (and any scoped
60 parameters included in the subnet). For practical purposes, this means
61 that "stateless" DHCP clients, which are not tied to addresses (and
62 therefore subnets) will receive the same configuration as stateful
63 ones.
64
65 Some sites may have departments which have clients on more than one
66 subnet, but it may be desirable to offer those clients a uniform set of
67 parameters which are different than what would be offered to clients
68 from other departments on the same subnet. For clients which will be
69 declared explicitly with host declarations, these declarations can be
70 enclosed in a group declaration along with the parameters which are
71 common to that department. For clients whose addresses will be dynam‐
72 ically assigned, class declarations and conditional declarations may be
73 used to group parameter assignments based on information the client
74 sends.
75
76 When a client is to be booted, its boot parameters are determined by
77 consulting that client's host declaration (if any), and then consulting
78 any class declarations matching the client, followed by the pool, sub‐
79 net and shared-network declarations for the IP address assigned to the
80 client. Each of these declarations itself appears within a lexical
81 scope, and all declarations at less specific lexical scopes are also
82 consulted for client option declarations. Scopes are never considered
83 twice, and if parameters are declared in more than one scope, the
84 parameter declared in the most specific scope is the one that is used.
85
86 When dhcpd tries to find a host declaration for a client, it first
87 looks for a host declaration which has a fixed-address declaration that
88 lists an IP address that is valid for the subnet or shared network on
89 which the client is booting. If it doesn't find any such entry, it
90 tries to find an entry which has no fixed-address declaration.
91
93 A typical dhcpd.conf file will look something like this:
94
95 global parameters...
96
97 subnet 204.254.239.0 netmask 255.255.255.224 {
98 subnet-specific parameters...
99 range 204.254.239.10 204.254.239.30;
100 }
101
102 subnet 204.254.239.32 netmask 255.255.255.224 {
103 subnet-specific parameters...
104 range 204.254.239.42 204.254.239.62;
105 }
106
107 subnet 204.254.239.64 netmask 255.255.255.224 {
108 subnet-specific parameters...
109 range 204.254.239.74 204.254.239.94;
110 }
111
112 group {
113 group-specific parameters...
114 host zappo.test.isc.org {
115 host-specific parameters...
116 }
117 host beppo.test.isc.org {
118 host-specific parameters...
119 }
120 host harpo.test.isc.org {
121 host-specific parameters...
122 }
123 }
124
125 Figure 1
126
127
128 Notice that at the beginning of the file, there's a place for global
129 parameters. These might be things like the organization's domain
130 name, the addresses of the name servers (if they are common to the
131 entire organization), and so on. So, for example:
132
133 option domain-name "isc.org";
134 option domain-name-servers ns1.isc.org, ns2.isc.org;
135
136 Figure 2
137
138 As you can see in Figure 2, you can specify host addresses in parame‐
139 ters using their domain names rather than their numeric IP addresses.
140 If a given hostname resolves to more than one IP address (for example,
141 if that host has two ethernet interfaces), then where possible, both
142 addresses are supplied to the client.
143
144 The most obvious reason for having subnet-specific parameters as shown
145 in Figure 1 is that each subnet, of necessity, has its own router. So
146 for the first subnet, for example, there should be something like:
147
148 option routers 204.254.239.1;
149
150 Note that the address here is specified numerically. This is not
151 required - if you have a different domain name for each interface on
152 your router, it's perfectly legitimate to use the domain name for that
153 interface instead of the numeric address. However, in many cases
154 there may be only one domain name for all of a router's IP addresses,
155 and it would not be appropriate to use that name here.
156
157 In Figure 1 there is also a group statement, which provides common
158 parameters for a set of three hosts - zappo, beppo and harpo. As you
159 can see, these hosts are all in the test.isc.org domain, so it might
160 make sense for a group-specific parameter to override the domain name
161 supplied to these hosts:
162
163 option domain-name "test.isc.org";
164
165 Also, given the domain they're in, these are probably test machines.
166 If we wanted to test the DHCP leasing mechanism, we might set the lease
167 timeout somewhat shorter than the default:
168
169 max-lease-time 120;
170 default-lease-time 120;
171
172 You may have noticed that while some parameters start with the option
173 keyword, some do not. Parameters starting with the option keyword
174 correspond to actual DHCP options, while parameters that do not start
175 with the option keyword either control the behavior of the DHCP server
176 (e.g., how long a lease dhcpd will give out), or specify client parame‐
177 ters that are not optional in the DHCP protocol (for example, server-
178 name and filename).
179
180 In Figure 1, each host had host-specific parameters. These could
181 include such things as the hostname option, the name of a file to
182 upload (the filename parameter) and the address of the server from
183 which to upload the file (the next-server parameter). In general, any
184 parameter can appear anywhere that parameters are allowed, and will be
185 applied according to the scope in which the parameter appears.
186
187 Imagine that you have a site with a lot of NCD X-Terminals. These
188 terminals come in a variety of models, and you want to specify the boot
189 files for each model. One way to do this would be to have host decla‐
190 rations for each server and group them by model:
191
192 group {
193 filename "Xncd19r";
194 next-server ncd-booter;
195
196 host ncd1 { hardware ethernet 0:c0:c3:49:2b:57; }
197 host ncd4 { hardware ethernet 0:c0:c3:80:fc:32; }
198 host ncd8 { hardware ethernet 0:c0:c3:22:46:81; }
199 }
200
201 group {
202 filename "Xncd19c";
203 next-server ncd-booter;
204
205 host ncd2 { hardware ethernet 0:c0:c3:88:2d:81; }
206 host ncd3 { hardware ethernet 0:c0:c3:00:14:11; }
207 }
208
209 group {
210 filename "XncdHMX";
211 next-server ncd-booter;
212
213 host ncd1 { hardware ethernet 0:c0:c3:11:90:23; }
214 host ncd4 { hardware ethernet 0:c0:c3:91:a7:8; }
215 host ncd8 { hardware ethernet 0:c0:c3:cc:a:8f; }
216 }
217
219 The pool declaration can be used to specify a pool of addresses that
220 will be treated differently than another pool of addresses, even on the
221 same network segment or subnet. For example, you may want to provide
222 a large set of addresses that can be assigned to DHCP clients that are
223 registered to your DHCP server, while providing a smaller set of
224 addresses, possibly with short lease times, that are available for
225 unknown clients. If you have a firewall, you may be able to arrange
226 for addresses from one pool to be allowed access to the Internet, while
227 addresses in another pool are not, thus encouraging users to register
228 their DHCP clients. To do this, you would set up a pair of pool dec‐
229 larations:
230
231 subnet 10.0.0.0 netmask 255.255.255.0 {
232 option routers 10.0.0.254;
233
234 # Unknown clients get this pool.
235 pool {
236 option domain-name-servers bogus.example.com;
237 max-lease-time 300;
238 range 10.0.0.200 10.0.0.253;
239 allow unknown-clients;
240 }
241
242 # Known clients get this pool.
243 pool {
244 option domain-name-servers ns1.example.com, ns2.example.com;
245 max-lease-time 28800;
246 range 10.0.0.5 10.0.0.199;
247 deny unknown-clients;
248 }
249 }
250
251 It is also possible to set up entirely different subnets for known and
252 unknown clients - address pools exist at the level of shared networks,
253 so address ranges within pool declarations can be on different subnets.
254
255 As you can see in the preceding example, pools can have permit lists
256 that control which clients are allowed access to the pool and which
257 aren't. Each entry in a pool's permit list is introduced with the
258 allow or deny keyword. If a pool has a permit list, then only those
259 clients that match specific entries on the permit list will be eligible
260 to be assigned addresses from the pool. If a pool has a deny list,
261 then only those clients that do not match any entries on the deny list
262 will be eligible. If both permit and deny lists exist for a pool,
263 then only clients that match the permit list and do not match the deny
264 list will be allowed access.
265
267 Address allocation is actually only done when a client is in the INIT
268 state and has sent a DHCPDISCOVER message. If the client thinks it has
269 a valid lease and sends a DHCPREQUEST to initiate or renew that lease,
270 the server has only three choices - it can ignore the DHCPREQUEST, send
271 a DHCPNAK to tell the client it should stop using the address, or send
272 a DHCPACK, telling the client to go ahead and use the address for a
273 while.
274
275 If the server finds the address the client is requesting, and that
276 address is available to the client, the server will send a DHCPACK. If
277 the address is no longer available, or the client isn't permitted to
278 have it, the server will send a DHCPNAK. If the server knows nothing
279 about the address, it will remain silent, unless the address is incor‐
280 rect for the network segment to which the client has been attached and
281 the server is authoritative for that network segment, in which case the
282 server will send a DHCPNAK even though it doesn't know about the
283 address.
284
285 There may be a host declaration matching the client's identification.
286 If that host declaration contains a fixed-address declaration that
287 lists an IP address that is valid for the network segment to which the
288 client is connected. In this case, the DHCP server will never do
289 dynamic address allocation. In this case, the client is required to
290 take the address specified in the host declaration. If the client
291 sends a DHCPREQUEST for some other address, the server will respond
292 with a DHCPNAK.
293
294 When the DHCP server allocates a new address for a client (remember,
295 this only happens if the client has sent a DHCPDISCOVER), it first
296 looks to see if the client already has a valid lease on an IP address,
297 or if there is an old IP address the client had before that hasn't yet
298 been reassigned. In that case, the server will take that address and
299 check it to see if the client is still permitted to use it. If the
300 client is no longer permitted to use it, the lease is freed if the
301 server thought it was still in use - the fact that the client has sent
302 a DHCPDISCOVER proves to the server that the client is no longer using
303 the lease.
304
305 If no existing lease is found, or if the client is forbidden to receive
306 the existing lease, then the server will look in the list of address
307 pools for the network segment to which the client is attached for a
308 lease that is not in use and that the client is permitted to have. It
309 looks through each pool declaration in sequence (all range declarations
310 that appear outside of pool declarations are grouped into a single pool
311 with no permit list). If the permit list for the pool allows the
312 client to be allocated an address from that pool, the pool is examined
313 to see if there is an address available. If so, then the client is
314 tentatively assigned that address. Otherwise, the next pool is
315 tested. If no addresses are found that can be assigned to the client,
316 no response is sent to the client.
317
318 If an address is found that the client is permitted to have, and that
319 has never been assigned to any client before, the address is immedi‐
320 ately allocated to the client. If the address is available for allo‐
321 cation but has been previously assigned to a different client, the
322 server will keep looking in hopes of finding an address that has never
323 before been assigned to a client.
324
325 The DHCP server generates the list of available IP addresses from a
326 hash table. This means that the addresses are not sorted in any par‐
327 ticular order, and so it is not possible to predict the order in which
328 the DHCP server will allocate IP addresses. Users of previous ver‐
329 sions of the ISC DHCP server may have become accustomed to the DHCP
330 server allocating IP addresses in ascending order, but this is no
331 longer possible, and there is no way to configure this behavior with
332 version 3 of the ISC DHCP server.
333
335 The DHCP server checks IP addresses to see if they are in use before
336 allocating them to clients. It does this by sending an ICMP Echo
337 request message to the IP address being allocated. If no ICMP Echo
338 reply is received within a second, the address is assumed to be free.
339 This is only done for leases that have been specified in range state‐
340 ments, and only when the lease is thought by the DHCP server to be free
341 - i.e., the DHCP server or its failover peer has not listed the lease
342 as in use.
343
344 If a response is received to an ICMP Echo request, the DHCP server
345 assumes that there is a configuration error - the IP address is in use
346 by some host on the network that is not a DHCP client. It marks the
347 address as abandoned, and will not assign it to clients.
348
349 If a DHCP client tries to get an IP address, but none are available,
350 but there are abandoned IP addresses, then the DHCP server will attempt
351 to reclaim an abandoned IP address. It marks one IP address as free,
352 and then does the same ICMP Echo request check described previously.
353 If there is no answer to the ICMP Echo request, the address is assigned
354 to the client.
355
356 The DHCP server does not cycle through abandoned IP addresses if the
357 first IP address it tries to reclaim is free. Rather, when the next
358 DHCPDISCOVER comes in from the client, it will attempt a new allocation
359 using the same method described here, and will typically try a new IP
360 address.
361
363 This version of the ISC DHCP server supports the DHCP failover protocol
364 as documented in draft-ietf-dhc-failover-07.txt. This is not a final
365 protocol document, and we have not done interoperability testing with
366 other vendors' implementations of this protocol, so you must not assume
367 that this implementation conforms to the standard. If you wish to use
368 the failover protocol, make sure that both failover peers are running
369 the same version of the ISC DHCP server.
370
371 The failover protocol allows two DHCP servers (and no more than two) to
372 share a common address pool. Each server will have about half of the
373 available IP addresses in the pool at any given time for allocation.
374 If one server fails, the other server will continue to renew leases out
375 of the pool, and will allocate new addresses out of the roughly half of
376 available addresses that it had when communications with the other
377 server were lost.
378
379 It is possible during a prolonged failure to tell the remaining server
380 that the other server is down, in which case the remaining server will
381 (over time) reclaim all the addresses the other server had available
382 for allocation, and begin to reuse them. This is called putting the
383 server into the PARTNER-DOWN state.
384
385 You can put the server into the PARTNER-DOWN state either by using the
386 omshell (1) command or by stopping the server, editing the last peer
387 state declaration in the lease file, and restarting the server. If
388 you use this last method, be sure to leave the date and time of the
389 start of the state blank:
390
391 failover peer name state {
392 my state partner-down;
393 peer state state at date;
394 }
395
396 When the other server comes back online, it should automatically detect
397 that it has been offline and request a complete update from the server
398 that was running in the PARTNER-DOWN state, and then both servers will
399 resume processing together.
400
401 It is possible to get into a dangerous situation: if you put one server
402 into the PARTNER-DOWN state, and then *that* server goes down, and the
403 other server comes back up, the other server will not know that the
404 first server was in the PARTNER-DOWN state, and may issue addresses
405 previously issued by the other server to different clients, resulting
406 in IP address conflicts. Before putting a server into PARTNER-DOWN
407 state, therefore, make sure that the other server will not restart
408 automatically.
409
410 The failover protocol defines a primary server role and a secondary
411 server role. There are some differences in how primaries and secon‐
412 daries act, but most of the differences simply have to do with provid‐
413 ing a way for each peer to behave in the opposite way from the other.
414 So one server must be configured as primary, and the other must be con‐
415 figured as secondary, and it doesn't matter too much which one is
416 which.
417
419 When a server starts that has not previously communicated with its
420 failover peer, it must establish communications with its failover peer
421 and synchronize with it before it can serve clients. This can happen
422 either because you have just configured your DHCP servers to perform
423 failover for the first time, or because one of your failover servers
424 has failed catastrophically and lost its database.
425
426 The initial recovery process is designed to ensure that when one
427 failover peer loses its database and then resynchronizes, any leases
428 that the failed server gave out before it failed will be honored. When
429 the failed server starts up, it notices that it has no saved failover
430 state, and attempts to contact its peer.
431
432 When it has established contact, it asks the peer for a complete copy
433 its peer's lease database. The peer then sends its complete database,
434 and sends a message indicating that it is done. The failed server then
435 waits until MCLT has passed, and once MCLT has passed both servers make
436 the transition back into normal operation. This waiting period ensures
437 that any leases the failed server may have given out while out of con‐
438 tact with its partner will have expired.
439
440 While the failed server is recovering, its partner remains in the part‐
441 ner-down state, which means that it is serving all clients. The failed
442 server provides no service at all to DHCP clients until it has made the
443 transition into normal operation.
444
445 In the case where both servers detect that they have never before com‐
446 municated with their partner, they both come up in this recovery state
447 and follow the procedure we have just described. In this case, no
448 service will be provided to DHCP clients until MCLT has expired.
449
451 In order to configure failover, you need to write a peer declaration
452 that configures the failover protocol, and you need to write peer ref‐
453 erences in each pool declaration for which you want to do failover.
454 You do not have to do failover for all pools on a given network seg‐
455 ment. You must not tell one server it's doing failover on a particu‐
456 lar address pool and tell the other it is not. You must not have any
457 common address pools on which you are not doing failover. A pool dec‐
458 laration that utilizes failover would look like this:
459
460 pool {
461 failover peer "foo";
462 pool specific parameters
463 };
464
465 Dynamic BOOTP leases are not compatible with failover, and, as such,
466 you need to disallow BOOTP in pools that you are using failover for.
467
468 The server currently does very little sanity checking, so if you
469 configure it wrong, it will just fail in odd ways. I would recommend
470 therefore that you either do failover or don't do failover, but don't
471 do any mixed pools. Also, use the same master configuration file for
472 both servers, and have a separate file that contains the peer
473 declaration and includes the master file. This will help you to avoid
474 configuration mismatches. As our implementation evolves, this will
475 become less of a problem. A basic sample dhcpd.conf file for a
476 primary server might look like this:
477
478 failover peer "foo" {
479 primary;
480 address anthrax.rc.vix.com;
481 port 647;
482 peer address trantor.rc.vix.com;
483 peer port 847;
484 max-response-delay 60;
485 max-unacked-updates 10;
486 mclt 3600;
487 split 128;
488 load balance max seconds 3;
489 }
490
491 include "/etc/dhcpd.master";
492
493 The statements in the peer declaration are as follows:
494
495 The primary and secondary statements
496
497 [ primary | secondary ];
498
499 This determines whether the server is primary or secondary, as
500 described earlier under DHCP FAILOVER.
501
502 The address statement
503
504 address address;
505
506 The address statement declares the IP address or DNS name on which
507 the server should listen for connections from its failover peer, and
508 also the value to use for the DHCP Failover Protocol server identi‐
509 fier. Because this value is used as an identifier, it may not be
510 omitted.
511
512 The peer address statement
513
514 peer address address;
515
516 The peer address statement declares the IP address or DNS name to
517 which the server should connect to reach its failover peer for
518 failover messages.
519
520 The port statement
521
522 port port-number;
523
524 The port statement declares the TCP port on which the server should
525 listen for connections from its failover peer.
526
527 The peer port statement
528
529 peer port port-number;
530
531 The peer port statement declares the TCP port to which the server
532 should connect to reach its failover peer for failover messages. The
533 port number declared in the peer port statement may be the same as
534 the port number declared in the port statement.
535
536 The max-response-delay statement
537
538 max-response-delay seconds;
539
540 The max-response-delay statement tells the DHCP server how many sec‐
541 onds may pass without receiving a message from its failover peer
542 before it assumes that connection has failed. This number should be
543 small enough that a transient network failure that breaks the connec‐
544 tion will not result in the servers being out of communication for a
545 long time, but large enough that the server isn't constantly making
546 and breaking connections. This parameter must be specified.
547
548 The max-unacked-updates statement
549
550 max-unacked-updates count;
551
552 The max-unacked-updates statement tells the remote DHCP server how
553 many BNDUPD messages it can send before it receives a BNDACK from the
554 local system. We don't have enough operational experience to say
555 what a good value for this is, but 10 seems to work. This parameter
556 must be specified.
557
558 The mclt statement
559
560 mclt seconds;
561
562 The mclt statement defines the Maximum Client Lead Time. It must be
563 specified on the primary, and may not be specified on the secondary.
564 This is the length of time for which a lease may be renewed by either
565 failover peer without contacting the other. The longer you set
566 this, the longer it will take for the running server to recover IP
567 addresses after moving into PARTNER-DOWN state. The shorter you set
568 it, the more load your servers will experience when they are not com‐
569 municating. A value of something like 3600 is probably reasonable,
570 but again bear in mind that we have no real operational experience
571 with this.
572
573 The split statement
574
575 split index;
576
577 The split statement specifies the split between the primary and sec‐
578 ondary for the purposes of load balancing. Whenever a client makes
579 a DHCP request, the DHCP server runs a hash on the client identifica‐
580 tion, resulting in value from 0 to 255. This is used as an index
581 into a 256 bit field. If the bit at that index is set, the primary
582 is responsible. If the bit at that index is not set, the secondary
583 is responsible. The split value determines how many of the leading
584 bits are set to one. So, in practice, higher split values will cause
585 the primary to serve more clients than the secondary. Lower split
586 values, the converse. Legal values are between 0 and 255, of which
587 the most reasonable is 128.
588
589 The hba statement
590
591 hba colon-separated-hex-list;
592
593 The hba statement specifies the split between the primary and sec‐
594 ondary as a bitmap rather than a cutoff, which theoretically allows
595 for finer-grained control. In practice, there is probably no need
596 for such fine-grained control, however. An example hba statement:
597
598 hba ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:
599 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00;
600
601 This is equivalent to a split 128; statement, and identical. The
602 following two examples are also equivalent to a split of 128, but are
603 not identical:
604
605 hba aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:
606 aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa;
607
608 hba 55:55:55:55:55:55:55:55:55:55:55:55:55:55:55:55:
609 55:55:55:55:55:55:55:55:55:55:55:55:55:55:55:55;
610
611 They are equivalent, because half the bits are set to 0, half are set
612 to 1 (0xa and 0x5 are 1010 and 0101 binary respectively) and conse‐
613 quently this would roughly divide the clients equally between the
614 servers. They are not identical, because the actual peers this would
615 load balance to each server are different for each example.
616
617 You must only have split or hba defined, never both. For most cases,
618 the fine-grained control that hba offers isn't necessary, and split
619 should be used.
620
621 The load balance max seconds statement
622
623 load balance max seconds seconds;
624
625 This statement allows you to configure a cutoff after which load bal‐
626 ancing is disabled. The cutoff is based on the number of seconds
627 since the client sent its first DHCPDISCOVER or DHCPREQUEST message,
628 and only works with clients that correctly implement the secs field -
629 fortunately most clients do. We recommend setting this to something
630 like 3 or 5. The effect of this is that if one of the failover peers
631 gets into a state where it is responding to failover messages but not
632 responding to some client requests, the other failover peer will take
633 over its client load automatically as the clients retry.
634
635 The Failover pool balance statements.
636
637 max-lease-misbalance percentage;
638 max-lease-ownership percentage;
639 min-balance seconds;
640 max-balance seconds;
641
642 This version of the DHCP Server evaluates pool balance on a schedule,
643 rather than on demand as leases are allocated. The latter approach
644 proved to be slightly klunky when pool misbalanced reach total satu‐
645 ration...when any server ran out of leases to assign, it also lost
646 its ability to notice it had run dry.
647
648 In order to understand pool balance, some elements of its operation
649 first need to be defined. First, there are 'free' and 'backup'
650 leases. Both of these are referred to as 'free state leases'.
651 'free' and 'backup' are 'the free states' for the purpose of this
652 document. The difference is that only the primary may allocate from
653 'free' leases unless under special circumstances, and only the sec‐
654 ondary may allocate 'backup' leases.
655
656 When pool balance is performed, the only plausible expectation is to
657 provide a 50/50 split of the free state leases between the two
658 servers. This is because no one can predict which server will fail,
659 regardless of the relative load placed upon the two servers, so giv‐
660 ing each server half the leases gives both servers the same amount of
661 'failure endurance'. Therefore, there is no way to configure any
662 different behaviour, outside of some very small windows we will
663 describe shortly.
664
665 The first thing calculated on any pool balance run is a value
666 referred to as 'lts', or "Leases To Send". This, simply, is the dif‐
667 ference in the count of free and backup leases, divided by two. For
668 the secondary, it is the difference in the backup and free leases,
669 divided by two. The resulting value is signed: if it is positive,
670 the local server is expected to hand out leases to retain a 50/50
671 balance. If it is negative, the remote server would need to send
672 leases to balance the pool. Once the lts value reaches zero, the
673 pool is perfectly balanced (give or take one lease in the case of an
674 odd number of total free state leases).
675
676 The current approach is still something of a hybrid of the old
677 approach, marked by the presence of the max-lease-misbalance state‐
678 ment. This parameter configures what used to be a 10% fixed value in
679 previous versions: if lts is less than free+backup * max-lease-mis‐
680 balance percent, then the server will skip balancing a given pool (it
681 won't bother moving any leases, even if some leases "should" be
682 moved). The meaning of this value is also somewhat overloaded, how‐
683 ever, in that it also governs the estimation of when to attempt to
684 balance the pool (which may then also be skipped over). The oldest
685 leases in the free and backup states are examined. The time they
686 have resided in their respective queues is used as an estimate to
687 indicate how much time it is probable it would take before the leases
688 at the top of the list would be consumed (and thus, how long it would
689 take to use all leases in that state). This percentage is directly
690 multiplied by this time, and fit into the schedule if it falls within
691 the min-balance and max-balance configured values. The scheduled
692 pool check time is only moved in a downwards direction, it is never
693 increased. Lastly, if the lts is more than double this number in the
694 negative direction, the local server will 'panic' and transmit a
695 Failover protocol POOLREQ message, in the hopes that the remote sys‐
696 tem will be woken up into action.
697
698 Once the lts value exceeds the max-lease-misbalance percentage of
699 total free state leases as described above, leases are moved to the
700 remote server. This is done in two passes.
701
702 In the first pass, only leases whose most recent bound client would
703 have been served by the remote server - according to the Load Balance
704 Algorithm (see above split and hba configuration statements) - are
705 given away to the peer. This first pass will happily continue to
706 give away leases, decrementing the lts value by one for each, until
707 the lts value has reached the negative of the total number of leases
708 multiplied by the max-lease-ownership percentage. So it is through
709 this value that you can permit a small misbalance of the lease pools
710 - for the purpose of giving the peer more than a 50/50 share of
711 leases in the hopes that their clients might some day return and be
712 allocated by the peer (operating normally). This process is referred
713 to as 'MAC Address Affinity', but this is somewhat misnamed: it
714 applies equally to DHCP Client Identifier options. Note also that
715 affinity is applied to leases when they enter the state be moved from
716 free to backup if the secondary already has more than its share.
717
718 The second pass is only entered into if the first pass fails to
719 reduce the lts underneath the total number of free state leases mul‐
720 tiplied by the max-lease-ownership percentage. In this pass, the
721 oldest leases are given over to the peer without second thought about
722 the Load Balance Algorithm, and this continues until the lts falls
723 under this value. In this way, the local server will also happily
724 keep a small percentage of the leases that would normally load bal‐
725 ance to itself.
726
727 So, the max-lease-misbalance value acts as a behavioural gate.
728 Smaller values will cause more leases to transition states to balance
729 the pools over time, higher values will decrease the amount of change
730 (but may lead to pool starvation if there's a run on leases).
731
732 The max-lease-ownership value permits a small (percentage) skew in
733 the lease balance of a percentage of the total number of free state
734 leases.
735
736 Finally, the min-balance and max-balance make certain that a sched‐
737 uled rebalance event happens within a reasonable timeframe (not to be
738 thrown off by, for example, a 7 year old free lease).
739
740 Plausible values for the percentages lie between 0 and 100, inclu‐
741 sive, but values over 50 are indistinguishable from one another (once
742 lts exceeds 50% of the free state leases, one server must therefore
743 have 100% of the leases in its respective free state). It is recom‐
744 mended to select a max-lease-ownership value that is lower than the
745 value selected for the max-lease-misbalance value. max-lease-owner‐
746 ship defaults to 10, and max-lease-misbalance defaults to 15.
747
748 Plausible values for the min-balance and max-balance times also range
749 from 0 to (2^32)-1 (or the limit of your local time_t value), but
750 default to values 60 and 3600 respectively (to place balance events
751 between 1 minute and 1 hour).
752
754 Clients can be separated into classes, and treated differently depend‐
755 ing on what class they are in. This separation can be done either
756 with a conditional statement, or with a match statement within the
757 class declaration. It is possible to specify a limit on the total
758 number of clients within a particular class or subclass that may hold
759 leases at one time, and it is possible to specify automatic subclassing
760 based on the contents of the client packet.
761
762 To add clients to classes based on conditional evaluation, you can
763 specify a matching expression in the class statement:
764
765 class "ras-clients" {
766 match if substring (option dhcp-client-identifier, 1, 3) = "RAS";
767 }
768
769 Note that whether you use matching expressions or add statements (or
770 both) to classify clients, you must always write a class declaration
771 for any class that you use. If there will be no match statement and
772 no in-scope statements for a class, the declaration should look like
773 this:
774
775 class "ras-clients" {
776 }
777
779 In addition to classes, it is possible to declare subclasses. A sub‐
780 class is a class with the same name as a regular class, but with a spe‐
781 cific submatch expression which is hashed for quick matching. This is
782 essentially a speed hack - the main difference between five classes
783 with match expressions and one class with five subclasses is that it
784 will be quicker to find the subclasses. Subclasses work as follows:
785
786 class "allocation-class-1" {
787 match pick-first-value (option dhcp-client-identifier, hardware);
788 }
789
790 class "allocation-class-2" {
791 match pick-first-value (option dhcp-client-identifier, hardware);
792 }
793
794 subclass "allocation-class-1" 1:8:0:2b:4c:39:ad;
795 subclass "allocation-class-2" 1:8:0:2b:a9:cc:e3;
796 subclass "allocation-class-1" 1:0:0:c4:aa:29:44;
797
798 subnet 10.0.0.0 netmask 255.255.255.0 {
799 pool {
800 allow members of "allocation-class-1";
801 range 10.0.0.11 10.0.0.50;
802 }
803 pool {
804 allow members of "allocation-class-2";
805 range 10.0.0.51 10.0.0.100;
806 }
807 }
808
809 The data following the class name in the subclass declaration is a con‐
810 stant value to use in matching the match expression for the class.
811 When class matching is done, the server will evaluate the match expres‐
812 sion and then look the result up in the hash table. If it finds a
813 match, the client is considered a member of both the class and the sub‐
814 class.
815
816 Subclasses can be declared with or without scope. In the above exam‐
817 ple, the sole purpose of the subclass is to allow some clients access
818 to one address pool, while other clients are given access to the other
819 pool, so these subclasses are declared without scopes. If part of the
820 purpose of the subclass were to define different parameter values for
821 some clients, you might want to declare some subclasses with scopes.
822
823 In the above example, if you had a single client that needed some con‐
824 figuration parameters, while most didn't, you might write the following
825 subclass declaration for that client:
826
827 subclass "allocation-class-2" 1:08:00:2b:a1:11:31 {
828 option root-path "samsara:/var/diskless/alphapc";
829 filename "/tftpboot/netbsd.alphapc-diskless";
830 }
831
832 In this example, we've used subclassing as a way to control address
833 allocation on a per-client basis. However, it's also possible to use
834 subclassing in ways that are not specific to clients - for example, to
835 use the value of the vendor-class-identifier option to determine what
836 values to send in the vendor-encapsulated-options option. An example
837 of this is shown under the VENDOR ENCAPSULATED OPTIONS head in the
838 dhcp-options(5) manual page.
839
841 You may specify a limit to the number of clients in a class that can be
842 assigned leases. The effect of this will be to make it difficult for
843 a new client in a class to get an address. Once a class with such a
844 limit has reached its limit, the only way a new client in that class
845 can get a lease is for an existing client to relinquish its lease,
846 either by letting it expire, or by sending a DHCPRELEASE packet.
847 Classes with lease limits are specified as follows:
848
849 class "limited-1" {
850 lease limit 4;
851 }
852
853 This will produce a class in which a maximum of four members may hold a
854 lease at one time.
855
857 It is possible to declare a spawning class. A spawning class is a
858 class that automatically produces subclasses based on what the client
859 sends. The reason that spawning classes were created was to make it
860 possible to create lease-limited classes on the fly. The envisioned
861 application is a cable-modem environment where the ISP wishes to pro‐
862 vide clients at a particular site with more than one IP address, but
863 does not wish to provide such clients with their own subnet, nor give
864 them an unlimited number of IP addresses from the network segment to
865 which they are connected.
866
867 Many cable modem head-end systems can be configured to add a Relay
868 Agent Information option to DHCP packets when relaying them to the DHCP
869 server. These systems typically add a circuit ID or remote ID option
870 that uniquely identifies the customer site. To take advantage of
871 this, you can write a class declaration as follows:
872
873 class "customer" {
874 spawn with option agent.circuit-id;
875 lease limit 4;
876 }
877
878 Now whenever a request comes in from a customer site, the circuit ID
879 option will be checked against the class's hash table. If a subclass
880 is found that matches the circuit ID, the client will be classified in
881 that subclass and treated accordingly. If no subclass is found match‐
882 ing the circuit ID, a new one will be created and logged in the
883 dhcpd.leases file, and the client will be classified in this new class.
884 Once the client has been classified, it will be treated according to
885 the rules of the class, including, in this case, being subject to the
886 per-site limit of four leases.
887
888 The use of the subclass spawning mechanism is not restricted to relay
889 agent options - this particular example is given only because it is a
890 fairly straightforward one.
891
893 In some cases, it may be useful to use one expression to assign a
894 client to a particular class, and a second expression to put it into a
895 subclass of that class. This can be done by combining the match if
896 and spawn with statements, or the match if and match statements. For
897 example:
898
899 class "jr-cable-modems" {
900 match if option dhcp-vendor-identifier = "jrcm";
901 spawn with option agent.circuit-id;
902 lease limit 4;
903 }
904
905 class "dv-dsl-modems" {
906 match if opton dhcp-vendor-identifier = "dvdsl";
907 spawn with option agent.circuit-id;
908 lease limit 16;
909 }
910
911 This allows you to have two classes that both have the same spawn with
912 expression without getting the clients in the two classes confused with
913 each other.
914
916 The DHCP server has the ability to dynamically update the Domain Name
917 System. Within the configuration files, you can define how you want
918 the Domain Name System to be updated. These updates are RFC 2136 com‐
919 pliant so any DNS server supporting RFC 2136 should be able to accept
920 updates from the DHCP server.
921
922 Two DNS update schemes are currently implemented, and another is
923 planned. The two that are currently available are the ad-hoc DNS
924 update mode and the interim DHCP-DNS interaction draft update mode. If
925 and when the DHCP-DNS interaction draft and the DHCID draft make it
926 through the IETF standards process, there will be a third mode, which
927 will be the standard DNS update method. The DHCP server must be con‐
928 figured to use one of the two currently-supported methods, or not to do
929 dns updates. This can be done with the ddns-update-style configura‐
930 tion parameter.
931
933 The ad-hoc Dynamic DNS update scheme is now deprecated and does not
934 work. In future releases of the ISC DHCP server, this scheme will not
935 likely be available. The interim scheme works, allows for failover,
936 and should now be used. The following description is left here for
937 informational purposes only.
938
939 The ad-hoc Dynamic DNS update scheme implemented in this version of the
940 ISC DHCP server is a prototype design, which does not have much to do
941 with the standard update method that is being standardized in the IETF
942 DHC working group, but rather implements some very basic, yet useful,
943 update capabilities. This mode does not work with the failover proto‐
944 col because it does not account for the possibility of two different
945 DHCP servers updating the same set of DNS records.
946
947 For the ad-hoc DNS update method, the client's FQDN is derived in two
948 parts. First, the hostname is determined. Then, the domain name is
949 determined, and appended to the hostname.
950
951 The DHCP server determines the client's hostname by first looking for a
952 ddns-hostname configuration option, and using that if it is present.
953 If no such option is present, the server looks for a valid hostname in
954 the FQDN option sent by the client. If one is found, it is used; oth‐
955 erwise, if the client sent a host-name option, that is used. Other‐
956 wise, if there is a host declaration that applies to the client, the
957 name from that declaration will be used. If none of these applies, the
958 server will not have a hostname for the client, and will not be able to
959 do a DNS update.
960
961 The domain name is determined from the ddns-domainname configuration
962 option. The default configuration for this option is:
963
964 option server.ddns-domainname = config-option domain-name;
965
966 So if this configuration option is not configured to a different value
967 (over-riding the above default), or if a domain-name option has not
968 been configured for the client's scope, then the server will not
969 attempt to perform a DNS update.
970
971 The client's fully-qualified domain name, derived as we have described,
972 is used as the name on which an "A" record will be stored. The A
973 record will contain the IP address that the client was assigned in its
974 lease. If there is already an A record with the same name in the DNS
975 server, no update of either the A or PTR records will occur - this pre‐
976 vents a client from claiming that its hostname is the name of some net‐
977 work server. For example, if you have a fileserver called
978 "fs.sneedville.edu", and the client claims its hostname is "fs", no DNS
979 update will be done for that client, and an error message will be
980 logged.
981
982 If the A record update succeeds, a PTR record update for the assigned
983 IP address will be done, pointing to the A record. This update is
984 unconditional - it will be done even if another PTR record of the same
985 name exists. Since the IP address has been assigned to the DHCP
986 server, this should be safe.
987
988 Please note that the current implementation assumes clients only have a
989 single network interface. A client with two network interfaces will
990 see unpredictable behavior. This is considered a bug, and will be
991 fixed in a later release. It may be helpful to enable the one-lease-
992 per-client parameter so that roaming clients do not trigger this same
993 behavior.
994
995 The DHCP protocol normally involves a four-packet exchange - first the
996 client sends a DHCPDISCOVER message, then the server sends a DHCPOFFER,
997 then the client sends a DHCPREQUEST, then the server sends a DHCPACK.
998 In the current version of the server, the server will do a DNS update
999 after it has received the DHCPREQUEST, and before it has sent the DHC‐
1000 PACK. It only sends the DNS update if it has not sent one for the
1001 client's address before, in order to minimize the impact on the DHCP
1002 server.
1003
1004 When the client's lease expires, the DHCP server (if it is operating at
1005 the time, or when next it operates) will remove the client's A and PTR
1006 records from the DNS database. If the client releases its lease by
1007 sending a DHCPRELEASE message, the server will likewise remove the A
1008 and PTR records.
1009
1011 The interim DNS update scheme operates mostly according to several
1012 drafts that are being considered by the IETF and are expected to become
1013 standards, but are not yet standards, and may not be standardized
1014 exactly as currently proposed. These are:
1015
1016 draft-ietf-dhc-ddns-resolution-??.txt
1017 draft-ietf-dhc-fqdn-option-??.txt
1018 draft-ietf-dnsext-dhcid-rr-??.txt
1019
1020 Because our implementation is slightly different than the standard, we
1021 will briefly document the operation of this update style here.
1022
1023 The first point to understand about this style of DNS update is that
1024 unlike the ad-hoc style, the DHCP server does not necessarily always
1025 update both the A and the PTR records. The FQDN option includes a
1026 flag which, when sent by the client, indicates that the client wishes
1027 to update its own A record. In that case, the server can be config‐
1028 ured either to honor the client's intentions or ignore them. This is
1029 done with the statement allow client-updates; or the statement ignore
1030 client-updates;. By default, client updates are allowed.
1031
1032 If the server is configured to allow client updates, then if the client
1033 sends a fully-qualified domain name in the FQDN option, the server will
1034 use that name the client sent in the FQDN option to update the PTR
1035 record. For example, let us say that the client is a visitor from the
1036 "radish.org" domain, whose hostname is "jschmoe". The server is for
1037 the "example.org" domain. The DHCP client indicates in the FQDN
1038 option that its FQDN is "jschmoe.radish.org.". It also indicates that
1039 it wants to update its own A record. The DHCP server therefore does
1040 not attempt to set up an A record for the client, but does set up a PTR
1041 record for the IP address that it assigns the client, pointing at
1042 jschmoe.radish.org. Once the DHCP client has an IP address, it can
1043 update its own A record, assuming that the "radish.org" DNS server will
1044 allow it to do so.
1045
1046 If the server is configured not to allow client updates, or if the
1047 client doesn't want to do its own update, the server will simply choose
1048 a name for the client from either the fqdn option (if present) or the
1049 hostname option (if present). It will use its own domain name for the
1050 client, just as in the ad-hoc update scheme. It will then update both
1051 the A and PTR record, using the name that it chose for the client. If
1052 the client sends a fully-qualified domain name in the fqdn option, the
1053 server uses only the leftmost part of the domain name - in the example
1054 above, "jschmoe" instead of "jschmoe.radish.org".
1055
1056 Further, if the ignore client-updates; directive is used, then the
1057 server will in addition send a response in the DHCP packet, using the
1058 FQDN Option, that implies to the client that it should perform its own
1059 updates if it chooses to do so. With deny client-updates;, a response
1060 is sent which indicates the client may not perform updates.
1061
1062 Also, if the use-host-decl-names configuration option is enabled, then
1063 the host declaration's hostname will be used in place of the hostname
1064 option, and the same rules will apply as described above.
1065
1066 The other difference between the ad-hoc scheme and the interim scheme
1067 is that with the interim scheme, a method is used that allows more than
1068 one DHCP server to update the DNS database without accidentally delet‐
1069 ing A records that shouldn't be deleted nor failing to add A records
1070 that should be added. The scheme works as follows:
1071
1072 When the DHCP server issues a client a new lease, it creates a text
1073 string that is an MD5 hash over the DHCP client's identification (see
1074 draft-ietf-dnsext-dhcid-rr-??.txt for details). The update adds an A
1075 record with the name the server chose and a TXT record containing the
1076 hashed identifier string (hashid). If this update succeeds, the
1077 server is done.
1078
1079 If the update fails because the A record already exists, then the DHCP
1080 server attempts to add the A record with the prerequisite that there
1081 must be a TXT record in the same name as the new A record, and that TXT
1082 record's contents must be equal to hashid. If this update succeeds,
1083 then the client has its A record and PTR record. If it fails, then
1084 the name the client has been assigned (or requested) is in use, and
1085 can't be used by the client. At this point the DHCP server gives up
1086 trying to do a DNS update for the client until the client chooses a new
1087 name.
1088
1089 The interim DNS update scheme is called interim for two reasons.
1090 First, it does not quite follow the drafts. The current versions of
1091 the drafts call for a new DHCID RRtype, but this is not yet available.
1092 The interim DNS update scheme uses a TXT record instead. Also, the
1093 existing ddns-resolution draft calls for the DHCP server to put a DHCID
1094 RR on the PTR record, but the interim update method does not do this.
1095 It is our position that this is not useful, and we are working with the
1096 author in hopes of removing it from the next version of the draft, or
1097 better understanding why it is considered useful.
1098
1099 In addition to these differences, the server also does not update very
1100 aggressively. Because each DNS update involves a round trip to the DNS
1101 server, there is a cost associated with doing updates even if they do
1102 not actually modify the DNS database. So the DHCP server tracks
1103 whether or not it has updated the record in the past (this information
1104 is stored on the lease) and does not attempt to update records that it
1105 thinks it has already updated.
1106
1107 This can lead to cases where the DHCP server adds a record, and then
1108 the record is deleted through some other mechanism, but the server
1109 never again updates the DNS because it thinks the data is already
1110 there. In this case the data can be removed from the lease through
1111 operator intervention, and once this has been done, the DNS will be
1112 updated the next time the client renews.
1113
1115 When you set your DNS server up to allow updates from the DHCP server,
1116 you may be exposing it to unauthorized updates. To avoid this, you
1117 should use TSIG signatures - a method of cryptographically signing
1118 updates using a shared secret key. As long as you protect the secrecy
1119 of this key, your updates should also be secure. Note, however, that
1120 the DHCP protocol itself provides no security, and that clients can
1121 therefore provide information to the DHCP server which the DHCP server
1122 will then use in its updates, with the constraints described previ‐
1123 ously.
1124
1125 The DNS server must be configured to allow updates for any zone that
1126 the DHCP server will be updating. For example, let us say that clients
1127 in the sneedville.edu domain will be assigned addresses on the
1128 10.10.17.0/24 subnet. In that case, you will need a key declaration
1129 for the TSIG key you will be using, and also two zone declarations -
1130 one for the zone containing A records that will be updates and one for
1131 the zone containing PTR records - for ISC BIND, something like this:
1132
1133 key DHCP_UPDATER {
1134 algorithm hmac-md5;
1135 secret pRP5FapFoJ95JEL06sv4PQ==;
1136 };
1137
1138 zone "example.org" {
1139 type master;
1140 file "example.org.db";
1141 allow-update { key DHCP_UPDATER; };
1142 };
1143
1144 zone "17.10.10.in-addr.arpa" {
1145 type master;
1146 file "10.10.17.db";
1147 allow-update { key DHCP_UPDATER; };
1148 };
1149
1150 You will also have to configure your DHCP server to do updates to these
1151 zones. To do so, you need to add something like this to your
1152 dhcpd.conf file:
1153
1154 key DHCP_UPDATER {
1155 algorithm hmac-md5;
1156 secret pRP5FapFoJ95JEL06sv4PQ==;
1157 };
1158
1159 zone EXAMPLE.ORG. {
1160 primary 127.0.0.1;
1161 key DHCP_UPDATER;
1162 }
1163
1164 zone 17.127.10.in-addr.arpa. {
1165 primary 127.0.0.1;
1166 key DHCP_UPDATER;
1167 }
1168
1169 The primary statement specifies the IP address of the name server whose
1170 zone information is to be updated.
1171
1172 Note that the zone declarations have to correspond to authority records
1173 in your name server - in the above example, there must be an SOA record
1174 for "example.org." and for "17.10.10.in-addr.arpa.". For example, if
1175 there were a subdomain "foo.example.org" with no separate SOA, you
1176 could not write a zone declaration for "foo.example.org." Also keep in
1177 mind that zone names in your DHCP configuration should end in a ".";
1178 this is the preferred syntax. If you do not end your zone name in a
1179 ".", the DHCP server will figure it out. Also note that in the DHCP
1180 configuration, zone names are not encapsulated in quotes where there
1181 are in the DNS configuration.
1182
1183 You should choose your own secret key, of course. The ISC BIND 8 and 9
1184 distributions come with a program for generating secret keys called
1185 dnssec-keygen. The version that comes with BIND 9 is likely to produce
1186 a substantially more random key, so we recommend you use that one even
1187 if you are not using BIND 9 as your DNS server. If you are using BIND
1188 9's dnssec-keygen, the above key would be created as follows:
1189
1190 dnssec-keygen -a HMAC-MD5 -b 128 -n USER DHCP_UPDATER
1191
1192 If you are using the BIND 8 dnskeygen program, the following command
1193 will generate a key as seen above:
1194
1195 dnskeygen -H 128 -u -c -n DHCP_UPDATER
1196
1197 You may wish to enable logging of DNS updates on your DNS server. To
1198 do so, you might write a logging statement like the following:
1199
1200 logging {
1201 channel update_debug {
1202 file "/var/log/update-debug.log";
1203 severity debug 3;
1204 print-category yes;
1205 print-severity yes;
1206 print-time yes;
1207 };
1208 channel security_info {
1209 file "/var/log/named-auth.info";
1210 severity info;
1211 print-category yes;
1212 print-severity yes;
1213 print-time yes;
1214 };
1215
1216 category update { update_debug; };
1217 category security { security_info; };
1218 };
1219
1220 You must create the /var/log/named-auth.info and /var/log/update-
1221 debug.log files before starting the name server. For more information
1222 on configuring ISC BIND, consult the documentation that accompanies it.
1223
1225 There are three kinds of events that can happen regarding a lease, and
1226 it is possible to declare statements that occur when any of these
1227 events happen. These events are the commit event, when the server has
1228 made a commitment of a certain lease to a client, the release event,
1229 when the client has released the server from its commitment, and the
1230 expiry event, when the commitment expires.
1231
1232 To declare a set of statements to execute when an event happens, you
1233 must use the on statement, followed by the name of the event, followed
1234 by a series of statements to execute when the event happens, enclosed
1235 in braces. Events are used to implement DNS updates, so you should
1236 not define your own event handlers if you are using the built-in DNS
1237 update mechanism.
1238
1239 The built-in version of the DNS update mechanism is in a text string
1240 towards the top of server/dhcpd.c. If you want to use events for
1241 things other than DNS updates, and you also want DNS updates, you will
1242 have to start out by copying this code into your dhcpd.conf file and
1243 modifying it.
1244
1246 The include statement
1247
1248 include "filename";
1249
1250 The include statement is used to read in a named file, and process the
1251 contents of that file as though it were entered in place of the include
1252 statement.
1253
1254 The shared-network statement
1255
1256 shared-network name {
1257 [ parameters ]
1258 [ declarations ]
1259 }
1260
1261 The shared-network statement is used to inform the DHCP server that
1262 some IP subnets actually share the same physical network. Any subnets
1263 in a shared network should be declared within a shared-network state‐
1264 ment. Parameters specified in the shared-network statement will be
1265 used when booting clients on those subnets unless parameters provided
1266 at the subnet or host level override them. If any subnet in a shared
1267 network has addresses available for dynamic allocation, those addresses
1268 are collected into a common pool for that shared network and assigned
1269 to clients as needed. There is no way to distinguish on which subnet
1270 of a shared network a client should boot.
1271
1272 Name should be the name of the shared network. This name is used when
1273 printing debugging messages, so it should be descriptive for the shared
1274 network. The name may have the syntax of a valid domain name
1275 (although it will never be used as such), or it may be any arbitrary
1276 name, enclosed in quotes.
1277
1278 The subnet statement
1279
1280 subnet subnet-number netmask netmask {
1281 [ parameters ]
1282 [ declarations ]
1283 }
1284
1285 The subnet statement is used to provide dhcpd with enough information
1286 to tell whether or not an IP address is on that subnet. It may also be
1287 used to provide subnet-specific parameters and to specify what
1288 addresses may be dynamically allocated to clients booting on that sub‐
1289 net. Such addresses are specified using the range declaration.
1290
1291 The subnet-number should be an IP address or domain name which resolves
1292 to the subnet number of the subnet being described. The netmask
1293 should be an IP address or domain name which resolves to the subnet
1294 mask of the subnet being described. The subnet number, together with
1295 the netmask, are sufficient to determine whether any given IP address
1296 is on the specified subnet.
1297
1298 Although a netmask must be given with every subnet declaration, it is
1299 recommended that if there is any variance in subnet masks at a site, a
1300 subnet-mask option statement be used in each subnet declaration to set
1301 the desired subnet mask, since any subnet-mask option statement will
1302 override the subnet mask declared in the subnet statement.
1303
1304 The subnet6 statement
1305
1306 subnet6 subnet6-number {
1307 [ parameters ]
1308 [ declarations ]
1309 }
1310
1311 The subnet6 statement is used to provide dhcpd with enough information
1312 to tell whether or not an IPv6 address is on that subnet6. It may also
1313 be used to provide subnet-specific parameters and to specify what
1314 addresses may be dynamically allocated to clients booting on that sub‐
1315 net.
1316
1317 The subnet6-number should be an IPv6 network identifier, specified as
1318 ip6-address/bits.
1319
1320 The range statement
1321
1322 range [ dynamic-bootp ] low-address [ high-address];
1323
1324 For any subnet on which addresses will be assigned dynamically, there
1325 must be at least one range statement. The range statement gives the
1326 lowest and highest IP addresses in a range. All IP addresses in the
1327 range should be in the subnet in which the range statement is declared.
1328 The dynamic-bootp flag may be specified if addresses in the specified
1329 range may be dynamically assigned to BOOTP clients as well as DHCP
1330 clients. When specifying a single address, high-address can be omit‐
1331 ted.
1332
1333 The range6 statement
1334
1335 range6 low-address high-address;
1336 range6 subnet6-number;
1337 range6 subnet6-number temporary;
1338 range6 address temporary;
1339
1340 For any IPv6 subnet6 on which addresses will be assigned dynamically,
1341 there must be at least one range6 statement. The range6 statement can
1342 either be the lowest and highest IPv6 addresses in a range6, or use
1343 CIDR notation, specified as ip6-address/bits. All IP addresses in the
1344 range6 should be in the subnet6 in which the range6 statement is
1345 declared.
1346
1347 The temporay variant makes the prefix (by default on 64 bits) available
1348 for temporary (RFC 4941) addresses. A new address per prefix in the
1349 shared network is computed at each request with an IA_TA option.
1350 Release and Confirm ignores temporary addresses.
1351
1352 Any IPv6 addresses given to hosts with fixed-address6 are excluded from
1353 the range6, as are IPv6 addresses on the server itself.
1354
1355 The prefix6 statement
1356
1357 prefix6 low-address high-address / bits;
1358
1359 The prefix6 is the range6 equivalent for Prefix Delegation (RFC 3633).
1360 Prefixes of bits length are assigned between low-address and high-
1361 address.
1362
1363 Any IPv6 prefixes given to static entries (hosts) with fixed-prefix6
1364 are excluded from the prefix6.
1365
1366 This statement is currently global but it should have a shared-network
1367 scope.
1368
1369 The host statement
1370
1371 host hostname {
1372 [ parameters ]
1373 [ declarations ]
1374 }
1375
1376 The host declaration provides a scope in which to provide configuration
1377 information about a specific client, and also provides a way to assign
1378 a client a fixed address. The host declaration provides a way for the
1379 DHCP server to identify a DHCP or BOOTP client, and also a way to
1380 assign the client a static IP address.
1381
1382 If it is desirable to be able to boot a DHCP or BOOTP client on more
1383 than one subnet with fixed addresses, more than one address may be
1384 specified in the fixed-address declaration, or more than one host
1385 statement may be specified matching the same client.
1386
1387 If client-specific boot parameters must change based on the network to
1388 which the client is attached, then multiple host declarations should be
1389 used. The host declarations will only match a client if one of their
1390 fixed-address statements is viable on the subnet (or shared network)
1391 where the client is attached. Conversely, for a host declaration to
1392 match a client being allocated a dynamic address, it must not have any
1393 fixed-address statements. You may therefore need a mixture of host
1394 declarations for any given client...some having fixed-address state‐
1395 ments, others without.
1396
1397 hostname should be a name identifying the host. If a hostname option
1398 is not specified for the host, hostname is used.
1399
1400 Host declarations are matched to actual DHCP or BOOTP clients by match‐
1401 ing the dhcp-client-identifier or pxe-client-id options specified in
1402 the host declaration to the one supplied by the client, or, if the host
1403 declaration or the client does not provide a dhcp-client-identifier or
1404 pxe-client-id options, by matching the hardware parameter in the host
1405 declaration to the network hardware address supplied by the client.
1406 BOOTP clients do not normally provide a dhcp-client-identifier, so the
1407 hardware address must be used for all clients that may boot using the
1408 BOOTP protocol.
1409
1410 DHCPv6 servers can use the host-identifier option parameter in the host
1411 declaration, and specify any option with a fixed value to identify
1412 hosts.
1413
1414 Please be aware that only the dhcp-client-identifier and pxe-client-id
1415 options and the hardware address can be used to match a host declara‐
1416 tion, or the host-identifier option parameter for DHCPv6 servers. For
1417 example, it is not possible to match a host declaration to a host-name
1418 option. This is because the host-name option cannot be guaranteed to
1419 be unique for any given client, whereas both the hardware address and
1420 dhcp-client-identifier option are at least theoretically guaranteed to
1421 be unique to a given client.
1422
1423 The group statement
1424
1425 group {
1426 [ parameters ]
1427 [ declarations ]
1428 }
1429
1430 The group statement is used simply to apply one or more parameters to a
1431 group of declarations. It can be used to group hosts, shared net‐
1432 works, subnets, or even other groups.
1433
1435 The allow and deny statements can be used to control the response of
1436 the DHCP server to various sorts of requests. The allow and deny key‐
1437 words actually have different meanings depending on the context. In a
1438 pool context, these keywords can be used to set up access lists for
1439 address allocation pools. In other contexts, the keywords simply con‐
1440 trol general server behavior with respect to clients based on scope.
1441 In a non-pool context, the ignore keyword can be used in place of the
1442 deny keyword to prevent logging of denied requests.
1443
1445 The following usages of allow and deny will work in any scope, although
1446 it is not recommended that they be used in pool declarations.
1447
1448 The unknown-clients keyword
1449
1450 allow unknown-clients;
1451 deny unknown-clients;
1452 ignore unknown-clients;
1453
1454 The unknown-clients flag is used to tell dhcpd whether or not to dynam‐
1455 ically assign addresses to unknown clients. Dynamic address assign‐
1456 ment to unknown clients is allowed by default. An unknown client is
1457 simply a client that has no host declaration.
1458
1459 The use of this option is now deprecated. If you are trying to
1460 restrict access on your network to known clients, you should use deny
1461 unknown-clients; inside of your address pool, as described under the
1462 heading ALLOW AND DENY WITHIN POOL DECLARATIONS.
1463
1464 The bootp keyword
1465
1466 allow bootp;
1467 deny bootp;
1468 ignore bootp;
1469
1470 The bootp flag is used to tell dhcpd whether or not to respond to bootp
1471 queries. Bootp queries are allowed by default.
1472
1473 This option does not satisfy the requirement of failover peers for
1474 denying dynamic bootp clients. The deny dynamic bootp clients; option
1475 should be used instead. See the ALLOW AND DENY WITHIN POOL DECLARATIONS
1476 section of this man page for more details.
1477
1478 The booting keyword
1479
1480 allow booting;
1481 deny booting;
1482 ignore booting;
1483
1484 The booting flag is used to tell dhcpd whether or not to respond to
1485 queries from a particular client. This keyword only has meaning when
1486 it appears in a host declaration. By default, booting is allowed, but
1487 if it is disabled for a particular client, then that client will not be
1488 able to get an address from the DHCP server.
1489
1490 The duplicates keyword
1491
1492 allow duplicates;
1493 deny duplicates;
1494
1495 Host declarations can match client messages based on the DHCP Client
1496 Identifier option or based on the client's network hardware type and
1497 MAC address. If the MAC address is used, the host declaration will
1498 match any client with that MAC address - even clients with different
1499 client identifiers. This doesn't normally happen, but is possible
1500 when one computer has more than one operating system installed on it -
1501 for example, Microsoft Windows and NetBSD or Linux.
1502
1503 The duplicates flag tells the DHCP server that if a request is received
1504 from a client that matches the MAC address of a host declaration, any
1505 other leases matching that MAC address should be discarded by the
1506 server, even if the UID is not the same. This is a violation of the
1507 DHCP protocol, but can prevent clients whose client identifiers change
1508 regularly from holding many leases at the same time. By default,
1509 duplicates are allowed.
1510
1511 The declines keyword
1512
1513 allow declines;
1514 deny declines;
1515 ignore declines;
1516
1517 The DHCPDECLINE message is used by DHCP clients to indicate that the
1518 lease the server has offered is not valid. When the server receives a
1519 DHCPDECLINE for a particular address, it normally abandons that
1520 address, assuming that some unauthorized system is using it. Unfortu‐
1521 nately, a malicious or buggy client can, using DHCPDECLINE messages,
1522 completely exhaust the DHCP server's allocation pool. The server will
1523 reclaim these leases, but while the client is running through the pool,
1524 it may cause serious thrashing in the DNS, and it will also cause the
1525 DHCP server to forget old DHCP client address allocations.
1526
1527 The declines flag tells the DHCP server whether or not to honor DHCPDE‐
1528 CLINE messages. If it is set to deny or ignore in a particular scope,
1529 the DHCP server will not respond to DHCPDECLINE messages.
1530
1531 The client-updates keyword
1532
1533 allow client-updates;
1534 deny client-updates;
1535
1536 The client-updates flag tells the DHCP server whether or not to honor
1537 the client's intention to do its own update of its A record. This is
1538 only relevant when doing interim DNS updates. See the documentation
1539 under the heading THE INTERIM DNS UPDATE SCHEME for details.
1540
1541 The leasequery keyword
1542
1543 allow leasequery;
1544 deny leasequery;
1545
1546 The leasequery flag tells the DHCP server whether or not to answer DHC‐
1547 PLEASEQUERY packets. The answer to a DHCPLEASEQUERY packet includes
1548 information about a specific lease, such as when it was issued and when
1549 it will expire. By default, the server will not respond to these pack‐
1550 ets.
1551
1553 The uses of the allow and deny keywords shown in the previous section
1554 work pretty much the same way whether the client is sending a DHCPDIS‐
1555 COVER or a DHCPREQUEST message - an address will be allocated to the
1556 client (either the old address it's requesting, or a new address) and
1557 then that address will be tested to see if it's okay to let the client
1558 have it. If the client requested it, and it's not okay, the server
1559 will send a DHCPNAK message. Otherwise, the server will simply not
1560 respond to the client. If it is okay to give the address to the
1561 client, the server will send a DHCPACK message.
1562
1563 The primary motivation behind pool declarations is to have address
1564 allocation pools whose allocation policies are different. A client
1565 may be denied access to one pool, but allowed access to another pool on
1566 the same network segment. In order for this to work, access control
1567 has to be done during address allocation, not after address allocation
1568 is done.
1569
1570 When a DHCPREQUEST message is processed, address allocation simply con‐
1571 sists of looking up the address the client is requesting and seeing if
1572 it's still available for the client. If it is, then the DHCP server
1573 checks both the address pool permit lists and the relevant in-scope
1574 allow and deny statements to see if it's okay to give the lease to the
1575 client. In the case of a DHCPDISCOVER message, the allocation process
1576 is done as described previously in the ADDRESS ALLOCATION section.
1577
1578 When declaring permit lists for address allocation pools, the following
1579 syntaxes are recognized following the allow or deny keywords:
1580
1581 known-clients;
1582
1583 If specified, this statement either allows or prevents allocation from
1584 this pool to any client that has a host declaration (i.e., is known).
1585 A client is known if it has a host declaration in any scope, not just
1586 the current scope.
1587
1588 unknown-clients;
1589
1590 If specified, this statement either allows or prevents allocation from
1591 this pool to any client that has no host declaration (i.e., is not
1592 known).
1593
1594 members of "class";
1595
1596 If specified, this statement either allows or prevents allocation from
1597 this pool to any client that is a member of the named class.
1598
1599 dynamic bootp clients;
1600
1601 If specified, this statement either allows or prevents allocation from
1602 this pool to any bootp client.
1603
1604 authenticated clients;
1605
1606 If specified, this statement either allows or prevents allocation from
1607 this pool to any client that has been authenticated using the DHCP
1608 authentication protocol. This is not yet supported.
1609
1610 unauthenticated clients;
1611
1612 If specified, this statement either allows or prevents allocation from
1613 this pool to any client that has not been authenticated using the DHCP
1614 authentication protocol. This is not yet supported.
1615
1616 all clients;
1617
1618 If specified, this statement either allows or prevents allocation from
1619 this pool to all clients. This can be used when you want to write a
1620 pool declaration for some reason, but hold it in reserve, or when you
1621 want to renumber your network quickly, and thus want the server to
1622 force all clients that have been allocated addresses from this pool to
1623 obtain new addresses immediately when they next renew.
1624
1625 after time;
1626
1627 If specified, this statement either allows or prevents allocation from
1628 this pool after a given date. This can be used when you want to move
1629 clients from one pool to another. The server adjusts the regular lease
1630 time so that the latest expiry time is at the given time+min-lease-
1631 time. A short min-lease-time enforces a step change, whereas a longer
1632 min-lease-time allows for a gradual change. time is either second
1633 since epoch, or a UTC time string e.g. 4 2007/08/24 09:14:32 or a
1634 string with time zone offset in seconds e.g. 4 2007/08/24 11:14:32
1635 -7200
1636
1638 The adaptive-lease-time-threshold statement
1639
1640 adaptive-lease-time-threshold percentage;
1641
1642 When the number of allocated leases within a pool rises above the
1643 percentage given in this statement, the DHCP server decreases the
1644 lease length for new clients within this pool to min-lease-time sec‐
1645 onds. Clients renewing an already valid (long) leases get at least
1646 the remaining time from the current lease. Since the leases expire
1647 faster, the server may either recover more quickly or avoid pool
1648 exhaustion entirely. Once the number of allocated leases drop below
1649 the threshold, the server reverts back to normal lease times. Valid
1650 percentages are between 1 and 99.
1651
1652 The always-broadcast statement
1653
1654 always-broadcast flag;
1655
1656 The DHCP and BOOTP protocols both require DHCP and BOOTP clients to
1657 set the broadcast bit in the flags field of the BOOTP message header.
1658 Unfortunately, some DHCP and BOOTP clients do not do this, and there‐
1659 fore may not receive responses from the DHCP server. The DHCP
1660 server can be made to always broadcast its responses to clients by
1661 setting this flag to 'on' for the relevant scope; relevant scopes
1662 would be inside a conditional statement, as a parameter for a class,
1663 or as a parameter for a host declaration. To avoid creating excess
1664 broadcast traffic on your network, we recommend that you restrict the
1665 use of this option to as few clients as possible. For example, the
1666 Microsoft DHCP client is known not to have this problem, as are the
1667 OpenTransport and ISC DHCP clients.
1668
1669 The always-reply-rfc1048 statement
1670
1671 always-reply-rfc1048 flag;
1672
1673 Some BOOTP clients expect RFC1048-style responses, but do not follow
1674 RFC1048 when sending their requests. You can tell that a client is
1675 having this problem if it is not getting the options you have config‐
1676 ured for it and if you see in the server log the message "(non-
1677 rfc1048)" printed with each BOOTREQUEST that is logged.
1678
1679 If you want to send rfc1048 options to such a client, you can set the
1680 always-reply-rfc1048 option in that client's host declaration, and
1681 the DHCP server will respond with an RFC-1048-style vendor options
1682 field. This flag can be set in any scope, and will affect all
1683 clients covered by that scope.
1684
1685 The authoritative statement
1686
1687 authoritative;
1688
1689 not authoritative;
1690
1691 The DHCP server will normally assume that the configuration informa‐
1692 tion about a given network segment is not known to be correct and is
1693 not authoritative. This is so that if a naive user installs a DHCP
1694 server not fully understanding how to configure it, it does not send
1695 spurious DHCPNAK messages to clients that have obtained addresses
1696 from a legitimate DHCP server on the network.
1697
1698 Network administrators setting up authoritative DHCP servers for
1699 their networks should always write authoritative; at the top of their
1700 configuration file to indicate that the DHCP server should send DHCP‐
1701 NAK messages to misconfigured clients. If this is not done, clients
1702 will be unable to get a correct IP address after changing subnets
1703 until their old lease has expired, which could take quite a long
1704 time.
1705
1706 Usually, writing authoritative; at the top level of the file should
1707 be sufficient. However, if a DHCP server is to be set up so that it
1708 is aware of some networks for which it is authoritative and some net‐
1709 works for which it is not, it may be more appropriate to declare
1710 authority on a per-network-segment basis.
1711
1712 Note that the most specific scope for which the concept of authority
1713 makes any sense is the physical network segment - either a shared-
1714 network statement or a subnet statement that is not contained within
1715 a shared-network statement. It is not meaningful to specify that the
1716 server is authoritative for some subnets within a shared network, but
1717 not authoritative for others, nor is it meaningful to specify that
1718 the server is authoritative for some host declarations and not oth‐
1719 ers.
1720
1721 The boot-unknown-clients statement
1722
1723 boot-unknown-clients flag;
1724
1725 If the boot-unknown-clients statement is present and has a value of
1726 false or off, then clients for which there is no host declaration
1727 will not be allowed to obtain IP addresses. If this statement is
1728 not present or has a value of true or on, then clients without host
1729 declarations will be allowed to obtain IP addresses, as long as those
1730 addresses are not restricted by allow and deny statements within
1731 their pool declarations.
1732
1733 The db-time-format statement
1734
1735 db-time-format [ default | local ] ;
1736
1737 The DHCP server software outputs several timestamps when writing
1738 leases to persistent storage. This configuration parameter selects
1739 one of two output formats. The default format prints the day, date,
1740 and time in UTC, while the local format prints the system seconds-
1741 since-epoch, and helpfully provides the day and time in the system
1742 timezone in a comment. The time formats are described in detail in
1743 the dhcpd.leases(5) manpage.
1744
1745 The ddns-hostname statement
1746
1747 ddns-hostname name;
1748
1749 The name parameter should be the hostname that will be used in set‐
1750 ting up the client's A and PTR records. If no ddns-hostname is
1751 specified in scope, then the server will derive the hostname automat‐
1752 ically, using an algorithm that varies for each of the different
1753 update methods.
1754
1755 The ddns-domainname statement
1756
1757 ddns-domainname name;
1758
1759 The name parameter should be the domain name that will be appended to
1760 the client's hostname to form a fully-qualified domain-name (FQDN).
1761
1762 The ddns-rev-domainname statement
1763
1764 ddns-rev-domainname name; The name parameter should be the domain
1765 name that will be appended to the client's reversed IP address to
1766 produce a name for use in the client's PTR record. By default, this
1767 is "in-addr.arpa.", but the default can be overridden here.
1768
1769 The reversed IP address to which this domain name is appended is
1770 always the IP address of the client, in dotted quad notation,
1771 reversed - for example, if the IP address assigned to the client is
1772 10.17.92.74, then the reversed IP address is 74.92.17.10. So a
1773 client with that IP address would, by default, be given a PTR record
1774 of 10.17.92.74.in-addr.arpa.
1775
1776 The ddns-update-style parameter
1777
1778 ddns-update-style style;
1779
1780 The style parameter must be one of ad-hoc, interim or none. The
1781 ddns-update-style statement is only meaningful in the outer scope -
1782 it is evaluated once after reading the dhcpd.conf file, rather than
1783 each time a client is assigned an IP address, so there is no way to
1784 use different DNS update styles for different clients. The default is
1785 none.
1786
1787 The ddns-updates statement
1788
1789 ddns-updates flag;
1790
1791 The ddns-updates parameter controls whether or not the server will
1792 attempt to do a DNS update when a lease is confirmed. Set this to
1793 off if the server should not attempt to do updates within a certain
1794 scope. The ddns-updates parameter is on by default. To disable DNS
1795 updates in all scopes, it is preferable to use the ddns-update-style
1796 statement, setting the style to none.
1797
1798 The default-lease-time statement
1799
1800 default-lease-time time;
1801
1802 Time should be the length in seconds that will be assigned to a lease
1803 if the client requesting the lease does not ask for a specific expi‐
1804 ration time. This is used for both DHCPv4 and DHCPv6 leases (it is
1805 also known as the "valid lifetime" in DHCPv6).
1806
1807 The delayed-ack and max-ack-delay statements
1808
1809 delayed-ack count; max-ack-delay microseconds;
1810
1811 Count should be an integer value from zero to 2^16-1, and defaults to
1812 28. The count represents how many DHCPv4 replies maximum will be
1813 queued pending transmission until after a database commit event. If
1814 this number is reached, a database commit event (commonly resulting
1815 in fsync() and representing a performance penalty) will be made, and
1816 the reply packets will be transmitted in a batch afterwards. This
1817 preserves the RFC2131 direction that "stable storage" be updated
1818 prior to replying to clients. Should the DHCPv4 sockets "go dry"
1819 (select() returns immediately with no read sockets), the commit is
1820 made and any queued packets are transmitted.
1821
1822 Similarly, microseconds indicates how many microseconds are permitted
1823 to pass inbetween queuing a packet pending an fsync, and performing
1824 the fsync. Valid values range from 0 to 2^32-1, and defaults to
1825 250,000 (1/4 of a second).
1826
1827 Please note that as delayed-ack is currently experimental, the
1828 delayed-ack feature is not compiled in by default, but must be
1829 enabled at compile time with './configure --enable-delayed-ack'.
1830
1831 The do-forward-updates statement
1832
1833 do-forward-updates flag;
1834
1835 The do-forward-updates statement instructs the DHCP server as to
1836 whether it should attempt to update a DHCP client's A record when the
1837 client acquires or renews a lease. This statement has no effect
1838 unless DNS updates are enabled and ddns-update-style is set to
1839 interim. Forward updates are enabled by default. If this state‐
1840 ment is used to disable forward updates, the DHCP server will never
1841 attempt to update the client's A record, and will only ever attempt
1842 to update the client's PTR record if the client supplies an FQDN that
1843 should be placed in the PTR record using the fqdn option. If forward
1844 updates are enabled, the DHCP server will still honor the setting of
1845 the client-updates flag.
1846
1847 The dynamic-bootp-lease-cutoff statement
1848
1849 dynamic-bootp-lease-cutoff date;
1850
1851 The dynamic-bootp-lease-cutoff statement sets the ending time for all
1852 leases assigned dynamically to BOOTP clients. Because BOOTP clients
1853 do not have any way of renewing leases, and don't know that their
1854 leases could expire, by default dhcpd assigns infinite leases to all
1855 BOOTP clients. However, it may make sense in some situations to set
1856 a cutoff date for all BOOTP leases - for example, the end of a school
1857 term, or the time at night when a facility is closed and all machines
1858 are required to be powered off.
1859
1860 Date should be the date on which all assigned BOOTP leases will end.
1861 The date is specified in the form:
1862
1863 W YYYY/MM/DD HH:MM:SS
1864
1865 W is the day of the week expressed as a number from zero (Sunday) to
1866 six (Saturday). YYYY is the year, including the century. MM is the
1867 month expressed as a number from 1 to 12. DD is the day of the
1868 month, counting from 1. HH is the hour, from zero to 23. MM is the
1869 minute and SS is the second. The time is always in Coordinated Uni‐
1870 versal Time (UTC), not local time.
1871
1872 The dynamic-bootp-lease-length statement
1873
1874 dynamic-bootp-lease-length length;
1875
1876 The dynamic-bootp-lease-length statement is used to set the length of
1877 leases dynamically assigned to BOOTP clients. At some sites, it may
1878 be possible to assume that a lease is no longer in use if its holder
1879 has not used BOOTP or DHCP to get its address within a certain time
1880 period. The period is specified in length as a number of seconds.
1881 If a client reboots using BOOTP during the timeout period, the lease
1882 duration is reset to length, so a BOOTP client that boots frequently
1883 enough will never lose its lease. Needless to say, this parameter
1884 should be adjusted with extreme caution.
1885
1886 The filename statement
1887
1888 filename "filename";
1889
1890 The filename statement can be used to specify the name of the initial
1891 boot file which is to be loaded by a client. The filename should be
1892 a filename recognizable to whatever file transfer protocol the client
1893 can be expected to use to load the file.
1894
1895 The fixed-address declaration
1896
1897 fixed-address address [, address ... ];
1898
1899 The fixed-address declaration is used to assign one or more fixed IP
1900 addresses to a client. It should only appear in a host declaration.
1901 If more than one address is supplied, then when the client boots, it
1902 will be assigned the address that corresponds to the network on which
1903 it is booting. If none of the addresses in the fixed-address state‐
1904 ment are valid for the network to which the client is connected, that
1905 client will not match the host declaration containing that fixed-
1906 address declaration. Each address in the fixed-address declaration
1907 should be either an IP address or a domain name that resolves to one
1908 or more IP addresses.
1909
1910 The fixed-address6 declaration
1911
1912 fixed-address6 ip6-address ;
1913
1914 The fixed-address6 declaration is used to assign a fixed IPv6
1915 addresses to a client. It should only appear in a host declaration.
1916
1917 The get-lease-hostnames statement
1918
1919 get-lease-hostnames flag;
1920
1921 The get-lease-hostnames statement is used to tell dhcpd whether or
1922 not to look up the domain name corresponding to the IP address of
1923 each address in the lease pool and use that address for the DHCP
1924 hostname option. If flag is true, then this lookup is done for all
1925 addresses in the current scope. By default, or if flag is false, no
1926 lookups are done.
1927
1928 The hardware statement
1929
1930 hardware hardware-type hardware-address;
1931
1932 In order for a BOOTP client to be recognized, its network hardware
1933 address must be declared using a hardware clause in the host state‐
1934 ment. hardware-type must be the name of a physical hardware inter‐
1935 face type. Currently, only the ethernet and token-ring types are
1936 recognized, although support for a fddi hardware type (and others)
1937 would also be desirable. The hardware-address should be a set of
1938 hexadecimal octets (numbers from 0 through ff) separated by colons.
1939 The hardware statement may also be used for DHCP clients.
1940
1941 The host-identifier option statement
1942
1943 host-identifier option option-name option-data;
1944
1945 This identifies a DHCPv6 client in a host statement. option-name is
1946 any option, and option-data is the value for the option that the
1947 client will send. The option-data must be a constant value.
1948
1949 The ignore-client-uids statement
1950
1951 ignore-client-uids flag;
1952
1953 If the ignore-client-uids statement is present and has a value of
1954 true or on, the UID for clients will not be recorded. If this state‐
1955 ment is not present or has a value of false or off, then client UIDs
1956 will be recorded.
1957
1958 The infinite-is-reserved statement
1959
1960 infinite-is-reserved flag;
1961
1962 ISC DHCP now supports 'reserved' leases. See the section on RESERVED
1963 LEASES below. If this flag is on, the server will automatically
1964 reserve leases allocated to clients which requested an infinite
1965 (0xffffffff) lease-time.
1966
1967 The default is off.
1968
1969 The lease-file-name statement
1970
1971 lease-file-name name;
1972
1973 Name should be the name of the DHCP server's lease file. By
1974 default, this is /var/lib/dhcpd/dhcpd.leases. This statement must
1975 appear in the outer scope of the configuration file - if it appears
1976 in some other scope, it will have no effect. Furthermore, it has no
1977 effect if overridden by the -lf flag or the PATH_DHCPD_DB environment
1978 variable.
1979
1980 The limit-addrs-per-ia statement
1981
1982 limit-addrs-per-ia number;
1983
1984 By default, the DHCPv6 server will limit clients to one IAADDR per IA
1985 option, meaning one address. If you wish to permit clients to hang
1986 onto multiple addresses at a time, configure a larger number here.
1987
1988 Note that there is no present method to configure the server to
1989 forcibly configure the client with one IP address per each subnet on
1990 a shared network. This is left to future work.
1991
1992 The dhcpv6-lease-file-name statement
1993
1994 dhcpv6-lease-file-name name;
1995
1996 Name is the name of the lease file to use if and only if the server
1997 is running in DHCPv6 mode. By default, this is
1998 /var/lib/dhcpd/dhcpd6.leases. This statement, like lease-file-name,
1999 must appear in the outer scope of the configuration file. It has no
2000 effect if overridden by the -lf flag or the PATH_DHCPD6_DB environ‐
2001 ment variable. If dhcpv6-lease-file-name is not specified, but
2002 lease-file-name is, the latter value will be used.
2003
2004 The local-port statement
2005
2006 local-port port;
2007
2008 This statement causes the DHCP server to listen for DHCP requests on
2009 the UDP port specified in port, rather than on port 67.
2010
2011 The local-address statement
2012
2013 local-address address;
2014
2015 This statement causes the DHCP server to listen for DHCP requests
2016 sent to the specified address, rather than requests sent to all
2017 addresses. Since serving directly attached DHCP clients implies that
2018 the server must respond to requests sent to the all-ones IP address,
2019 this option cannot be used if clients are on directly attached net‐
2020 works...it is only realistically useful for a server whose only
2021 clients are reached via unicasts, such as via DHCP relay agents.
2022
2023 Note: This statement is only effective if the server was compiled
2024 using the USE_SOCKETS #define statement, which is default on a small
2025 number of operating systems, and must be explicitly chosen at com‐
2026 pile-time for all others. You can be sure if your server is compiled
2027 with USE_SOCKETS if you see lines of this format at startup:
2028
2029 Listening on Socket/eth0
2030
2031 Note also that since this bind()s all DHCP sockets to the specified
2032 address, that only one address may be supported in a daemon at a
2033 given time.
2034
2035 The log-facility statement
2036
2037 log-facility facility;
2038
2039 This statement causes the DHCP server to do all of its logging on the
2040 specified log facility once the dhcpd.conf file has been read. By
2041 default the DHCP server logs to the daemon facility. Possible log
2042 facilities include auth, authpriv, cron, daemon, ftp, kern, lpr,
2043 mail, mark, news, ntp, security, syslog, user, uucp, and local0
2044 through local7. Not all of these facilities are available on all
2045 systems, and there may be other facilities available on other sys‐
2046 tems.
2047
2048 In addition to setting this value, you may need to modify your sys‐
2049 log.conf file to configure logging of the DHCP server. For example,
2050 you might add a line like this:
2051
2052 local7.debug /var/log/dhcpd.log
2053
2054 The syntax of the syslog.conf file may be different on some operating
2055 systems - consult the syslog.conf manual page to be sure. To get
2056 syslog to start logging to the new file, you must first create the
2057 file with correct ownership and permissions (usually, the same owner
2058 and permissions of your /var/log/messages or /usr/adm/messages file
2059 should be fine) and send a SIGHUP to syslogd. Some systems support
2060 log rollover using a shell script or program called newsyslog or
2061 logrotate, and you may be able to configure this as well so that your
2062 log file doesn't grow uncontrollably.
2063
2064 Because the log-facility setting is controlled by the dhcpd.conf
2065 file, log messages printed while parsing the dhcpd.conf file or
2066 before parsing it are logged to the default log facility. To prevent
2067 this, see the README file included with this distribution, which
2068 describes how to change the default log facility. When this parame‐
2069 ter is used, the DHCP server prints its startup message a second time
2070 after parsing the configuration file, so that the log will be as com‐
2071 plete as possible.
2072
2073 The max-lease-time statement
2074
2075 max-lease-time time;
2076
2077 Time should be the maximum length in seconds that will be assigned to
2078 a lease. The only exception to this is that Dynamic BOOTP lease
2079 lengths, which are not specified by the client, are not limited by
2080 this maximum.
2081
2082 The min-lease-time statement
2083
2084 min-lease-time time;
2085
2086 Time should be the minimum length in seconds that will be assigned to
2087 a lease.
2088
2089 The min-secs statement
2090
2091 min-secs seconds;
2092
2093 Seconds should be the minimum number of seconds since a client began
2094 trying to acquire a new lease before the DHCP server will respond to
2095 its request. The number of seconds is based on what the client
2096 reports, and the maximum value that the client can report is 255 sec‐
2097 onds. Generally, setting this to one will result in the DHCP server
2098 not responding to the client's first request, but always responding
2099 to its second request.
2100
2101 This can be used to set up a secondary DHCP server which never offers
2102 an address to a client until the primary server has been given a
2103 chance to do so. If the primary server is down, the client will
2104 bind to the secondary server, but otherwise clients should always
2105 bind to the primary. Note that this does not, by itself, permit a
2106 primary server and a secondary server to share a pool of dynamically-
2107 allocatable addresses.
2108
2109 The next-server statement
2110
2111 next-server server-name;
2112
2113 The next-server statement is used to specify the host address of the
2114 server from which the initial boot file (specified in the filename
2115 statement) is to be loaded. Server-name should be a numeric IP
2116 address or a domain name. If no next-server statement applies to a
2117 given client, the address 0.0.0.0 is used.
2118
2119 The omapi-port statement
2120
2121 omapi-port port;
2122
2123 The omapi-port statement causes the DHCP server to listen for OMAPI
2124 connections on the specified port. This statement is required to
2125 enable the OMAPI protocol, which is used to examine and modify the
2126 state of the DHCP server as it is running.
2127
2128 The one-lease-per-client statement
2129
2130 one-lease-per-client flag;
2131
2132 If this flag is enabled, whenever a client sends a DHCPREQUEST for a
2133 particular lease, the server will automatically free any other leases
2134 the client holds. This presumes that when the client sends a
2135 DHCPREQUEST, it has forgotten any lease not mentioned in the DHCPRE‐
2136 QUEST - i.e., the client has only a single network interface and it
2137 does not remember leases it's holding on networks to which it is not
2138 currently attached. Neither of these assumptions are guaranteed or
2139 provable, so we urge caution in the use of this statement.
2140
2141 The pid-file-name statement
2142
2143 pid-file-name name;
2144
2145 Name should be the name of the DHCP server's process ID file. This
2146 is the file in which the DHCP server's process ID is stored when the
2147 server starts. By default, this is /var/run/dhcpd.pid. Like the
2148 lease-file-name statement, this statement must appear in the outer
2149 scope of the configuration file. It has no effect if overridden by
2150 the -pf flag or the PATH_DHCPD_PID environment variable.
2151
2152 The dhcpv6-pid-file-name statement
2153
2154 dhcpv6-pid-file-name name;
2155
2156 Name is the name of the pid file to use if and only if the server
2157 is running in DHCPv6 mode. By default, this is
2158 /var/lib/dhcpd/dhcpd6.pid. This statement, like pid-file-name,
2159 must appear in the outer scope of the configuration file. It has
2160 no effect if overridden by the -pf flag or the PATH_DHCPD6_PID
2161 environment variable. If dhcpv6-pid-file-name is not specified,
2162 but pid-file-name is, the latter value will be used.
2163
2164 The ping-check statement
2165
2166 ping-check flag;
2167
2168 When the DHCP server is considering dynamically allocating an IP
2169 address to a client, it first sends an ICMP Echo request (a ping)
2170 to the address being assigned. It waits for a second, and if no
2171 ICMP Echo response has been heard, it assigns the address. If a
2172 response is heard, the lease is abandoned, and the server does not
2173 respond to the client.
2174
2175 This ping check introduces a default one-second delay in respond‐
2176 ing to DHCPDISCOVER messages, which can be a problem for some
2177 clients. The default delay of one second may be configured using
2178 the ping-timeout parameter. The ping-check configuration parame‐
2179 ter can be used to control checking - if its value is false, no
2180 ping check is done.
2181
2182 The ping-timeout statement
2183
2184 ping-timeout seconds;
2185
2186 If the DHCP server determined it should send an ICMP echo request
2187 (a ping) because the ping-check statement is true, ping-timeout
2188 allows you to configure how many seconds the DHCP server should
2189 wait for an ICMP Echo response to be heard, if no ICMP Echo
2190 response has been received before the timeout expires, it assigns
2191 the address. If a response is heard, the lease is abandoned, and
2192 the server does not respond to the client. If no value is set,
2193 ping-timeout defaults to 1 second.
2194
2195 The preferred-lifetime statement
2196
2197 preferred-lifetime seconds;
2198
2199 IPv6 addresses have 'valid' and 'preferred' lifetimes. The valid
2200 lifetime determines at what point at lease might be said to have
2201 expired, and is no longer useable. A preferred lifetime is an
2202 advisory condition to help applications move off of the address
2203 and onto currently valid addresses (should there still be any open
2204 TCP sockets or similar).
2205
2206 The preferred lifetime defaults to the renew+rebind timers, or 3/4
2207 the default lease time if none were specified.
2208
2209 The remote-port statement
2210
2211 remote-port port;
2212
2213 This statement causes the DHCP server to transmit DHCP responses
2214 to DHCP clients upon the UDP port specified in port, rather than
2215 on port 68. In the event that the UDP response is transmitted to
2216 a DHCP Relay, the server generally uses the local-port configura‐
2217 tion value. Should the DHCP Relay happen to be addressed as
2218 127.0.0.1, however, the DHCP Server transmits its response to the
2219 remote-port configuration value. This is generally only useful
2220 for testing purposes, and this configuration value should gener‐
2221 ally not be used.
2222
2223 The server-identifier statement
2224
2225 server-identifier hostname;
2226
2227 The server-identifier statement can be used to define the value
2228 that is sent in the DHCP Server Identifier option for a given
2229 scope. The value specified must be an IP address for the DHCP
2230 server, and must be reachable by all clients served by a particu‐
2231 lar scope.
2232
2233 The use of the server-identifier statement is not recommended -
2234 the only reason to use it is to force a value other than the
2235 default value to be sent on occasions where the default value
2236 would be incorrect. The default value is the first IP address
2237 associated with the physical network interface on which the
2238 request arrived.
2239
2240 The usual case where the server-identifier statement needs to be
2241 sent is when a physical interface has more than one IP address,
2242 and the one being sent by default isn't appropriate for some or
2243 all clients served by that interface. Another common case is when
2244 an alias is defined for the purpose of having a consistent IP
2245 address for the DHCP server, and it is desired that the clients
2246 use this IP address when contacting the server.
2247
2248 Supplying a value for the dhcp-server-identifier option is equiva‐
2249 lent to using the server-identifier statement.
2250
2251 The server-duid statement
2252
2253 server-duid LLT [ hardware-type timestamp hardware-address ] ;
2254
2255 server-duid EN enterprise-number enterprise-identifier ;
2256
2257 server-duid LL [ hardware-type hardware-address ] ;
2258
2259 The server-duid statement configures the server DUID. You may pick
2260 either LLT (link local address plus time), EN (enterprise), or LL
2261 (link local).
2262
2263 If you choose LLT or LL, you may specify the exact contents of the
2264 DUID. Otherwise the server will generate a DUID of the specified
2265 type.
2266
2267 If you choose EN, you must include the enterprise number and the
2268 enterprise-identifier.
2269
2270 The default server-duid type is LLT.
2271
2272 The server-name statement
2273
2274 server-name name ;
2275
2276 The server-name statement can be used to inform the client of the
2277 name of the server from which it is booting. Name should be the
2278 name that will be provided to the client.
2279
2280 The site-option-space statement
2281
2282 site-option-space name ;
2283
2284 The site-option-space statement can be used to determine from what
2285 option space site-local options will be taken. This can be used
2286 in much the same way as the vendor-option-space statement. Site-
2287 local options in DHCP are those options whose numeric codes are
2288 greater than 224. These options are intended for site-specific
2289 uses, but are frequently used by vendors of embedded hardware that
2290 contains DHCP clients. Because site-specific options are allo‐
2291 cated on an ad hoc basis, it is quite possible that one vendor's
2292 DHCP client might use the same option code that another vendor's
2293 client uses, for different purposes. The site-option-space
2294 option can be used to assign a different set of site-specific
2295 options for each such vendor, using conditional evaluation (see
2296 dhcp-eval (5) for details).
2297
2298 The stash-agent-options statement
2299
2300 stash-agent-options flag;
2301
2302 If the stash-agent-options parameter is true for a given client,
2303 the server will record the relay agent information options sent
2304 during the client's initial DHCPREQUEST message when the client
2305 was in the SELECTING state and behave as if those options are
2306 included in all subsequent DHCPREQUEST messages sent in the RENEW‐
2307 ING state. This works around a problem with relay agent informa‐
2308 tion options, which is that they usually not appear in DHCPREQUEST
2309 messages sent by the client in the RENEWING state, because such
2310 messages are unicast directly to the server and not sent through a
2311 relay agent.
2312
2313 The update-conflict-detection statement
2314
2315 update-conflict-detection flag;
2316
2317 If the update-conflict-detection parameter is true, the server
2318 will perform standard DHCID multiple-client, one-name conflict
2319 detection. If the parameter has been set false, the server will
2320 skip this check and instead simply tear down any previous bindings
2321 to install the new binding without question. The default is true.
2322
2323 The update-optimization statement
2324
2325 update-optimization flag;
2326
2327 If the update-optimization parameter is false for a given client,
2328 the server will attempt a DNS update for that client each time the
2329 client renews its lease, rather than only attempting an update
2330 when it appears to be necessary. This will allow the DNS to heal
2331 from database inconsistencies more easily, but the cost is that
2332 the DHCP server must do many more DNS updates. We recommend
2333 leaving this option enabled, which is the default. This option
2334 only affects the behavior of the interim DNS update scheme, and
2335 has no effect on the ad-hoc DNS update scheme. If this parameter
2336 is not specified, or is true, the DHCP server will only update
2337 when the client information changes, the client gets a different
2338 lease, or the client's lease expires.
2339
2340 The update-static-leases statement
2341
2342 update-static-leases flag;
2343
2344 The update-static-leases flag, if enabled, causes the DHCP server
2345 to do DNS updates for clients even if those clients are being
2346 assigned their IP address using a fixed-address statement - that
2347 is, the client is being given a static assignment. This can only
2348 work with the interim DNS update scheme. It is not recommended
2349 because the DHCP server has no way to tell that the update has
2350 been done, and therefore will not delete the record when it is not
2351 in use. Also, the server must attempt the update each time the
2352 client renews its lease, which could have a significant perfor‐
2353 mance impact in environments that place heavy demands on the DHCP
2354 server.
2355
2356 The use-host-decl-names statement
2357
2358 use-host-decl-names flag;
2359
2360 If the use-host-decl-names parameter is true in a given scope,
2361 then for every host declaration within that scope, the name pro‐
2362 vided for the host declaration will be supplied to the client as
2363 its hostname. So, for example,
2364
2365 group {
2366 use-host-decl-names on;
2367
2368 host joe {
2369 hardware ethernet 08:00:2b:4c:29:32;
2370 fixed-address joe.fugue.com;
2371 }
2372 }
2373
2374 is equivalent to
2375
2376 host joe {
2377 hardware ethernet 08:00:2b:4c:29:32;
2378 fixed-address joe.fugue.com;
2379 option host-name "joe";
2380 }
2381
2382 An option host-name statement within a host declaration will over‐
2383 ride the use of the name in the host declaration.
2384
2385 It should be noted here that most DHCP clients completely ignore
2386 the host-name option sent by the DHCP server, and there is no way
2387 to configure them not to do this. So you generally have a choice
2388 of either not having any hostname to client IP address mapping
2389 that the client will recognize, or doing DNS updates. It is
2390 beyond the scope of this document to describe how to make this
2391 determination.
2392
2393 The use-lease-addr-for-default-route statement
2394
2395 use-lease-addr-for-default-route flag;
2396
2397 If the use-lease-addr-for-default-route parameter is true in a
2398 given scope, then instead of sending the value specified in the
2399 routers option (or sending no value at all), the IP address of the
2400 lease being assigned is sent to the client. This supposedly
2401 causes Win95 machines to ARP for all IP addresses, which can be
2402 helpful if your router is configured for proxy ARP. The use of
2403 this feature is not recommended, because it won't work for many
2404 DHCP clients.
2405
2406 The vendor-option-space statement
2407
2408 vendor-option-space string;
2409
2410 The vendor-option-space parameter determines from what option
2411 space vendor options are taken. The use of this configuration
2412 parameter is illustrated in the dhcp-options(5) manual page, in
2413 the VENDOR ENCAPSULATED OPTIONS section.
2414
2416 Sometimes it's helpful to be able to set the value of a DHCP server
2417 parameter based on some value that the client has sent. To do this,
2418 you can use expression evaluation. The dhcp-eval(5) manual page
2419 describes how to write expressions. To assign the result of an evalu‐
2420 ation to an option, define the option as follows:
2421
2422 my-parameter = expression ;
2423
2424 For example:
2425
2426 ddns-hostname = binary-to-ascii (16, 8, "-",
2427 substring (hardware, 1, 6));
2428
2430 It's often useful to allocate a single address to a single client, in
2431 approximate perpetuity. Host statements with fixed-address clauses
2432 exist to a certain extent to serve this purpose, but because host
2433 statements are intended to approximate 'static configuration', they
2434 suffer from not being referenced in a littany of other Server Services,
2435 such as dynamic DNS, failover, 'on events' and so forth.
2436
2437 If a standard dynamic lease, as from any range statement, is marked
2438 'reserved', then the server will only allocate this lease to the client
2439 it is identified by (be that by client identifier or hardware address).
2440
2441 In practice, this means that the lease follows the normal state engine,
2442 enters ACTIVE state when the client is bound to it, expires, or is
2443 released, and any events or services that would normally be supplied
2444 during these events are processed normally, as with any other dynamic
2445 lease. The only difference is that failover servers treat reserved
2446 leases as special when they enter the FREE or BACKUP states - each
2447 server applies the lease into the state it may allocate from - and the
2448 leases are not placed on the queue for allocation to other clients.
2449 Instead they may only be 'found' by client identity. The result is
2450 that the lease is only offered to the returning client.
2451
2452 Care should probably be taken to ensure that the client only has one
2453 lease within a given subnet that it is identified by.
2454
2455 Leases may be set 'reserved' either through OMAPI, or through the
2456 ´infinite-is-reserved' configuration option (if this is applicable to
2457 your environment and mixture of clients).
2458
2459 It should also be noted that leases marked 'reserved' are effectively
2460 treated the same as leases marked 'bootp'.
2461
2463 DHCP option statements are documented in the dhcp-options(5) manual
2464 page.
2465
2467 Expressions used in DHCP option statements and elsewhere are documented
2468 in the dhcp-eval(5) manual page.
2469
2471 dhcpd(8), dhcpd.leases(5), dhcp-options(5), dhcp-eval(5), RFC2132,
2472 RFC2131.
2473
2475 dhcpd.conf(5) was written by Ted Lemon under a contract with Vixie
2476 Labs. Funding for this project was provided by Internet Systems Con‐
2477 sortium. Information about Internet Systems Consortium can be found at
2478 https://www.isc.org.
2479
2480
2481
2482 dhcpd.conf(5)