Ready to Start Your Career?

Configuring a LAN with DHCP and VLANs – PART I

farazde 's profile image

By: farazde

March 2, 2019

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.vlan1 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!interface Ethernet0/0ip address
 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> ping bytes from icmp_seq=1 ttl=255 time=1.393 ms84 bytes from icmp_seq=2 ttl=255 time=1.283 ms84 bytes from icmp_seq=3 ttl=255 time=1.077 ms84 bytes from icmp_seq=4 ttl=255 time=1.104 ms84 bytes from 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> ip dhcpDDORA IP
 In the next section, we will consider the same topology but with multiple VLANs configured. 
Schedule Demo