Dynamic Host Configuration Protocol (DHCP)
Hello? Hi! Can I have an IP? Sure!
NETWORKING
1/11/20252 min read
The Dynamic Host Configuration Protocol (DHCP) manages TCP/IP networks by automatically assigning IP addresses and other network configurations such as the subnet mask, default gateway and DNS server to the requesting host. This allows connected devices to exchange information. The IP addresses assigned to a device from DHCP are leased. This means after a set length of time or until the device is shutdown the IP address is then returned to the pool of addresses and assigned a new one. Address Reservation is a setting that exempts clients from receiving a different IP address by identification via MAC address.
Allocation:
Dynamic - the default for what DHCP does where everything is done automatically.
Manual - network configuration is set manually at the device.
For Control Panel > Network Connections use Windows key + R > ncpa.cpl
Components:
Server - handles communication with client devices and answers IP address requests by leasing an available one from the pool that it then will renew at a later time.
Client - could be a requesting computer, mobile or IoT device.
Scope - the range of IP addresses available that are usually assigned from smallest to largest.
Subnet - networks are often divided into pieces to manage traffic and improve performance. Each subnet can have its own DHCP server or relay agent.
Relay - in large or complex networks, relay agents are used to forward DHCP requests from clients to the server and responses from the server back to the clients. They are necessary when a single DHCP server needs to manage multiple LAN segments.
Packet Process:
DHCPDISCOVER - client broadcast message over the network to establish a network connection to the DHCP server over ports 67 (server) / 68 (client).
DHCPOFFER - DHCP server reserves an IP address and other network configuration settings including subnet mask, default gateway, DNS server and shares it with the client through an offer.
DHCPREQUEST - the client responds to the offer and makes a request for use of the configuration.
DHCPPACK - the server acknowledges the broadcast request from the client and sends over the the required network configuration.
Troubleshooting:
IP Address Conflict - when two devices on the same network end up with the same IP address causing communication issues. The conflicting device must be assigned a different IP address.
"This town ain't big enough for both of us."
DHCP Server Unavailable - a server down situation causes connected devices to not receive an IP address. Ensure uptime and redundancy to avoid this. (If client-based Windows key + R > services.msc > DHCP Client)
169.254.0.1 to 169.254.255.254 IP Addresses - the Automatic Private IP Address (APIPA) assigned by the device when it cannot obtain a valid IP address from a DHCP server. This can be caused by a misconfigured DHCP server, router not functioning properly or a bad network cable connection. Manually configure a static IP address, check DHCP deny list, check the network cable connection and condition and restart the router. Windows key + R > cmd > netsh winsock reset catalog > netsh int ip reset reset.log > ipconfig/release > ipconfig/renew.
Lease Expiry - when a device cannot connect the cause may be because the lease expired on the IP address. Windows key + R > cmd > ipconfig/release > ipconfig/renew.