DHCP Address Assignment

IP addresses in a home and small business networks are dynamically assigned using DHCP protocol. DHCP protocol was specifically developed as a way for new devices on a network to automatically request an IP address and other network parameters reducing the need for assigning IP addresses manually by a network administrator.

DHCP protocol IP address assignment process

Discovery

New device on a network issues a DHCPDISCOVERY packet to a destination IP address 255.255.255.255 which means that this request will be sent to all devices on a network. DHCPDISCOVERY packet is ignored by all devices on the network except the one which serves as DHCP server.

Offer

DHCP server receives DHCPDISCOVERY request from a new computer and reserves a new IP on a network. After that, it sends DHCPOFFER packet to a 255.255.255.255 IP address which means it will be received by all devices on a network including the one which sent DHCDISCOVERY request. DHCPOFFER packet will contain the IP address offered to a computer, duration of the IP address lease, subnet mask and IP address of a server. DHCPOFFER may also contain additional network options like DNS server IP addresses used by the network.

Request

After receiving DHCPOFFER packet the client computer replies to DHCP server with DHCPREQUEST packet. This packet requests IP address assignment from a DHCP server. It is possible that multiple DHCP servers may respond with DHCPOFFER packets. Only one of them should be chosen and replied to with DHCPREQUEST.

Acknoledgement

The final step in the IP address assignment process is acknowledgment. DHCP server responds to DHCPREQUEST packet with DHCPACK packet which includes information about the assigned IP address and network parameters like lease time, DNS servers, subnet mask.

IP Address Allocation Algorithm

Dynamic allocation: a range of IP addresses is assigned to DHCP server by a network administrator. Each new device is configured to request an IP address from DHCP server. IP addresses are allocated automatically from the available IP address pool and released to it if not renewed.

Automatic allocation: same as dynamic allocation but DHCP server remembers IP addresses used by devices previously connected to the network and tries to assign the same addresses to reconnecting devices.

Manual allocation: network administrator uploads a predefined IP address assignment table based on the MAC addresses of the connecting devices. DHCP server uses this table to assign IP addresses.