While working on things which require time and more practice, sometimes you forget the baby steps you take along the way. That’s what happened when one of my colleagues asked a very simple question. I had to brainstorm different ideas in my mind before I finally had the answer. To explain the idea in a better way, learning by doing is the best approach.My colleague wanted to know how the users on the LAN are assigned an IP Address. He logged onto each device on the network and found no DHCP related configuration on the devices. I actually had to re-think before answering him in the best possible way. For this purpose, I prepared a lab on EVE-NG
. While brainstorming ideas for writing this blog, another idea popped up in my mind so I’m breaking the blog into two sections. In the first section, IP Address assignment for a single VLAN is shown. In the next section, multiple VLANs will be considered.Below is a simple topology explaining the use of DHCP Server with a single VLAN.
Let’s begin with the DHCP Server configuration. In the diagram above, Cisco IOS is used a DHCP server. However, DHCP server can also be set up on Windows or Linux OS. Initially, there’s no DHCP server setup on the router. Let’s try to fetch an IP Address first from Host1. As expected, Host 1 will never receive any IP Address from DHCP server.
Host1> ip dhcpDDDCan’t find dhcp server
Let’s configure the DHCP Server on the Cisco IOS. Configure the DHCP Pool and assign an IP address on interface Ethernet0/0.
ip dhcp pool VLAN_ONEnetwork 192.168.1.0 255.255.255.0!interface Ethernet0/0ip address 192.168.1.1 255.255.255.0
By default, all the ports on the switch reside in VLAN1 as can be confirmed from the output below. This means that all the hosts are in the same broadcast domain and the DHCP server will assign an IP address to each of the hosts in VLAN1.
Switch#show vlanVLAN Name Status Ports—- ——————————– ——— ——————————-1 default active Et0/0, Et0/1, Et0/2, Et0/3<output omitted>
Once the DHCP pool has been configured, let’s run the ip dhcp
command on the hosts to fetch an IP Address from the DHCP.
Host1> ip dhcpDDORA IP 192.168.1.2/24Host1> ping 192.168.1.184 bytes from 192.168.1.1 icmp_seq=1 ttl=255 time=1.393 ms84 bytes from 192.168.1.1 icmp_seq=2 ttl=255 time=1.283 ms84 bytes from 192.168.1.1 icmp_seq=3 ttl=255 time=1.077 ms84 bytes from 192.168.1.1 icmp_seq=4 ttl=255 time=1.104 ms84 bytes from 192.168.1.1 icmp_seq=5 ttl=255 time=1.228 ms
As expected, Host1 has been assigned an IP address from the DHCP pool. The same command can be run on Hosts 2 and 3 for IP Address assignment from the DHCP server.
Host2> ip dhcpDDORA IP 192.168.1.3/24Host3> ip dhcpDDORA IP 192.168.1.4/24
In the next section, we will consider the same topology but with multiple VLANs configured.