71
8.3.2 Lease Length
DHCP leases can be assigned almost any length from zero seconds to infinity. What lease length makes
sense for any given subnet, or for any given installation, will vary depending on the kinds of hosts being
served. It is possible to specify two lease lengths: the default length that will be assigned if a client does
not request a particular lease length, and a maximum lease length. These are specified as clauses to the
subnet
command:
subnet 239.252.197.0 netmask 255.255.255.0 {
range 239.252.197.10 239.252.197.107;
default-lease-time 600;
max-lease-time 7200;
}
This subnet declaration specifies a default lease time of 600 seconds (ten minutes), with a maximum
lease time of 7200 seconds (two hours). Other common values would be 86400 (one day), 604800 (one
week) and 2592000 (30 days)
8.3.3 BOOTP Support
Each BOOTP client must be explicitly declared in the
dhcpd.conf
file. A very basic client declaration will
specify the client network interface’s hardware address and the IP address to assign to that client. If the
client needs to be able to load a boot file from the server, that file’s name must be specified. A simple
bootp client declaration might look like this:
host haagen {
hardware ethernet 08:00:2b:4c:59:23;
fixed-address 239.252.197.9;
filename "/tftpboot/haagen.boot";
}
This would probably require an explicit communication with a TFTP server to actually obtain the named
file.
8.3.4 Options
DHCP (and also BOOTP with Vendor Extensions) provide a mechanism whereby the server can provide
the client with information about how to configure its network interface (e.g., subnet mask), and also
how the client can access various network services (e.g., IP routers). These options can be specified on a
per-subnet basis, and, for BOOTP clients, also on a per-client basis. In the event that a BOOTP client
declaration specifies options that are also specified in its subnet declaration, the options specified in the
client declaration take precedence. A reasonably complete DHCP configuration would take the
following form:
subnet 239.252.197.0 netmask 255.255.255.0 {
range 239.252.197.10 239.252.197.250;
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 239.252.197.255;
option routers 239.252.197.1;
}
Note that the DHCP client cannot use all the options given in RFC2132 to actually configure its own IP
stack. However, the DHCP server can supply any of the options given there - this could be useful when
using, for example, a DHCP server with several Microsoft
®
DHCP clients.
8.4 Configuration reference guide
The DHCP configuration file,
dhcpd.con
f, is a free-form ASCII text file. The file may contain extra tabs
and newlines for formatting purposes. Keywords in the file are case-insensitive.
Comments may be placed anywhere within the file (except within quotes). Comments begin with the #
character and end at the end of the line.
The file essentially consists of a list of statements. Statements fall into two broad categories – parameters
and declarations.
Parameter statements indicate how to do something (e.g., duration of offered lease), whether to do
something (e.g., provision of IP addresses to unknown clients), or what parameters to provide to the
client (e.g.,
use gateway 220.177.244.
7).
Declarations are used to describe the topology of the network, to describe clients on the network, to