Dynamic Host Configuration Protocol

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

by Alan Frank

Tutorial Index

Lesson 91: Dynamic Host


Configuration Protocol
Automatic assignment of IP numbers to network
clients on boot-up eliminates some of IP's
administrative complexity.

As an open, standards-based protocol that is robust and WAN


efficient-not to mention the fact that it's the protocol of the
Internet-TCP/IP offers many advantages over other network
protocols. But like anything else, TCP/IP has a downside. Its
biggest drawback is administrative complexity; great effort is
required to keep a TCP/IP network running well.

The problem stems from the protocol's need to have a valid IP


address for every device on the network. If you've worked with
TCP/IP networks, you're probably aware of several important
rules that network administrators must follow when assigning
IP addresses:

The IP address must consist of four bytes (four eight-bit


numbers).
Each IP address must be unique.
All devices on a segment must have the same network number
and subnet number.
Each subnet number must be unique.

Communicating with nodes on a different subnet or a different


network requires a router.

(For more information on TCP/IP addressing, see the Tutorial


by Steve Steinke in the October 1995 LAN Magazine issue,
"Lesson 86: IP Addresses and Subnet Masks," page 27.)

Assigning an IP address to a node-and doing it correctly-can


be a significant administrative hassle. In particular, you need
to track the addresses that have been assigned in order to
avoid duplication. Moreover, if a node is moved to a different
subnet, the subnet portion of the address must be changed to
that of the new subnet. You also need to check that the

1 of 5
node-specific portion of the IP address (the remainder, after
you exclude the subnet bits) doesn't conflict with any other
node on the new subnet.

AUTOMATING THE JOB

Keeping track of IP address assignments and making new


assignments sounds like the perfect kind of mind-numbing task
to delegate to computers-and it is! The Dynamic Host
Configuration Protocol (DHCP) was developed, fairly recently,
to accomplish that exact job. DHCP is fully described in the
Internet Requests for Comments (RFC) 1541, but I'll
summarize the highlights.

DHCP is based upon the Bootstrap Protocol (BOOTP), a


system for automatically delivering configuration information
from a BOOTP server to BOOTP clients on boot-up-the point
when clients first connect to the network.

Under DHCP, a computer is designated as the DHCP server.


All of the other computers on the network-at least, those that
need an IP address-will be DHCP clients (computers that
already have a permanently set IP address don't need to
participate). The network administrator needs to initially
configure the DHCP server. Part of that configuration process
involves assigning the DHCP server a block of IP address
numbers that it can dispense to nodes that need IP addresses.

When a new node comes onto the network-assuming it is


capable of being a DHCP client-it will broadcast a request for
an IP address. Simply put, the DHCP server will respond by
checking its table of address assignments, selecting the next
available address, and sending a response back to the
requesting node.

The actual process is more complex than that, as the


requesting client must first find a DHCP server. Also, the
protocol is constructed so that a client may negotiate with more
than one DHCP server.

Here's how it works: A DHCP client that is in need of


configuration broadcasts a dhcpdiscover packet in search of
servers. This packet will contain the hardware address of the
requesting client, for example, its Ethernet or Token Ring
address. It might also contain a suggested IP address. Next,
one or more DHCP servers will evaluate the request and
respond with a dhcpoffer packet, which contains an offer of a
specific IP address, together with a "lease period" (the length
of time the client may use the address).

2 of 5
The client then selects one from among the dhcpoffer packets
it receives. (The client's selection will depend on its design; it
may seek the longest lease, for example.) The client then
issues a dhcprequest packet, which contains the address of
the server that issued the dhcpoffer it prefers.

The chosen server then issues an acknowledgment packet


(dhcpack), which closes the negotiations. The dhcpack packet
contains the IP address and lease period that have been
agreed upon. The server now marks this address as
committed; it cannot be assigned to any other client for the
duration of the lease. The client configures itself to use its new
assigned address and begins normal network operation.

Note that more than one DHCP server may respond to a


dhcpdiscover with a dhcpoffer. The client must pick one offer,
responding with a dhcprequest packet containing the server
identifier for the server it has chosen. The other servers
monitor the dhcprequest packet and infer from the server
identifier that their offers were not chosen; they then know that
the IP addresses they offered are still available for assignment
to another client.

As mentioned, the selected server finalizes the offer by issuing


the dhcpack, but in the event that the server cannot commit the
configuration, it will issue a dhcpnak
(negative-acknowledgment) packet. In this case, the client
must start the whole request process over again, from the top.

DISPENSING IP ADDRESSES

DHCP provides for IP addresses to be allocated in three


different ways: With automatic allocation, the DHCP server
assigns a permanent IP address to a DHCP client requesting
an address. Using dynamic allocation, the DHCP server would
assign an IP address for a limited period of time (the "lease
period") or until the DHCP client specifically relinquishes it,
whichever comes first. The third method is manual allocation in
which the IP address is chosen by the network administrator,
but the DHCP server is used to convey the assignment to a
DHCP client.

Dynamic allocation is particularly useful for computers that will


connect to the network only occasionally. When a DHCP client
is about to disconnect from the network, and thus no longer
needs an IP address, it can notify the DHCP server, which can
then reassign the number to the next node that needs an
address. Dynamic allocation makes more efficient use of a

3 of 5
limited number of IP addresses. A group of occasional users,
for example, can share a smaller pool of IP addresses than if
each required a permanent address of its own.

Dynamic allocation won't work for every node, however. If the


IP addresses of network servers were to change frequently
and randomly, network clients would have a hard time finding
servers. Thus, as a general rule, it's best to use static
addresses for servers and dynamic addresses for clients.

As mentioned earlier, DHCP is an offshoot of BOOTP. Where


DHCP differs from BOOTP is that the BOOTP server merely
stores a preset configuration for a BOOTP client and delivers it
on boot-up. It doesn't eliminate the need to set up a
configuration for the client. DHCP, by contrast, automatically
configures DHCP clients, using rules preestablished by the
administrator.

When setting up DHCP on a network you must decide where


to locate the DHCP servers. You could put one server on each
subnet, or you could have one central DHCP server to which
all the clients must connect in order to get an IP configuration.
Because much of the communications between DHCP clients
and servers take place via broadcasts, the central DHCP
server approach requires that routers be capable of forwarding
DHCP packets or that some other type of "relay agent"
forwards the packets. BOOTP uses relay agents, and DHCP
takes advantage of this. The format of DHCP packets is
specifically designed to be nearly identical to BOOTP packets,
so that BOOTP relay agents can forward DHCP packets.

WHO'S USING IT

DHCP is a relatively new protocol, with the first RFCs issued in


1993. Several vendors, however, have already adopted it and
developed products that support it. Most prominently, perhaps,
is Microsoft, which has built DHCP server capability into
Windows NT 3.5 and higher. Windows for Workgroups 3.11
and Windows 95 both have DHCP client capability. Thus, you
could set up one or more Windows NT Servers to be DHCP
servers. Other networked nodes running Windows 95,
Windows for Workgroups, Windows NT Workstation, or
Windows NT Server could be DHCP clients.

Apple's Open Transport (the successor to MacTCP) includes


DHCP client capability. SunSoft's (Mountain View, CA)
SolarNet PC Admin network management software includes a
DHCP server. Many of the third-party TCP/IP packages for
Windows have DHCP client capability. At press time, On

4 of 5
Technology (Cambridge, MA) had announced a DHCP server
NLM for NetWare 3.11 and 4.x file servers.

THE SIMPLE LIFE

DHCP can simplify life dramatically for managers of TCP/IP


networks. It automates the process of assigning an initial IP
address to a client, easing the task of adding new clients to a
network. Moreover, if a client moves from one subnet to
another, DHCP can make the appropriate adjustments to the
client's IP configuration. Lastly, dynamic allocation lets you
time-share a block of IP addresses among many clients,
reducing the total number of IP addresses required.

5 of 5

You might also like