DHCP definition
DHCP stands for “Dynamic Host Configuration Protocol”. DHCP protocol allows the incoming host in the network to obtain either static or dynamic IP address.
DHCP Working
After laying down your network, you need a block of IP addresses to connect hosts to the network. For this purpose you contact your internet service provider (ISP). If you have private network then you can have your own IP addresses available from IP classes.
Once you have your IP pool. Next step is to allocate these IPs to your hosts. You can do this either manually or automatically.
The problem comes when one host comes or leaves the network. Then it becomes difficult to allocate the IP manually or update IP pool when an IP is free after leaving the host.
DHCP server can allocate the IP automatically when a new device enters the network. On the other hand when a device leaves the network it updates the DHCP pool again automatically.
For example your office has different departments and each department has its own different network. Suppose you leave accounts department and enters in the sales department.
- After you leave, dhcp server of accounts department update its dhcp pool by entering the IP address freed by your device
- Similarly when you enter in the sales department. Your device requests for IP allocation. dhcp server scans its IP pool. If any IP is available its being allotted to your device.
DHCP Configuration
DHCP supports both manual and automatic configuration. The static IP addresses are bounded against the physical address (MAC Address) off the host. This is done by the manual DHCP configuration. Once the static IPs are mapped against the physical addresses after that DHCP server automatically gives the same IP to the respective device whenever it enters into the network. These static IPs are reserved and cannot be given to other devices.
On the other hand dynamic DHCP configuration is fully automatic. whenever a DHCP client enters into the network the available IP is allocated automatically.
DHCP Process
There are four steps in a DHCP process
1. DHCP Discovery
First of all the new device i mean dhcp client needs to find DHCP server. For this it sends DHCP discovery message on DHCP port 68.The new device doesn’t know the IP address of dhcp server so it sends a broadcast message to all the devices in the network.
2. DHCP OFFER
After detecting the discovery message DHCP server sends an offer to the DHCP client with an available IP along with network mask and IP lease time. This is the amount of time for which an IP is valid.
This time could last from several hours to several days. In other words after least time ends the device is given a new IP from available DHCP pool. This stage uses DHCP port 67.
3. DHCP Request
After that DHCP client accepts the offer and replies with DHCP request message. It also requests for DHCP configuration parameters.
4. DHCP ACK
The DHCP server responds back with DHCP ACK message and also confirm the configuration parameters.
Fig-1: DHCP Process
[…] public IP address is an address which DHCP server of your ISP provides to your device. So a static public IP address is an IP which you get from your […]