Dynamic Host Configuration Protocol (DHCP) Services
Services that are not router-related are also available on your router — for example, the Dynamic Host Configuration Protocol (DHCP) service. You can use DHCP to hand out IP address configuration to devices on your network. Servers on your network can perform this job, but in some cases, such as in a small office without a server, you can use your router to perform this role.
When a DHCP server cannot be placed on a network, your router can also play the role of an IP Helper or DHCP Relay.
Here is the basic four-step DHCP address acquisition process:
DHCP Discover: The client device sends out a request for all DHCP servers available on the network to provide an address if they have one available.
DHCP Offer: All DHCP servers on the network that have an available address respond. The client device may receive multiple offers if multiple servers are on the network.
DHCP Request: The client chooses one offer and sends a request back to the DHCP server. Because the client is not authorized to use the offered address yet, the DHCP Request is still a broadcast. The client accepts the first offer received unless another offer matches the last IP address that the client had.
DHCP Ack or DHCP NAck: Typically, the DHCP server finalizes the process with an acknowledgment, or Ack, allowing the client device to start using the address. In rare cases, the server issues a Negative Acknowledgment, or NAck, because it may have decided that the address is not available in the milliseconds that have passed since it offered the address.
Far more likely is that a NAck would come from a second, but malfunctioning, DHCP server, which sees the DHCP Request going to the first DHCP server and refuses it because it was not the address it offered. Its refusal is the malfunctioning part of this scenario because, if the DHCP Request was not offered for the second server, it should have been ignored.
You can have multiple DHCP servers on the same network segment are configured for non-overlapping scopes (the DHCP service configuration of the configuration information it will hand out) on that network segment. One server offers an IP address, but when the client requests the address, the other server sees the request and issues a NAck, because it did not offer that address.
This situation is not supposed to happen, because a DHCP server should NAck only an address it offers. When this NAck problem starts to happen, typically all computers on your network will slowly lose their IP configuration. You can quickly identify the problem by doing a network packet capture with a tool such as Wireshark.
Wireshark tells you the IP address and MAC address of the other DHCP server. You can use the information from Wireshark to locate the offending DHCP server and shut it down.
All this traffic is broadcast traffic because until the client device receives the final acknowledgement, it is not allowed to use the offered address; so it does not have a valid IP address on the network.
Once the client has the address, it keeps the address until it reaches eight hours, or whatever the configured lease period is. At the end of the lease period, if the client has not renewed its lease or obtained a lease from another source, it has to relinquish the use of that address and attempt to reach a DHCP server to get another address.
At the same time, even if the device is turned off after getting its lease, the DHCP server has "contracted" not to give that address to any other device until the lease period expires.
Before the lease expires, the client will attempt to renew its lease to avoid being in a situation where it does not have a valid working IP address. This process works at these time intervals:
50 Percent — Lease Renewal: At 50 percent of the lease period, the client will attempt to renew its lease. This renewal is a unicast message directly to the DHCP server, which is allowed because, unlike the original lease process, the client and the server both have valid IP addresses on the network through which they can communicate.
The goal is that the client will be able to renew its lease and never be without an IP address. If the lease renewal is successful, it is renewed to the original lease period, providing that it has not been modified on the server.
So with an eight-hour lease, at four hours, the device will attempt to renew the lease and will end up with a new eight hour lease when successful. If for some reason the device is not able to renew its lease, it will continue to attempt a renewal periodically based on the client configuration.
87.5 Percent — Rebinding: If the client reaches 87.5 percent of the lease period and still has not managed to renew its lease, it will attempt to locate another DHCP server to acquire a lease. This process is identical to the original lease process.
So even though the client has a valid IP address on the network, it will send out a new DHCP discovery broadcast in an attempt to locate a valid DHCP server on the network. All DHCP servers that receive discovery requests will respond with an available address.
If there is more than one response, the client will choose one response and send out its request for that address, and then wait to receive an acknowledgement in return. If no servers respond to this discovery request, the client will periodically make additional requests based on the client settings. During this period, the client is still allowed to use the configured IP address that it had received in its original lease.
100 Percent — Lease Expiry: If the client has not located another DHCP server by the time it reaches 100 percent of the lease period, the client gives up its leased address and periodically sends out DHCP discovery requests. It continues this process until it receives a response.