Introduction to DHCPv4 – Exclusive Explanation

Every device on the Internet, and every device on any network, needs a unique IP address. Network administrators can assign static IP addresses to routers, servers, and printers whose locations are not likely to change. The IP addresses assigned to these devices are usually not changed. The static addresses also enable administrators to manage these devices remotely because the network administrator can easily access a device when they determine its IP address.

The users in an organization and a network usually change locations physically and logically. So, it is very difficult and time-consuming for network administrators to assign new IP addresses every time an employee changes their location. Also, manually assigning and setting the correct network parameters is not easy for mobile employees working from remote locations.

The Dynamic Host Configuration Protocol (DHCP) server was introduced to assign IP addresses automatically. Using a centralized DHCP server, administrators can assign IP addresses dynamically from a single server. The DHCP server makes IP address management effective and ensures consistency across the organization and its branch offices. DHCP has two versions: DHCPv4 for IPv4 addresses and DHCPv6 for IPv6 addresses. Our focus will be on DHCPv4 in detail.

DHCPv4 can assign IPv4 addresses, including other network parameters dynamically. A dedicated server for DHCPv4 is a useful, time-saving, and easy-to-manage tool for network administrators. Although, in a small office and organization, a Cisco router can be configured to provide DHCPv4 services without a dedicated server. A Cisco IOS also provides an “Easy IP” like a full-featured DHCPv4 server. DHCPv4 has three different address allocation mechanisms:

  • Manual Allocation– The DHCPv4 communicates with a pre-allocated IPv4 address assigned manually to the network devices.
  • Automatic Allocation– DHCPv4 automatically assigns IPv4 addresses to a device permanently from a pool of available addresses.
  • Dynamic Allocation– DHCPv4 dynamically assigns IPv4 addresses from a pool of addresses for a limited period. The server assigns an address to a device on lease bases for a specific period.

Using dynamic allocation, clients lease IP addressing information from a DHCP server for a specific period. The administrator defines the lease time according to the network resources and requirements and sets the leases to time out at different intervals. When the lease expires, the client must ask for another address, although the client is typically reassigned to the same address. The figure below illustrates the DHCP process.

DHCPv4 Operation

As the figure above illustrates, when a client computer communicates with a DHCPv4 server, the server assigns or leases an IPv4 address to that client, and the client connects to the network with that leased IP address until the lease expires.

Usually, IP servers assign IP addresses on a lease basis; therefore, the client must contact the DHCP server periodically to renew the lease. When a lease expires, the DHCP server adds the IP address to the pool, where it can be reallocated as needed. When the client boots or wants to connect and join a network, it begins the process to obtain an IP address on lease bases. The client starts the process with a broadcast DHCPDISCOVER message.

DHCP Discover (DHCPDISCOVER)

The client does not have a valid IPv4 address at bootup; therefore, it uses the DHCPDISCOVER message to find the DHCPv2 server for IP address information. It uses Layer 2 and Layer 3 broadcast addresses to communicate with the server. The figure below illustrates the DHCPDISCOVER message.

DHCP Offer (DHCPOFFER)

Once the DHCPv4 server receives a DHCPDISCOVER message from the client, it reserves the available IPv4 address for that client and creates an ARP packet containing the requesting client’s MAC address and the leased IPv4 address for that client.

The figure below illustrates the DHCPOFFER message to the requesting client. The DHCPOFFER message is sent as a unicast message, using the server’s Layer 2 MAC address as the source and the client’s Layer 2 MAC address as the destination.

DHCPv4

DHCP Request (DHCPREQUEST)

The client accepts the first DHCPOFFER message received and sends back a DHCPREQUEST message to the server. Many large networks use multiple DHCPv4 servers, so the DHCPREQUEST serves as a binding receipt notice to the chosen server for the offered information.

The message also implicitly declines any other servers that may have provided the client with a binding offer. The message is also sent back as a broadcast to inform all available servers in the network. The DHCPREQUEST is also used for lease renewal.

DHCP Acknowledgment (DHCPACK)

The server replies with a DHCPACK message to finish the DHCP session. DHCPACKt verifies the lease information with an ICMP ping to the leased address to check that it is not used elsewhere.

If the address is not being used, a new ARP entry for the client lease will be created, and a unicast DHCPACK message will be sent. This message is a duplicate DHCPOFFER message, excluding a change in the message type field.

After receiving the DHCPACK, it records the address configuration information and performs an ARP lookup for the assigned address. If there is no response to the ARP, the client knows that the IPv4 address is valid and starts using it as its own. The figure below illustrates the DHCPACK message.

Lease Renewal

When the lease period has expired, the client sends a DHCPREQUEST message as unicast directly to the DHCPv4 server that previously offered the IPv4 address. If a DHCPACK is not received within a particular time, the client sends DHCPREQUEST messages as broadcasts to get and renew an IP address from other DHCPv4 servers.

When the server receives the DHCPREQUEST message from the client, the server verifies the lease information using a DHCPACK message. The figure below illustrates the DHCP renewal process of DHCPv4.