What is DHCP Server?
DHCP stands for Dynamic Host Control Protocol.
A DHCP server is one of the most essential part of any big network. Be it a college, or school or your workplace, you will find a DHCP server in any network, consisting of more than 15 computers.
Function of a DHCP Server?
DHCP server is used to assign dynamic IP’s to the computer in a network. If you have a big network with 100’s of computers, a DHCP server would automatically assign IP’s to these computers when they are up. If you don’t know about Dynamic IP and Static IP you can check this post.
Why use DHCP server?
We all know it can be a pretty boring job, assigning static IP’s manually to more than 10 computers. In your workplace, or college, or school there are over 100’s of computers in your network.
Imagine assigning :
– IP address.
– Subnet mask.
– Default gateway and
– DNS
manually to all these computer, and then making sure that you don’t give same IP’s to two computers.
This is where, a DHCP server really comes useful. DHCP server will automatically assign an IP, gives the Subnet mask and Gateway address and tells the client, the IP address of DNS servers. Plus it will never assign same IP’s to two different computer.
DHCP For Layman :
The Red color text shows the same case in DHCP server’s scenario.
How DHCP functions?
- In a network as soon as a machine connects , it realizes it has no IP (no static IP). So the machine will broadcast a DHCPDISCOVER message with its IP as 0.0.0.0 and destination IP as the last IP, i.e 255.255.255.255.
- The DHCP server will then recognize this DHCPDISCOVER message, and will reply to client with a DHCPOFFER assigning it an available temporary IP.
- After receiving the temporary address with DHCPOFFER, the client will request for the DHCP services with a DHCPREQUEST message to the server.
- If it meets the conditions given to the DHCP server, it will send a DHCPACK message to the client stating that it can save that IP for itself.
- Here, the DHCP server also gives it a lease time, i.e for how much time Client can use that IP.
- If the client does not meets the DHCP server’s condition for some reason, then DHCP server sends a DHCPNAK message to the client.
- If the client doesn’t want to use the DHCP configuration provided by the server, it sends a DHCPRELEASE message to the server.
Your Router also is a DHCP server for all the devices that connects to it.
Because it dynamically assigns IP’s to the connected devices.
You can change the settings in it, and give a range of your own choice,
or
You can also keep an address reserved for a particular device, which when tries to connect the router, would be given that particular IP only for a certain amount of time.
You can assign the IP range you want to assign, and then as device start connecting to the router, it will assign the IP’s accordingly.
You can find this setting in the LAN section.