DHCP Overview

The Dynamic Host Configuration Protocol (DHCP) is a network management protocol used on Internet Protocol (IP) local area networks for automatically assigning IP addresses and other communication parameters to devices connected to the network.
A device connected to the network requests an IP address using the DHCP protocol, the server assigns a unique address to the device. A device configured to use dynamic (DHCP) addressing that is connected to a different network will be assigned an address on that network without needing to be reconfigured.

DHCP operates based on the client-server model. When a computer or other device connects to a network, the DHCP client software sends a DHCP broadcast query requesting the necessary information. Any DHCP server on the network may service the request.
The DHCP server manages a pool of IP addresses and information about client configuration parameters such as default gateway, domain name, the name servers, and time servers.
On receiving a DHCP request, the DHCP server may respond with specific information for each client, as previously configured by an administrator, or with a specific address and any other information valid for the entire network and for the time period for which the allocation (lease) is valid.

A DHCP client typically queries for this information immediately after booting, and periodically thereafter before the expiration of the information. When a DHCP client refreshes an assignment, it initially requests the same parameter values, but the DHCP server may assign a new address based on the assignment policies set by administrators.

On large networks that consist of multiple links, a single DHCP server may service the entire network when aided by DHCP relay agents located on the interconnecting routers. Such agents relay messages between DHCP clients and DHCP servers located on different subnets.[1]

The imRAD provides both the DHCPv4 and DHCPv6 services.

DHCPv4[1][2]

DHCPv4[1]
DHCPv4 client state-transition diagram[1]

The DHCP employs a connectionless service model, using the User Datagram Protocol (UDP). It is implemented with two UDP port numbers for its operations which are the same as for the bootstrap protocol (BOOTP). UDP port number 67 is the destination port of a server, and UDP port number 68 is used by the client.

DHCP operations fall into four phases: server discovery, IP lease offer, IP lease request, and IP lease acknowledgment. These stages are often abbreviated as DORA for discovery, offer, request, and acknowledgment.

The DHCP operation begins with clients broadcasting a request. If the client and server are on different subnets, a DHCP Helper or DHCP Relay Agent may be used. Clients requesting the renewal of an existing lease may communicate directly via UDP unicast since the client already has an established IP address at that point.

Discovery

The client broadcasts a DHCPDISCOVER message on its local physical subnet. The DHCPDISCOVER message MAY include options that suggest values for the network address and lease duration. BOOTP relay agents may pass the message on to DHCP servers, not on the same physical subnet.

Offer

When a DHCP server receives a DHCPDISCOVER message from a client, which is an IP address lease request, the DHCP server reserves an IP address for the client and makes a lease offer by sending a DHCPOFFER message to the client. This message contains the client's client id (traditionally a MAC address), the IP address that the server is offering, the subnet mask, the lease duration, and the IP address of the DHCP server making the offer. The DHCP server may also take notice of the hardware-level MAC address in the underlying transport layer: according to current RFCs the transport layer MAC address may be used if no client ID is provided in the DHCP packet.

Request

In response to the DHCP offer, the client replies with a DHCPREQUEST message, broadcast to the server,[a] requesting the offered address. A client can receive DHCP offers from multiple servers, but it will accept only one DHCP offer.

The client also sends a DHCPREQUEST to extend its lease.

Acknowledgement(ACK) / Non-Acknowledgement(NAK)

When the DHCP server receives the DHCPREQUEST message from the client, the configuration process enters its final phase. The acknowledgment phase involves sending a DHCPACK packet to the client. This packet includes the lease duration and any other configuration information that the client might have requested. At this point, the IP configuration process is completed.

After the client obtains an IP address, it should probe the newly received address(e.g. with ARP Address Resolution Protocol) to prevent address conflicts caused by overlapping address pools of DHCP servers.

If the client's request is invalid (e.g., the client has moved to a new subnet or the client requested with an invalid "requested IP address"), the server responds to the client with a DHCPNAK message. If the client receives a DHCPNAK message, the client restarts the configuration process.

Decline

The client receives the DHCPACK message with configuration parameters. The client performs a final check on the parameters (e.g., ARP for allocated network address). At this point, the client is configured. If the client detects that the address is already in use (e.g., through the use of ARP), the client sends a DHCPDECLINE message to the server and restarts the configuration process.

Release

The client may choose to relinquish its lease on a network address by sending a DHCPRELEASE message to the server. Upon receipt of a DHCPRELEASE message, the server marks the network address as not allocated.

Information

If a client has obtained a network address through some other means (e.g., manual configuration), it may use a DHCPINFORM request message to obtain other local configuration parameters.

Relaying

In order to allow DHCP clients on subnets not directly served by DHCP servers to communicate with DHCP servers, DHCP relay agents can be installed on these subnets. The DHCP client broadcasts on the local link; the relay agent receives the broadcast and transmits it to one or more DHCP servers using unicast.

In other words, A DHCP relay agent is any host or IP router that forwards DHCP packets between clients and servers.[3]


DHCPv6[4][5]

The Dynamic Host Configuration Protocol version 6 (DHCPv6) is a network protocol for configuring Internet Protocol version 6 (IPv6) hosts with IP addresses, IP prefixes, and other configuration data required to operate in an IPv6 network. It is the IPv6 equivalent of the Dynamic Host Configuration Protocol for IPv4.
IPv6 global unicast addresses can be configured dynamically, without any manual configuration. There are three ways(i.e. SLAAC, Stateless DHCPv6, and Stateful DHCPv6) to dynamically configure the global unicast address.

DHCPv6 has its roots in DHCPv4 and there are many similarities. The following terms are specific to DHCPv6.

DUID and IAID

The MAC Address(Link-layer address) is used to identify clients in DHCPv4 but the DUID and IAID is the client's identifier in DHCPv6.

Transmission method

In DHCPv4, clients broadcast on its local subnet but DHCPv6 clients and servers use the following multicast address

  1. All_DHCP_Relay_Agents_and_Servers(FF02::1:2): All DHCPv6 servers and relay agents are members of this link-local scope multicast group. Clients use this multicast address to communicate with DHCPv6 servers and relay agents on their link.
  2. All_DHCP_Servers(FF05::1:3): All DHCPv6 servers are members of this site-local multicast group. Relay agents use this multicast address to send messages to all DHCPv6 servers within a site or when they do not know the multicast address of the server.
Lifetime

Unlike the DHCPv4, the DHCPv6 has two lifetimes. The first one is the Preferred lifetime, the second one is the Valid lifetime.

Communication Protocol and message

DHCPv6 servers and relay agents send messages to clients using UDP destination port 546. In other words, Clients listen for DHCPv6 messages on UDP port 546.
DHCPv6 clients send messages to servers and relay agents using UDP destination port 547. Server and relay agents listen for DHCPv6 messages on UDP port 547.

DHCPv6 defines various message types for client-server communications and please refer to the DHCPv6 communication.

Relaying

Relay agents exchange messages with servers to relay messages between clients and servers that are not connected to the same link. DHCPv6 Relay Agent Communication Rick Graziani, IPv6 Fundamentals, ciscocompress, Figure 9-4, 2013

Force Release

This feature can deallocate IP addresses prior to their lease time or DHCPv6 lifetime. For example, When a host was assigned "1.1.1.10" and the host moves to another VLAN, the host will be assigned a new IP address and the old IP address(i.e. 1.1.1.10) will remain in lease status until the lease time expires. In this case, none of the hosts uses the "1.1.1.10" and the address is not assigned to any host because it is still in lease status. Especially under the wireless environment, The bigger the lease time, the more such garbage addresses.
The "Force Release" feature in our product can change the status of those IP addresses to "available" and assign them to others.

Configuring DHCP

Getting started

You can basically operate the imRAD DHCP service by following two instructions.

  1. Create a DHCP pool by clicking the "Create New DHCP pool" button at the DHCP > DHCP Pool menu.
  2. Add a DHCPv4 Domain Name Servers(code 6) or DHCPv6 DNS Recursive Name Server(code 23) at the DHCP > DHCP Server options

You must configure the DHCP relay agent or helper to relay broadcasted or multicasted requests to an imRAD DHCP server.

DHCP Pool, reservation, exclusion, and IP address List
DHCP Option
Log - Lease, PostDHCP
Settings
General

References