3 dhcp.conf \- dynamic host configuration protocol configuration
13 contains the configuration for the DHCP client/server program
15 This text is a long summation of all the elements that can be found in this
16 configuration file. For a more "just tell me what to do" approach see
19 The syntax used is that of the common configuration file described in
22 To find information for a client we first need its IP address. Occasionally
23 this IP address is already known (the special "INFORM" query), but normally
24 we have to make a first pass through the configuration file for a
26 entry. If that fails then we use an IP address from the pool file. If we
27 now have an IP address then the real information gathering can begin.
29 The DHCP daemon reads the configuration file from beginning to end and
30 gathers all information that matches, and information from all macros that
31 are mentioned within the elements that match. If we end up with DHCP
32 information that includes at least a netmask definition, and is good for the
33 network the request came in from, then it is returned to the client. If a
34 DHCP tag is specified twice then the last one wins.
36 In the description below we use [ and ] to denote optional things, and | to
37 show a choice between two things.
39 Client IDs can be either ordinary Ethernet addresses, that are treated as a
40 seven octet string (01 followed by the Ethernet address), or any random
41 octet string in hexadecimal.
43 IP addresses can be simply that, or host names. These host names are
48 itself using a domain based prefix match, i.e. you can use "flotsam" for
49 "flotsam.example.com", but not "alpha" for "alphabeta". Once the program
50 decides to be a server it will also look up names normally in the DNS.
51 If a host has more than one IP address then the address on the network the
52 query was seen on is used.
54 Case isn't important in the configuration file, "client", "CLIENT" and
55 "ClIeNt" are all treated the same.
57 Some elements may optionally name a macro or a curly braces enclosed
58 parameter list of more elements. If the element matches then the data
59 in the macro body or parameter list is gathered.
61 The following elements can be used:
67 .RI [ macro |{ params }];
70 Defines a client with a given client ID that is to have the IP address
73 On the first pass only the client ID is matched looking for an IP address
74 that lies on the network the request came in on. On the
75 information gathering pass both client ID and IP address must match. If
76 a machine has the same Ethernet address on two or more interfaces then the
77 IP address given out is the one on the same network as the request came in
78 on. The optional interface name
80 must be used if the DHCP daemon is gathering data for itself at boot time
81 to differentiate interfaces with the same ethernet addresses. This is
82 only necessary under Minix-vmd when ethernets on different VLANs share
83 the same physical ethernet. The interface name is only used for a machine's
84 own networks, it ignored on entries for other hosts.
89 .IR macro |{ params };
92 Includes the macro or parameters if one of the class names is matched. A
93 host normally includes a class ID in its request. MINIX 3 and Minix-vmd
94 use "Minix" as the class name. For Windows the class ID starts with
95 "MSFT", and Solaris' starts with "SUNW".
98 to find out what the full IDs are exactly.) The class names are matched if a
100 is a prefix of the class ID sent by the client.
105 .IR macro |{ params };
108 Includes the macro or parameters if the IP address of the client matches the
109 host specification. This can either be an ordinary hostname, or a netblock
110 in CIDR notation, e.g. 172.35.0.0/16. The example includes all IP addresses
111 whose top 16 bits are the same as the top 16 bits of 172.35.0.0. Such a
112 netblock automatically defines a netmask (255.255.0.0 in the example) if no
113 netmask has been specified yet.
119 .RI [ macro |{ params }];
124 set the IP address of interface
126 (where # is a number) to the IP address denoted by
128 This element should only be used for interfaces that are not true Ethernets,
129 and so do not have a unique Ethernet address that can be used for a client
130 element. If the machine has at least one true Ethernet then all interface
131 elements should be added to the parameter list of a host or client element
132 for that Ethernet interface. This binds them to that machine and allows a
133 single configuration file to be shared among machines. Especially a server
134 should never have "free" interface elements. The macro or parameters are
135 only evaluated if data is gathered for the given interface. (Note that they
136 will be hidden by a client element for another interface.)
143 Include the parameter list of the macro named
145 defined elsewhere. (This means that "host flotsam stuff" is just short
146 for "host flotsam { macro stuff; }".)
154 Defines a macro with the given parameter list. Whenever the macro is used
155 the parameter list is substituted instead. A macro can not be defined
156 within another parameter list.
181 set special options for the interface that it is gathering data for, or the
182 interface denoted by the optional
184 argument. The options are:
189 Be a DHCP server on the network connected to the interface. Add the word
191 if DHCPINFORM requests must be answered for hosts we don't have an address
198 Be a DHCP relay to the indicated host.
203 Do not disable the interface if the DHCP lease expires. Useful if the
204 DHCP server of the provider is unreliable, crashing a lot and causing the
205 lease to expire. (Think twice before turning this option on. You have to
206 be absolutely sure that it's the DHCP server that's the culprit and not
207 a flaky network. You don't want an IP address conflict to be your fault.)
213 Use the given name as our hostname in the DHCP queries. Some sites key on
214 that bit of information instead of a client ID.
219 .I number name type granularity
223 Defines a DHCP tag for the given tag number and gives it a name. The name can
224 be used in the configuration file to set tag values when gathering data.
234 to specify the type of the tag as a simple string, a boolean, an IP address,
235 a number, or a string of octet values.
238 field specifies that that number of items must be given or a multiple
239 thereof, unless the type is a number, then it is the size of the number (1,
243 field tells the maximum number of items that may be used with the tag, with
244 0 meaning "unlimited".
246 Three tags, the ones that MINIX 3 really cares about, have been predefined,
247 and there are also a few pseudotags predefined for the static fields in a
248 DHCP packet that one may want to set:
253 tag ? sname ascii 1 64;
254 tag ? file ascii 1 128;
255 tag 1 netmask ip 1 1;
256 tag 3 gateway ip 1 0;
257 tag 6 DNSserver ip 1 0;
262 .B /usr/etc/dhcptags.conf
263 contains tag definitions for all standard DHCP tags. It is wise to include
264 this file at the top of any DHCP configuration file.
271 Removes a tag with the given name from the data gathered at this point.
272 Useful if one host is different from all others, for instance if it doesn't
273 need a gateway definition, because it happens to be the gateway.
276 .IR "ascii-tag string" ;
279 Adds an ASCII tag to the gathered data. The string can be a simple word, or
287 Set a boolean tag to be false or true. (Encoded as a octet of value 0 or 1.
288 Note that if you prefer to use 0 or 1 instead of false or true then you can
289 define a boolean tag as a size 1 number instead.)
292 .IR "ip-tag host" " ...;"
295 Sets a tag that needs one or more IP addresses. The host names are
296 translated as usual. To make it easier to specify netmasks one can use a
297 slash followed by a number, e.g.
299 which is a handy alternative for
300 .BR "netmask 255.255.255.224" .
303 .IR "number-tag number" " ...;"
309 .IR "octet-tag hexdigits" ;
312 Set an octet string tag.
314 is a series of hexadecimal digits that are two by two used to set the
319 As an example the DHCP configuration used by the author of this document is
320 included. His network at home consists of a number of PCs, an ISDN router
321 named rhone and a PC named saone serving as router/tunnel to/via a cable
322 ISP. Both the rhone and the saone connect the home net to the network of
323 the Vrije Universiteit, but the rhone is only active if the cable doesn't
326 The saone is a DHCP server, and one of the ordinary PCs is a backup DHCP
327 server. Both use the same configuration file, which is added below, with
328 extra commentary introduced by
330 at a deeper indent level:
332 .de xS \" Example start
337 .de xE \" Example end
341 .de cS \" Commentary start
347 .de cE \" Commentary end
352 include /usr/etc/dhcptags.conf;
355 With the help of the tag definitions we can use tags like "DHCPlease".
358 host 130.37.102.64/27 {
359 DNSserver saone darask;
360 host 130.37.102.88/29 { DHCPlease 259200; }
364 This defines the network 130.37.102.64/27, with netmask 255.255.255.224
365 (implicit from the network definition). The DNS servers for this net are
366 saone and darask. A smaller subrange of addresses is used as an address
367 pool on the saone, so a lease of 259200 seconds (3 days) is defined. The
368 netmask is still /27, as set by the outer network definition.
371 host 130.37.102.248/30 {};
374 A network of two addresses for routing tests.
379 option ip1 possessive;
380 interface ip2 saone-net2;
381 DNSserver 130.37.24.3 130.37.24.6;
385 With the network definitions done we turn our attention to the hosts. Saone
386 is a DHCP server on its main interface. The second interface
388 is connected to the cable modem. It gets its address from the cableco's
389 DHCP server, and if that server decides to go deaf then the saone keeps
390 the interface up ("possessive") even if the lease expires. The pseudo IP
393 is set to the IP address of
395 one side of the encrypted tunnel over the cable to a Minix-vmd box at the VU.
396 The DNS servers specified override the default setting for the network, naming
397 two external servers at the VU that know the world.
403 class MINIX 3 { DNSserver saone 130.37.24.3 130.37.24.6; };
407 The darask is also a server, the backup for saone on the odd chance that it
408 is unavailable. It uses saone and the external name servers, but only
409 when it is running MINIX 3. When running Windows it only uses saone.
413 client 0:1:1b:a:68:ce darask; # NE2000
414 client 0:1:1b:a:77:23 burask; # NE2000
415 #lient 0:0:c0:b0:da:64 burask; # WD8013EWC
416 client 8:0:5a:38:b2:f finiah; # PCMCIA NE2000
417 client 0:0:c0:3a:12:10 bardelask; # WD8003
418 #lient 2:60:8c:ab:8a:6d bardelask; # 3C503
419 client 0:a0:c5:20:9:6d rhone;
420 client 0:1:1b:a:4c:3b saone; # NE2000
421 #lient 0:0:c0:fb:2:6a saone-net1; # WD8013EWC
424 Lastly the ethernet addresses of all the hosts are listed, so that they can
425 be translated to IP addresses. The lines that are commented out are for
426 extra network cards that are currently unused. The last is used to connect
427 to the cable modem, so it's only here because it's nice to have the ethernet
428 address written down somewhere.
432 The host names shown above are translated by DHCP using this
436 .ta +\w'130.37.102.249mm'u
440 130.37.102.65 darask.kjb.upwind.org
441 130.37.102.66 burask.kjb.upwind.org
442 130.37.102.67 finiah.kjb.upwind.org
443 130.37.102.68 bardelask.kjb.upwind.org
444 130.37.102.69 roniah.kjb.upwind.org
446 130.37.102.70 saone.kjb.upwind.org
447 130.37.102.2 saone-net2.kjb.upwind.org
449 130.37.102.88 rhone.kjb.upwind.org
450 130.37.102.89 dyn89.kjb.upwind.org
451 130.37.102.90 dyn90.kjb.upwind.org
452 130.37.102.91 dyn91.kjb.upwind.org
453 130.37.102.92 dyn92.kjb.upwind.org
454 130.37.102.93 dyn93.kjb.upwind.org
455 130.37.102.94 dyn94.kjb.upwind.org
457 130.37.102.249 tst1.kjb.upwind.org
458 130.37.102.250 tst2.kjb.upwind.org
463 .B /usr/etc/dhcptags.conf
464 A supplied list of standard tag definitions as per RFC-1533. (Well, the
465 tag numbers and their meaning are standard, the names are made up.)
476 needs increases with the size of configuration file. MINIX 3 can
481 You have to increase the stack size to accommodate more. (No problem under
482 Minix-vmd, of course.)
484 Items that are only necessary for a certain host should only be specified
485 for that host. Items for a whole network are best added to a netblock
486 specification. Use class elements for a certain type of host, and macros
487 for exceptions. Try to limit information as much as possibly to those hosts
488 that need it. (Don't go overboard. A MINIX 3 machine won't be bothered by a
491 DHCPINFORM requests should always be answered when being a server, but
492 J. Random Sysadmin trying to diagnose problems doesn't like it when little
493 MINIX 3 machines show up in a packet trace unexpectedly. It's best to be
494 inconspicuous on a network you don't own.
496 There are a few too many subtle mistakes one can make.
498 Kees J. Bot <kjb@cs.vu.nl>