Configuring DHCP Server
DHCP server is responsible to provide dynamic IP address to hosts machine in a LAN. Remember that any device can be a server? Well, in this logic — any devices can also be a DHCP server. We can easily turn a desktop PC, a Macbook or even your iPhone into a DHCP server. So, who needs to get a dedicated server unit, sitting there just to provide dynamic IP?
But, there is a few catches. Although every device can be the DHCP server, we first need to make sure that the Operating System the device is running on; does indeed support the DHCP server’s services. On Windows, you need the the server version of Windows, namely: Windows Server 2016 to turn on the DHCP service. The standard Windows 10 Home/Pro won’t make the cut. Another thing, unless you use your iPhone as an expensive alarm clock; it is almost certain that mobile devices move around. Now, if we host DHCP service on mobile devices; then it is likely that the DHCP service might not be available occasionally when the device moved away from the network (even temporarily).
So we are back to the idea of having a dedicated DHCP server is better for automatic IP configuration and management. Yeah, that is definitely the case for simplified network management. But, who would pay few hundreds buck for it?
Your Router as the DHCP server
Try to take a look around your home network. You are sure that it is running on DHCP; because you don’t recall entering any IP address when you join the WiFi network. Well, that’s because — your home router is also the DHCP server. In fact, modern routers are a composite of switch, modem and router all in one that also doubles up as the DNS and DHCP server. So, one device for all the networking needs. Marie Kondo approved!
These days, most routers comes with elegant and intuitive UI to guide user to setup DHCP services on their home router. And it is as simple as entering few key parameters:
Network Address — the Network address (first address) of the network you want the DHCP service to cater for
Subnet Mask — the subnet mask for the Network
IP address range — the starting IP and the last IP that the DHCP server can assign to the hosts (useful to control the number of hosts that can join a network at the same time)
Excluded IP address — the set of IP that you do not want the DHCP server to lease to the clients. These are normally the special IP that you reserved for other servers in the LAN (that is manually assigned)
Default Router — the gateway IP address of this network. This is important so that the DHCP server also inform the client about the Router that it needs to reach in addition to giving an IP to the host
DNS Server — the IP address of the DNS server. In some cases, this is set to be the same as the router’s IP, or Google’s public DNS at 22.214.171.124.
As you can see, setting up DHCP is not rocket science. But things might get slightly complex when it comes to configuring core routers or enterprise grade routers that do not provide UI for simple configs. For that, we need to learn the commands to configure the DHCP services on the command line interface (CLI). Note that these commands differ slightly from vendors; so you might need to get the handbook ready when configuring DHCP on different brands on routers. In this example, we will demonstrate how to configure DHCP service on a Cisco Router running on Cisco’s IOS.
Configuring DHCP service on Cisco Router
Given the network shown here, configure Router0 to be the DHCP server for LAN1.
Here’s the self explanatory video to guide you through the configuration process.
Refer to the cheat sheet for quick configs
enconfig tip dhcp pool swimmingpool // ‘swimmingpool’ can be any namesnetwork 192.168.1.0 255.255.255.0default-router 192.168.1.254dns-server 192.168.1.10
There you go. That’s how we can configure DHCP service on Cisco Routers easily in 4 lines.