Dynamic Host Configuration Protocol (DHCP) is a network management protocol used on Internet Protocol (IP) networks whereby a DHCP server provides automatic IP addressing and information to clients on a network. It can be implemented for both Internet Protocol version 4 (IPv4) and Internet Protocol version 6 (IPv6). When implemented for IPv4, it is known as DHCPv4 and when implemented for IPv6, it is regarded as DHCPv6.
DHCP version 4 (DHCPv4)
DHCPv4 uses three different address allocation methods. These are:
- Manual Allocation: This is when the network administrator assigns an apportioned IPv4 address to the client and DHCPv4 communicates only the IPv4 address to the device.
- Automatic Allocation: In this case, DHCPv4 automatically assigns a static IPv4 address permanently to a device, selecting it from a wide range of available addresses.
- Dynamic Allocation: This method involves DHCPv4 dynamically assigning or leasing an IPv4 address from a wide range of addresses for a limited period of time chosen by the server or until the client no longer needs the address.
Like all TCP connections, the TCP-based Dynamic Host Configuration Protocol makes use of the three-way handshake to establish connection. The Lease origination process is such that the client in need of an IP address sends a DHCPDISCOVER Broadcast to the DHCP server requesting for an IP address. The server will then send a DHCPOFFER Unicast acknowledging the broadcast and assigning an IP address to the client. The client will the send a DHCPREQUEST Broadcast stating that it has accepted the assigned IP address. Finally, the DHCP server will the send a DHCP ACK Unicast in acknowledgment of the acceptance of the IP address by the client.
DHCPv4 Server Configuration
A Cisco router running Cisco iOS is also capable of working as a DHCP server. To configure Dynamic Host Configuration Protocol on a router,
- Exclude addresses from the pool
- Setup DHCP Pool name
- Configure specific tasks like defining range of addresses and subnet mask, using default router command for default gateway. You can choose to add optional items like the DNS server and domain name to the pool.
To configure the router, enter the global configuration mode of the router and input the following commands:
ip dhcp excluded-address 192.168.10.1 192.168.10.9 (excluded address range) ipdhcp excluded-address 192.168.10.254 (excluded address) ip dhcp pool LAN-POOL-1 network 192.168.10.0 255.255.255.0 default-router 192.168.10.1 dns-server 192.168.11.9 domain-name practicecode.com end
To disable the configuration, in the global configuration mode, type no service dhcp
Save the running configuration to the startup configuration by typing copy run start at the privilege mode
To verify a DHCP server, Use the following commands
show running-config | section dhcp
show ip dhcp binding
show ip dhcp server statistics
DHCPv4 Relay
This is the process of using an IP helper address enables a router to forward DHCPv4 broadcasts to the DHCPv4 server. Therefore, acting as a relay. This is as shown in the configuration below: