Imagine we have 100 PCs on the network and we need to configure their network parameters like IP address, subnet mask, default gateway, DNS servers, domain name, NTP servers and the like. We need to be cautious and make sure that,
- The assigned IP address to the PC is unique within the network.
- All nodes have the right default gateway, domain name, DNS server etc.
Manually assigning IP address and network parameters to each of the 100 PCs is a tedious task and prone to errors. Would it not be great to have a server that hands out unique IP address and the right network configuration to all the PCs without any manual intervention ? That’s exactly what DHCP does.
The Dynamic Host Configuration Protocol (DHCP) is a standardized network protocol used on Internet Protocol (IP) networks for dynamically distributing network configuration parameters, such as IP addresses for interfaces and services. With DHCP, computers request IP addresses and networking parameters automatically from a DHCP server, reducing the need for a network administrator or a user to configure these settings manually.
The protocol operates based on the client–server model. When a computer or other networked device connects to a network, the DHCP client software sends a broadcast query requesting 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 request, the 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 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.
Methods of DHCP IP address Allocation :
Depending on implementation, the DHCP server may have three methods of allocating IP addresses:
- Dynamic allocation: a network administrator reserves a range of IP addresses for DHCP, and each DHCP client on the LAN is configured to request an IP address from the DHCP server during network initialization. The request-and-grant process uses a lease concept with a controllable time period, allowing the DHCP server to reclaim (and then reallocate) IP addresses that are not renewed.
- Automatic allocation: the DHCP server permanently assigns an IP address to a requesting client from the range defined by the administrator. This is like dynamic allocation, but the DHCP server keeps a table of past IP address assignments, so that it can preferentially assign to a client the same IP address that the client previously had.
- Manual allocation: commonly called “Static allocation”, the DHCP server allocates an IP address based on a preconfigured mapping to each client’s MAC address. This feature is variously called static DHCP assignment by DD-WRT, fixed-address by the dhcpd documentation, address reservation by Netgear, DHCP reservation or static DHCP by Cisco and Linksys, and IP address reservation or MAC/IP address binding by various other router manufacturers.
DHCP Relay Agent:
The DHCP query broadcast from the client(PC) can not go beyond its network. Meaning there should a DHCP server within its network or the PC doesn’t get the IP address. What if we want the PCs in different networks be able to contact and get the IP address from a single DHCP server ? We have DHCP relay agent to do just that.
The DHCP relay agent takes the DHCP query from the client and broadcasts on to the network having DHCP server on behalf of the client. When the server replies with the IP address, the relay agent hands out it the client. Imagine the relay race and you’ll get the idea.
In 1984, the Reverse Address Resolution Protocol (RARP), defined in RFC 903, was introduced to allow simple devices such as diskless workstations to dynamically obtain a suitable IP address. However, because it acted at the data link layer it made implementation difficult on many server platforms, and also required that a server be present on each individual network link. Soon afterwards it was superseded by the “Bootstrap Protocol” (BOOTP) defined in RFC 951. This introduced the concept of a relay agent, which allowed the forwarding of BOOTP packets across networks, allowing one central BOOTP server to serve hosts on many IP subnets.
DHCP is based on BOOTP but can dynamically allocate IP addresses from a pool and reclaim them when they are no longer in use. It can also be used to deliver a wide range of extra configuration parameters to IP clients, including platform-specific parameters. It was first defined in RFC 1531 in October 1993; but due to errors in the editorial process was almost immediately reissued as RFC 1541.
Four years later the DHCPINFORM message type and other small changes were added by RFC 2131; which remains as the current standard for IPv4 networks.
DHCPv6 was initially described by RFC 3315 in 2003, but this has been updated by many subsequent RFCs. RFC 3633 added a DHCPv6 mechanism for prefix delegation, and stateless address autoconfiguration was added by RFC 3736.