DHCP Address Assignment

Dynamic Host Configuration Protocol (DHCP)

Used to automatically configure devices with IP addressing and other necessary information to enable them to communicate over the Internet.

How Does IPv4 DHCP Work?

Two important concepts of IP addressing are static IP and dynamic IP. A static IP address is one which is assigned to a network device. This static IP address can be subdivided into several dynamic IP addresses, each of which can be assigned to additional devices. Think of the static IP address as the address of an office building, and the dynamic IP addresses as individual suites within that office building.

When a host is first configured as a DHCP client, it does not have an IPv4 address, subnet mask or default gateway. It obtains this information from a DHCP server, either on the local network or one located at the ISP. The DHCP server is configured with a range, or pool, of IPv4 addresses that can be assigned to DHCP clients.

The DHCP server may be located on another network. DHCP clients are still able to obtain IPv4 addresses as long as the routers in-between are configured to forward DHCP requests.

Now that you have an understanding of the components of static IP and dynamic IP, it’s important to review DHCP.  DHCP stands for Dynamic Host Configuration Protocol.  The DHCP is a client/server protocol, which provides the Internet Protocol (IP) host with its IP address and other configuration information, such as the default gateway and subnet mask.  In short, the DHCP server distributes IP addresses to the various devices on a network.

Address Assignment

A client that needs an IPv4 address will send a DHCP Discover message which is a broadcast with a destination IPv4 address of 255.255.255.255 (32 ones) and a destination MAC address of FF-FF-FF-FF-FF-FF (48 ones). All hosts on the network will receive this broadcast DHCP frame, but only a DHCP server will reply. The server will respond with a DHCP Offer, suggesting an IPv4 address for the client. The host then sends a DHCP Request to that server asking to use the suggested IPv4 address.

What if DHCP server is not available at the moment?

When the DHCP server is not available, the machine will select an IP address (from 169.254.0.0 – 169.254.255.255).  The aforementioned range is reserved by the Internet Assigned Numbers Authority (IANA). The Address Resolution Protocol (ARP) is used to ensure that the chosen IP address is not already being used by another machine.  After assigning an IP address to the machine, the machine can then interact over TCP/IP with other devices on the network, which are configured for APIPA (Automatic Private IP Addressing) or are manually set to the correct address range and a subnet mask value of 255.255.0.0.