COMPUTER NETWORKING TIPS
Demystifying Computer Networking!
Menu
JULY 5, 2018 BY SHEFFER KIMANZI
How to configure VLAN and interVLAN Routing
in Packet Tracer
37 Votes
Welcome to this tutorial! This is a simple step by step guide of configuring
VLAN and interVLAN routing on a Cisco switch. But just before get into
configurations , let’s have a brief overview of what’s a VLAN.
What is a VLAN?
A Virtual LAN (VLAN) is simply a logical LAN, just as its name suggests. VLANs
have similar characteristics with those of physical LANs, only that with VLANs,
you can logically group hosts even if they are physically located on separate LAN
segments.
We treat each VLAN as a separate subnet or broadcast domain. For this reason, to
move packets from one VLAN to another, we have to use a router or a layer 3
switch.
VLANs are configured on switches by placing some interfaces into one broadcast
domain and some interfaces into another. For this tutorial, we’ll configure 2
VLANs on a switch. We’ll then proceed and configure a router to enable
communication between the two VLANs.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
Close and accept
ToSo
findthen,
out more, including how to control cookies, see here: Cookie Policy
Close and accept
Follow
1. In Cisco Packet Tracer, create the network topology as shown below:
2. Create 2 VLANs on the switch: VLAN 10 and VLAN 20. You can give them
custom names.
Switch#config terminal
Switch(config)#vlan 10
Switch(config-vlan)#name SALES
Switch(config-vlan)#vlan 20
Switch(config-vlan)#name IT
3. Assign switch ports to the VLANs. Remember each VLAN is viewed as
separate broadcast domain.
And just before you configure, have in mind that switch ports could be either
access or trunk.
An access port is assigned to a single VLAN . These ports are configured for switch
ports that connect to devices with a normal network card, for example a PC in a
network.
A trunk port on the other hand is a port that can be connected to another switch or
router. This port can carry traffic of multiple VLANs.
So in our case, we’ll configure switch interfaces fa 0/1 through fa 0/4 as access
ports to connect to our PCs. Here, interfaces fa 0/1 and fa 0/2 are assigned to
VLAN 10 while interfaces fa 0/3 and fa 0/4 are assigned to VLAN 20.
Switch Interface fa0/5 will be configured as trunk port, as it will be used to carry
traffic between the two VLANs via the router.
Switch>enable
Switch#config terminal
Switch(config)#int fa0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10
Switch(config-if)#int fa0/2
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10
Switch(config-if)#int fa0/3
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20
Switch(config-if)#int fa0/4
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20
Worth noting: We could have configured all the above interfaces as access ports
using interface range command as shown below:
Switch(config-if)#int range fa0/1-4
Switch(config-if-range)#switchport mode access
In the above commands, we have specified an interface range and then proceeded
to configure all the ports specified as access ports.
Interface fa0/5 is configured as trunk and will be used to for inter-VLAN
communication.
Switch(config)#int fa 0/5
Switch(config-if)#switchport mode trunk
The next thing is to:
4 . Assign static IP addresses to the four PCs which are located in the separate
VLANs. PC1 and PC2 fall in VLAN 10 while PC3 and PC4 fall in VLAN 20.
PC1 IP address 192.168.1.10 Subnet mask 255.255.255.0 Default gateway
192.168.1.1
PC2: IP address 192.168.1.20 Subnet mask 255.255.255.0 Default gateway
192.168.1.1
PC3: IP address 192.168.2.10 Subnet mask 255.255.255.0 Default gateway
192.168.2.1
PC4: IP address 192.168.2.20 Subnet mask 255.255.255.0 Default gateway
192.168.2.1
And now it’s very clear that we treat a VLAN just like a physical LAN when
assigning IP addresses.
At this point let’s try to test connectivity within VLANs and between VLANs
To test communication between hosts in the same VLAN:
Ping PC2 from PC1 both in VLAN 10. Ping test should be successful.
To test connectivity between hosts in different VLANs:
Ping PC3 in VLAN 20 from PC1 in VLAN 10. Ping here will definitely fail. Why?
Because inter-VLAN routing is not yet enabled. Hope you can see how we’ve used
VLANs to place the hosts into two logical networks which can be viewed as
separate broadcast domains.
Now, in order to allow the hosts in the two VLANs to communicate, we need to do
something extra. And you can guess what. We’ll configure the router to permit
inter-VLAN communication. Let’s do that right away.
5. Configure inter-VLAN routing on the router
We’ll configure the router so that it will enable communication between the two
vlans via a single physical interface. How is this made possible? We’ll divide the
single physical interface on the router into logical interfaces (sub interfaces). Each
sub-interface will then serve as a default gateway for each of the VLANs. This
scenario is called router on a stick (R.O.A.S) and will allow the VLANs to
communicate through the single physical interface.
Wort noting: We can’t assign an IP address to the router’s physical interface that
we have subdivided into logical sub-interfaces. We’ll instead assign IP addresses to
the sub interfaces.
So let’s do router configurations:
Router>enable
Router#config terminal
Router(config)#int fa0/0
Router(config-if)#no shutdown
Router(config-if)#int fa0/0.10
Router(config-subif)#encapsulation dot1q 10
Router(config-subif)#ip add 192.168.1.1 255.255.255.0
Router(config-subif)#
Router(config-subif)#int fa0/0.20
Router(config-subif)#encapsulation dot1q 20
Router(config-subif)#ip add 192.168.2.1 255.255.255.0
As you can notice from above, the routers physical interface fa0/0 was subdivided
into two sub-interfaces( fa0/0.10 and fa0/0.20) , which are then configured as
trunk interfaces and given IP addresses.
Finally,
6. Test inter-VLAN connectivity.
Here we’ll test connectivity between computers in different VLANs . Don’t forget
that its the router that enables inter-VLAN routing.
Ping PC3 in VLAN 20 from PC1 in VLAN 10. If everything is well configured, then
ping should work perfectly.
And that’s all!
Hope this article was useful to you. Comment to help improve it.
All the best.
See also:
Configuring Switch Port Security in Packet Tracer
Share this:
Twitter Facebook LinkedIn Reddit
Loading...
Related
How to configure DHCP server Configuring Telnet on a switch Secure Shell (SSH)
in Packet Tracer. and a router in Packet Tracer configuration on a switch and
July 5, 2018 July 5, 2018 router in Packet Tracer
In "Server Configuration" In "Telnet and SSH July 5, 2018
configuration" In "Telnet and SSH
configuration"
SWITCHING CONCEPTS, VLAN CONFIGURATION
ACCESS PORT, PACKET TRACER, ROUTER ON A STICK, SWITCHING CONCEPTS, TRUNK
PORT, VLAN CONFIGURATION
14 Replies to “How to configure VLAN and interVLAN Routing in
Packet Tracer”
Karol Yerbich
AUGUST 1, 2020 AT 7:47 AM
Hey there, I think your blog might be having browser compatibility issues. When I look at your
blog in Ie, it looks fine but when opening in Internet Explorer, it has some overlapping. I just
wanted to give you a quick heads up! Other then that, excellent blog!
Like
Reply
Anonymous
Anonymous
SEPTEMBER 15, 2021 AT 4:06 PM
why would you be using internet explorer, sounds like you are the problem
Like
Reply
Richard
OCTOBER 23, 2020 AT 2:33 PM
Followed instructions to the letter, didn’t work.
Like
Reply
Anonymous
AUGUST 6, 2021 AT 10:33 AM
hello
this artical wasn PC1 from vlan 10 and PC4 in vlan 20 really helpful to me
but in my case i can only ping between PC1 from vlan 10 and PC4 in vlan 20
can’t ping between PC3 and PC2.what could be the problem ?
Like
Reply
pal patil
NOVEMBER 5, 2020 AT 1:54 PM
This is a very nice one and gives in-depth information. I am really happy with the quality and
presentation of the article. I’d really like to appreciate the efforts you get with writing this
post. Thanks for sharing.
ccie security training in pune
ccie R&S training in pune
Like
Reply
m ahmad bichi
NOVEMBER 12, 2020 AT 8:18 AM
this is verry simple configuretion thanks for your help
Like
Reply
Luther
NOVEMBER 16, 2020 AT 8:41 AM
This site was… how do you say it? Relevant!!
Finally I’ve found something that helped me. Thanks a lot!
Like
Reply
Arthur
DECEMBER 2, 2020 AT 1:06 AM
Thanks for finally writing about > How to configure VLAN and interVLAN Routing
in Packet Tracer – Computer Networking Tips < Loved it!
Like
Reply
Anonymous
APRIL 16, 2021 AT 9:57 AM
Very useful. Thanks
Like
Reply
Sibusiso
MAY 23, 2021 AT 5:14 AM
This is informative and its helpful… yoy have put it clear and simplified. Thanks
Like
Reply
Anonymous
JULY 7, 2021 AT 2:43 PM
Inter-vlan not working…
Like
Reply
samuel
OCTOBER 19, 2021 AT 2:00 PM
very thanks,
Like
Reply
Anonymous
OCTOBER 23, 2021 AT 4:25 AM
not working
Like
Reply
Anonymous
OCTOBER 23, 2021 AT 4:26 AM
i try the all instruction but i cannot ping pc1 vlan 10 to pc3 vlan 20
Like
Reply
Leave a Reply
Enter your comment here...
This site uses Akismet to reduce spam. Learn how your comment data is processed.
PREVIOUS
DNS server configuration in Packet Tracer
NEXT
Configuring IPv6 tunneling over an IPv4 network in Packet Tracer
Search …
MOST VIEWED
How to configure VLAN and interVLAN Routing in Packet Tracer
How to configure DHCP server in Packet Tracer.
DNS server configuration in Packet Tracer
Secure Shell (SSH) configuration on a switch and router in Packet Tracer
Wireless Router configuration in Cisco Packet Tracer
RIP configuration in Packet Tracer
LEARN MORE FROM THIS LIST
IPv4 Routing Protocols
IPv4 routing protocols configuration
IPv6
IPv6 Routing Protocols
Network Address Translation(NAT)
Server Configuration
Switch Port Security configuration
Switching concepts
Switching Technologies
Telnet and SSH configuration
Uncategorized
VLAN configuration
Wireless
Follow Computer Networking Tips
SUBSCRIBE
Enter your email address to follow this blog and receive notifications of new posts
by email.
Join 81 other followers
Enter your email address
SUBSCRIBE
BLOG STATS
708,919 hits
FOLLOW ME ON TWITTER
Tweets by @KimanziSheffer
Sheffer Kimanzi Retweeted
Raf Rasenberg
@rafrasenberg
Best laptops for programmers:
You can use any laptop
You can use any laptop
You can use any laptop
You can use any laptop
Yeah sure a specced out MacBook Pro 16” is great! But
not a necessity.
Embed View on Twitter
WHAT ARE YOU LOOKING FOR?
Search …
SELECT YOUR TOPIC FROM THIS LIST
Select Category
Blog at WordPress.com.