Configuring a LAN with DHCP and VLANs – PART I

March 2, 2019 | Views: 3211

Begin Learning Cyber Security for FREE Now!

FREE REGISTRATIONAlready a Member Login Here

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 dhcp
Can’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_ONE
interface Ethernet0/0
ip 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 vlan

VLAN             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 dhcp

Host1> ping

84 bytes from icmp_seq=1 ttl=255 time=1.393 ms
84 bytes from icmp_seq=2 ttl=255 time=1.283 ms
84 bytes from icmp_seq=3 ttl=255 time=1.077 ms
84 bytes from icmp_seq=4 ttl=255 time=1.104 ms
84 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 dhcp

Host3> ip dhcp


In the next section, we will consider the same topology but with multiple VLANs configured.


Share with Friends
Use Cybytes and
Tip the Author!
Share with Friends
Ready to share your knowledge and expertise?
Comment on This

You must be logged in to post a comment.

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Support Cybrary

Donate Here to Get This Month's Donor Badge


We recommend always using caution when following any link

Are you sure you want to continue?