DHCP: A Classic UDP Protocol

by: burt rosenberg
at: university of miami
date: 6 april 2021

History and Purpose of DHCP

The Dynamic Host Configuration Protocol is the service that allow for people that have not taken this course can be in the Internet. It automatically configures a machine that makes its presence known by broadcast. It is returned an IP address and other network configuration necessities: the netmask, default gateway, and DNS server. We have two main reasons for studying this protocol,

The Lease

The fundamental element of DHCP is the Lease. A DHCP server will offer a IP address to the client for a certain time period. The client can renew the lease. If the client does not renew the lease, then the IP address becomes free again.

Because we begin with a client that has no network information, it must make an UDP broadcast, announcing its interest in configuration parameters. One or more DHCP servers will be on the broadcast domain listening for these requests. DHCP over larger networks is possible with relays and supplicants. These are DHCP servers that will forward the requests it hears on L3 broadcast to servers on other networks.


 FROM RFC 2131
  
                Server          Client          Server
            (not selected)                    (selected)

                  v               v               v
                  |               |               |
                  |     Begins initialization     |
                  |               |               |
                  | _____________/|\____________  |
                  |/DHCPDISCOVER | DHCPDISCOVER  \|
                  |               |               |
              Determines          |          Determines
             configuration        |         configuration
                  |               |               |
                  |\             |  ____________/ |
                  | \________    | /DHCPOFFER     |
                  | DHCPOFFER\   |/               |
                  |           \  |                |
                  |       Collects replies        |
                  |             \|                |
                  |     Selects configuration     |
                  |               |               |
                  | _____________/|\____________  |
                  |/ DHCPREQUEST  |  DHCPREQUEST\ |
                  |               |               |
                  |               |     Commits configuration
                  |               |               |
                  |               | _____________/|
                  |               |/ DHCPACK      |
                  |               |               |
                  |    Initialization complete    |
                  |               |               |
                  .               .               .
                  .               .               .
                  |               |               |
                  |      Graceful shutdown        |
                  |               |               |
                  |               |\ ____________ |
                  |               | DHCPRELEASE  \|
                  |               |               |
                  |               |        Discards lease
                  |               |               |
                  v               v               v
     Figure 3: Timeline diagram of messages exchanged between DHCP
               client and servers when allocating a new network address

DHCPDISCOVER/DHCPOFFER

The client broadcasts a request for parameters. The broadcast may contain the client MAC address. The server might use that address in the choice of its reply. The client generates a 32 bit random number, the transaction ID, (xid in the RFC) that will be repeated in subsequence replies and requests.

The server or servers return an offer. Because the client does not yet have an IP, the offer is broadcast. A server does not yet have to reserve the IP address offered. The DHCPACK will inform the client of an offered address is no longer available.

DHCPREQUEST/DHCPACK

The client broadcasts its choice from among received offers. The request is broadcast to help the server that we not selected know that their offer was not chosen. The request will identify the chosen server, and will be forward through all relays.

The server can "close the deal" by unicasting a DHCPACK to the client, or quick inform that the the deal will not close by unicasting a DHCPNACK to the client.

The Packet Format

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Author: Burton Rosenberg
Created: April 3, 2021
Last Update: April 5, 2021