Dynamic Host Configuration Protocol (DHCP)
A protocol is a set of rules used to determine how computers on a network communicate. The Dynamic Host Configuration Protocol (DHCP) is a protocol commonly used to automatically generate an Internet Protocol (IP) address and other configuration details, like the Domain Name System (DNS) server address, subnet mask and default gateway to client host computers connecting to a network.
Before it can connect to a local or internet network a computer, or any other device, needs to be properly configured to communicate on the network. With DHCP the configuration takes place automatically instead of manually, and as a result DHCP is often used with numerous devices that connect to networks, like computers, smartphones, servers, etc.
An Internet service provider (ISP) may utilize DHCP to assist customers in joining their networks. In addition, there are numerous home networking hardware, such as broadband routers, which also feature DHCP support to conveniently link home computers to local area networks (LANs).
Through DHCP a computer can access an IP-based network without a previously configured or permanent IP address. The DHCP provides centralized control by automatically allocating dynamic IP addresses to devices, like computers and printers. DHCP provides increased speed and flexibility by releasing and renewing the IP addresses whenever devices leave and re-join the network. In larger networks there may be a dedicated DHCP server.
There are many additional advantages to using DHCP. DHCP provides IT with an automatic resource that can quickly and easily add new clients to a network. DHCP reuses and reallocates IP addresses among numerous devices, according to use, which can significantly reduce the amount of IP addresses required throughout the network. It can also reconfigure DHCP server’s IP address space without reconfiguring each client device.
DHCP Clients & Servers
In the DHCP environment, a DHCP server must be established with the correct network configuration parameters. Within the parameters there exists a pool of available IP addresses (also known as the scope), subnet masks, and the name server addresses and network gateway. Any device that is running the DHCP client software can automatically claim the settings from DHCP servers whenever needed.
Any device that utilizes the dynamic addressing is known as a DHCP client. When a DHCP client is booted, it is assigned an IP address retrieved from the pool of available IP addresses. This IP address is then assigned to the device by the DHCP for a specific period of time known as a lease.
Leases and Reservations, APIPA
After about half of the lease has been utilized the client will attempt to renew the lease. If the renewal is not authorized the client will try again before the lease ends. If the client still does not obtain a new lease it will attempt to contact a new DHCP server. If the client does not renew the lease it returns to the address pool.
DHCP also supports Automatic Private IP Addressing (APIPA). When selected this allows computers running certain versions of Windows to configure their own IP address and subnet mask if a DHCP server is not available when the system starts up. The APIPA feature is beneficial for clients located on smaller private networks, like a small-business office or home office.
How does DHCP work?
A DHCP server and client host communicate using what is known as the DORA principle:
1. DISCOVERY: A DHCP server listens for all client hosts on the network that do not have an assigned static IP address and are broadcasting their request (discovery) to the DHCP server. 2. OFFER: After the DHCP server detects a discovery request it responds with an additional message offering its services. 3. REQUEST: When the client receives the offer from the DHCP it will send a request for a network address and additional information such as the DNS and default gateway. 4. ACKNOWLEDGEMENT: Next the DHCP server replies with the configuration data for the client to access the network.
Finally, the client uses the information provided by the DHCP to communicate on the network and other services.
Using Two DHCP Servers on One Network
There are certain instances when it may be beneficial to use two DHCP servers on one network. In networks where the client hosts are in more than one physical location on the LAN (for instance if there are clients in multiple remote locations on the network that could possibly be severed during a network event) or if the number of client hosts on the network has grown beyond the capacity of the original pool of addresses provided by the DHCP.
As previously mentioned, A DHCP and client host communicate using the DORA principle. With two DHCP servers it is impossible to predict which DHCP server will answer the discovery broadcast of the client host, if more than one server is active on a single subnet. Consequently, the same DHCP server may not be available when the client later attempts to renew their lease.
If the client host is unable to renew the lease the client will wait until it enters the rebinding state. During this time the client will broadcast an additional request to the subnet to obtain an IP configuration and continue its network communications without interruption. A different DHCP server may respond to the client host’s request. Although the original server may be available, the responding server may still reply to the client request with a negative acknowledgement message, or DHCPNAK.
A superscope can be employed to prevent this from occurring when two DHCP servers are used on one network. As previously mentioned, a scope is the range of available IP addresses. A superscope allows an administrator to add more than one scope under one DHCP’s umbrella.
Ranges (Scopes) and Exclusions
The numerical range of the IP addresses in the DHCP’s configuration pool is called the scope. The scope generally corresponds to the subnet, when a single DHCP server delegates its IP configuration. However, when there are two DHCP servers set up for a subnet, each can be configured with a scope that assigns only a portion of the entire subnet range. Also, it is possible for a single DHCP server to serve more than one scope.
An administrator must create a scope prior to enabling a DHCP server. In order to create a scope, the following properties must be defined and designated:
- Name
- Description
- Beginning IP address
- Ending IP address
- Subnet mask
- Ranges of excluded addresses
- Reserved addresses
- Lease duration
- Router address
- Domain name and the server IP address
An exclusion is simply a range of multiple IP addresses that have been excluded from a scope. The range of the numbers in the excluded addresses will fall within the starting and ending IP addresses within the scope. An exclusion range allows an administrator to reserve a hole within a scope. The IP addresses located within the hole will not be assigned.
Advantages and benefits to excluding IP addresses from a scope:
- An exclusion is necessary for the computer or device that runs the DHCP service. The DHCP service generally must have a static IP address.
- A DHCP may not be supported by the host. Not every DHCP can be supported by the host, when this is that case, the host must use a static IP address. A good example, would be an older unit that does not have a DHCP client. By establishing an exclusion for its IP address, you can reserve that address and prevent it from being assigned or utilized by another host on the network.
Conclusion
We hope this article helped you to get basic understanding of what DHCP is and how it works. You can find additional information on DHCP in this Wikipedia article which is more technical in nature.
Image courtesy of ddpavumba at FreeDigitalPhotos.net