DHCP Leasing Process Explained
- March 7, 2014
admin- Posted in:
Leasing – is the process of borrowing of an IP by the device, while it is connected to the network. When the client is connected to the network for the first time, the IP is obtained from the DHCP server. It can be used for specified period of time depending on DHCP server and client configuration. If the defined time for IP is expiring soon, the lease should be renegotiated between client and server, so client could further use network. If the IP lease needs to be terminated, user or network administrator can force a lease termination.
Configuration of the DHCP server is done by network administrator. Configuration allows to choose range of available IPs that can be leased in the network. Network administration can also configure list of excluded IPs that cannot be used at any time. The length of lease can be configured, making lease time from minutes to days.
The process of first IP leasing is shown in Figure 1 and is described in details below.
-
When the workstation is connected to the network first time it broadcasts DHCP discover packet via UDP protocol to every node it can reach.
-
After DHCP receives the message, it broadcasts reply with available IP offer. (note: Network may contain multiple DHCP servers. All of them reply simultaneously.) While the offer is pending, the offered IP is withholden and would not be offered to other clients that may require new IP. Response message contains lease duration data, IP, subnet mask, and IP of the DHCP server.
-
The client would accept only first IP offer that it receives. All further offers from different DHCP servers) would be ignored or rejected. Client broadcasts confirmation message to all nodes, providing accepted IP in it to all the nodes. The DHCP servers whose IP has not been accepted, return offered IP available status, allowing it to be used for future requests.
-
Server replies to the client, that IP has been associated and leased to it. Message also might contain the DNS, gateway, or subnet information if it was requested by the client.
Figure 1. DHCP leasing process
Since all the process is just the exchange of four packets, the time for logging in to the network is very fast and therefore does not affect user experience. There is no need to repeat the process of leasing until the lease termination has started. IP information is stored in the client machine and will remain there even if the workstation is shutdown. However, if the workstation is moved to new network, it will request new IP from DHCP server.