Every network has it, a DHCP Server, but what is it? In short, the DHCP Server assigns network address (IP Address) to every client in the network that needs one. Without a DHCP server, you would need to give every network device an IP Address manually.
Because of a DHCP server, we can use our mobile phones on every wireless network that we can connect to. The DHCP Server in the network will assign your phone an IP Address so it can connect to the internet for example.
In this article, I am going to explain how a DHCP server works, what it is and what the optimal settings are.
What is a DHCP Server?
Before we go into detail on how a DHCP works and what the optimal settings are, lets first explain a bit more about the DHCP server self.
In a typical home network, you will find the DHCP server in your router. Almost every router can function as a DHCP server. On larger networks, it’s more common to add the DHCP server task to one or more servers.
When you connect your notebook to a network you will need an IP Address for your notebook to be able to connect to the internet. Without an IP Address, the router doesn’t know where to send the network packets to.
Now you could give you notebook a static (fixed) IP Address, but to do so, you will need to know the network details. And then there is another problem, who says the IP Address you enter isn’t already in use? If multiple devices use the same IP Address in a network, you will get a network conflict. The router doesn’t know where to send the network packages to.
A DHCP server keeps track of who is using which IP Address and for how long. A client can only use an IP Address for a given time period, the DHCP Lease Time. Before the lease is over, the client must renew or ask a new IP Address.
How does a DHCP Server work?
So you now know what a DHCP server is, but how does it work? How does a client (notebook for example) know where to get an IP Address?
When you connect to the (wireless) network, your notebook will send out a broadcast over the network with a DHCP Request. The router will redirect the request to the correct DHCP server (or handle itself, it the router is the DHCP server), which will offer an IP Address to the client.
The process look likes this:
In the DHCP Acknowledgement is the actual IP Address for the client along with other network information. For a client to connect to the internet it will need more than the IP Address alone. It also needs to know which DNS server it can use, what the IP Address is of the router (because that is where it needs to send the network package to), and how long it can use the IP Address (the DHCP Lease time)
So a DHCP Acknowledgement may look like this:
IP Address: 192.168.1.23 Subnetmask: 255.255.255.0 Default gateway: 192.168.1.1 DNS Servers: 220.127.116.11 18.104.22.168 Lease time: 8 days
So we have taken a look at how a client gets an IP Address from the DHCP Server, but what happens on the DHCP server side?
When you configure your DHCP server or router you can setup your local network. One of the things you can configure is the DHCP Pool. This a range of IP Addresses that the DHCP server can use to give to network clients.
The default range may reach from 192.168.1.2 to 192.168.1.253, which results in 251 available network address. This is a pretty big DHCP pool for a home network or small business. When the DHCP server receives a DHCP Request it will take the first free IP Address from the pool and assign it to the client.
After the DHCP Lease time is passed it will mark the IP Address as available again, so another client can use it.
Tips on settings up your DHCP Server
Configuring the DHCP Server for your home network is hard, it are just a few settings that you can change in your routers. But here are some tips:
DHCP Pool size (DHCP Range)
For home networks you don’t need a large DHCP Pool size, range from 192.168.1.10 to 192.168.1.199 is more than sufficient. Also for small business networks, this range will work perfectly fine.
I always use the Ip Addresses above 192.168.1.200 for network equipment. So leave some addresses available for this.
Static Ip Addresses
Give your network equipment, access points, network printers, etc, a fixed IP Address. This way you can easily connect to them when you need to manage them. Now the downside of fixed Ip Address is that you may lose track of which IP Address is already in use for which device.
You can use DHCP Reservations in your DHCP server for this. What you basically do is based on the MAC address of a device pre-define which IP Address is should get. You leave the client on DHCP mode, but the server now knows that it always should use the pre-defined IP Address for that particular client.
If you have a small business with a lot of quests on your wireless network, then you want to use a short lease time. But for a home network a business network, a lease time of 8 days is perfectly fine.
If you want to know more about DHCP Lease time, then make sure you check out this article.
I hope that you have now a better understanding of what a DHCP server is and how it works. If you have any questions just drop a comment below.
If you liked this article, please share it!