70
Chapter 8 DHCP Server Operation
8.1 DHCP Server overview
This section describes the general operation of the DHCP server.
The DHCP protocol allows a host which is unknown to the network administrator to be automatically
assigned a new IP address out of a pool of IP addresses for its network. In order for this to work, the
network administrator allocates address pools for each available subnet and enters them into the
dhcpd.conf
file.
On startup, the DHCP server software reads the
dhcpd.conf
file and stores a list of available addresses on
each subnet. When a client requests an address using the DHCP protocol, the server allocates an address
for it. Each client is assigned a lease, which expires after an amount of time chosen by the administrator
(by default, 12 hours). Some time before leases expire, the clients to which leases are assigned are
expected to renew them in order to continue to use the addresses. Once a lease has expired, the client to
which that lease was assigned is no longer permitted to use the leased IP address and must resort back
to the DHCPDISCOVER mechanism.
In order to keep track of leases across system reboots and server restarts, the server keeps a list of leases
it has assigned in the
dhcpd.leases
file. This lease file is stored using ISFS, which is in turn committed to
flash memory (if available) according to user requirement, via issuing of the
“flashfs updat
e” command.
Before a lease is granted to a host, it records the lease in this file. Upon startup, after reading the
dhcpd.conf
file, the DHCP server reads the
dhcpd.leases
file to gain information about which leases have
been assigned.
New leases are appended to the end of the lease file. In order to prevent the file from becoming
arbitrarily large, the server periodically creates a new
dhcp.leases
file from its in-memory lease database,
controlled by the values of
DHCP_LEASE_UPDATE_THRESHOLD
and
DHCP_LEASE_UPDATE_PERIOD
. If
the system crashes in the middle of this process, only the lease file present in flash memory can be
restored. This gives a window of vulnerability whereby leases may be lost.
BOOTP support is also provided by this server. Unlike DHCP, the BOOTP protocol does not provide a
protocol for recovering dynamically-assigned addresses once they are no longer needed. It is still
possible to dynamically assign addresses to BOOTP clients, but some administrative process for
reclaiming addresses is required. By default, leases are granted to BOOTP clients in perpetuity, although
the network administrator may set an earlier cut-off date or a shorter lease length for BOOTP leases if
that makes sense. BOOTP clients may be served in the old way, which is to provide a declaration in the
dhcpd.conf
file for each BOOTP client, permanently assigning an address to each client.
8.2 DHCP Server Configuration
This section discusses the required format of the
dhcpd.conf
file, first as an informal guide to the simpler
aspects of server configuration, followed by a more detailed reference section.
8.3 Informal configuration guide
This section provides an overview of the DHCP server configuration process.
8.3.1 Subnets
The DHCP server software needs to know the subnet numbers and net masks of all subnets for which it
will be providing service. In addition, in order to dynamically allocate addresses, it must be assigned
one or more ranges of addresses on each subnet which it can in turn assign to client hosts as they boot. A
very simple configuration providing DHCP support might look like this:
subnet 239.252.197.0 netmask 255.255.255.0 {
range 239.252.197.10 239.252.197.250;
}
Multiple address ranges may be specified as follows:
subnet 239.252.197.0 netmask 255.255.255.0 {
range 239.252.197.10 239.252.197.107;
range 239.252.197.113 239.252.197.250;
}
If a subnet will only be provided with BOOTP service and no dynamic address assignment, the range
clause can be left out entirely, but the subnet statement must appear.