Carrying on with the basics sessions, next up we tackle DHCP….
What is DHCP?
DHCP (Dynamic Host Configuration Protocol) is a standardized networking protocol used on IP networks that dynamically configures IP addresses and other information that is needed for Internet communication.
DHCP allows computers and other devices to receive an IP address automatically from a central DHCP server, reducing the need for a network administrator or a user from having to configure these settings manually.
DHCP servers maintain a database of available IP addresses and other kinds of addresses, such as a default route, and one or more DNS server addresses.
DHCP may be used to configure some of these settings and the remaining settings may be manually configured.
DHCP servers typically grant IP addresses to devices only for a limited interval. Devices are responsible for renewing their IP address lease before that interval expires, and must stop using the address once the interval has expired, if they have not been able to renew it.
How Does It Work?
There are a surprising number of steps which take place before your computer or mobile device can “talk” or “access” network / internet resources.
Lets look at the steps which take place from the moment you either plug in a network cable or connect to a wireless network..
It is a DHCP message that marks the beginning of a DHCP interaction between the client (your home PC or mobile phone/tablet) and server (most likely your home router (BT homehub for example)).
This message is sent by the client that is connected to the local subnet. It’s a broadcast message that uses 255.255.255.255 as destination IP address while the source IP address is 0.0.0.0
It is DHCP message that is sent in response to DHCPDISCOVER by a DHCP server (BT homehub) to DHCP client (your mobile phone/PC).
This message contains the network configuration settings for the client that sent the DHCPDISCOVER message.
This DHCP message is sent in response to DHCPOFFER indicating that the client has accepted the network configuration sent in DHCPOFFER message from the server.
This message is sent by the DHCP server in response to DHCPREQUEST received from the client. This message marks the end of the process that started with DHCPDISCOVER. The DHCPACK message is nothing but an acknowledgement by the DHCP server that authorizes the DHCP client to start using the network configuration it received from the DHCP server earlier.
This message is the exact opposite to DHCPACK described above. This message is sent by the DHCP server when it is not able to satisfy the DHCPREQUEST message from the client.
This message is sent from the DHCP client to the server in case the client finds that the IP address assigned by DHCP server is already in use.
This message is sent from the DHCP client in case the IP address is statically configured on the client and only other network settings or configurations are desired to be dynamically acquired from DHCP server.
This message is sent by the DHCP client in case it wants to terminate the lease of network address it has be provided by DHCP server.
Now we’ve looked at the steps involved, below shows a simple diagram using the steps above as to how DHCP commonly works.
As mentioned above, your device is simply assigned an IP address (leased) by the DHCP server. This means if the lease expires, the DHCP server is free to assign the same IP address to any other host or device requesting for the same.
This is why a lot of networks which see frequent client connections and disconnects (for example wifi hot spots) will have very short lease times (2-4 hours up to 8-10 hours).
Where as a lot of physical networks, which have desktops connected, you tend to find the lease is set for a longer time period (7-10 days).
It’s also worth noting that the DHCP client tries to renew the lease after half of the lease time has expired. This is done by the exchange of DHCPREQUEST and DHCPACK messages. While doing all this, the client enters the renewing stage.
That rounds off the DHCP basics…