How to Set Up VLAN Lab for CCNA Students
Introduction
VLAN stands for virtual LAN, which is neither real nor physical existed but it has logical structure or logical grouping. When learning how to set up vlan, it’s important that different Virtual LANs are existed on the same switch but it has different logical structure from one another. The primpary purpose of the VLAN is to break large broadcast domain into smaller logical parts.
What is VLAN?
LAN is a group of computers, printers, swtiches, APs which connect all the components in a limited geographical area. The purpose of the LAN is to share resources such as Files, printers, etc. But, if the LAN has many departments, or if the LAN broadcast is larger, it becomes essential to learn how to set up VLAN to separate each department from one another or break the largest broadcast domain into smaller logical parts. This will be done through the use of virtual LAN.
VlAN is an independent LAN that is completely separated from another VLAN (LAN). Understanding that how to set up VLAN ensures the flow of data from one VLAN to another VLAN will not happen. That’s why it provide security for our network. We can assign a unique name for each virtual LAN, due to which we can easily distinguish every VLAN from other VLAN.
How to Set Up Vlan
Below is the vlan diagram for our vlan creation process. If you want to learn how to set up VLAN, then this diagram will teach you how to create two VLANs on Switch1, e.g vlan 10 and vlan 20. After, creating vlans on SW1, then we will take another Switch 2, to create the same vlans e.g vlan10 and vlan20.
First of all, we will check if there is any already VLAN on SW1 through the use of show vlan commands. If the switch is new, or if its configuration has been removed, then it will show only vlan 1, which is a default vlan. Also, there are other vlans which are 1002, 1003, 1004, and 1005. We can’t remove it or delete it.
Now we are going to how to set up vlan on the switch. Go to global configuration mode, and enter the command vlan followed by a number which is 1-4094. 1-4094 is a vlan range on the switch.
We create two vlans, vlan 10 and vlan 20. We also gave names to it which are campus1 for vlan 10, and campus2 for vlan 20.
Assign interfaces to the VLANs
The next phase is to assign switch interfaces to the vlans.
You can assign interfaces to the vlans through the use of the range command. You will not need to assign a one-by-one interface to each vlan as above. But, you will assign all the interfaces to the vlans at once as below in the screenshot.
Check vlan through the use of the “show vlan” command.
We are going to drag and drop another switch and will create the same vlans i.e., vlan 10 and vlan 20 on Switch2.
Now create vlans on the Switch2.
Assign the corresponding interfaces to the created vlans.
While at the last, assign IP addresses to all PCs. The network IP of vlan 10 is 1.0.0.0/8, while the network IP of vlan 20 is 2.0.0.0/8. We can’t assign the same IP address range to both of the vlans, because both the vlans are different networks.
If we assign the same IP address range to both of the vlans, then the PC in vlan 10 will not ping the PC in vlan 20.
Both the vlans are different and have different IP address ranges, So they will not ping each other. Let’s Check connectivity from vlan10’s PC1 to vlan20’s PC3.
PC in VLAN10 is unable to ping PC in VLAN20.
Now check connectivity within VLAN10 on Switch1.
Also, check connectivity within VLAN 10, but on different Switch e.g from Switch1 vlan 10 PC to Switch 2 Vlan 10 PC.
PC1 in SW1 can ping PC2, but PC1 is unable to ping PC5 on SW2, although both are in VLAN10. The reason is that we didn’t configure the trunk port between SW1 and SW2. The interface between SW1 and SW2 is Gigabitethernet 0/1.
what is Trunk in Vlan?
The trunk is a port that uses a single link to transfer more than one VLAN’s traffic. There is no need for a trunk link if there is only one switch. But, as we have two switches, so there is a need of a trunk link between SW1 and SW2.
Use the Gigabitethernet 0/1 of the both switches to create a trunk link between them.
Check the trunk status through the use of the “show interface trunk” command.
The Gig0/1 is a trunk link. it uses the 802.1q encapsulation method. Also, only VLAN 1, 10, and 20 is allowed to travel on the trunk interface.
We were not allowed before trunking, to ping from PC1 in vlan 10 on Switch1 to PC5 in vlan 10 on Switch2. This time we will ping from PC1 to PC5 after trunking. Let’s check:
PC1 has successfully ping PC5 after the trunk link. But, if we ping from Vlan 10 PC to Vlan 20 PC, then it will not succeed, because both the PC are in different VLANs. Although it is possible through the use of the intervlan routing concept.
Although both the PCs are on the same Switch (SW1), they are unable to ping each other. The reason is, that both are in different VLANs.
how to remove vlan on Cisco switch
We can remove the vlan on switch switch in two different ways. If you want to delete one-by-one vlan, the
- Remove Single VLAN
- Remove whole VLANs
In the first method, use no follow by the word vlan and its number, such as:
Similarly, if you want to delete all the vlans. All the vlans are stored in the vlan.dat file in the flash. We will delete vlan.dat file, but how to know where this file is stored? This file is stored in “Flash” memory but not in nvram. Use the command “show flash”, then you will find it as below in the screenshot.
All the VLANs are stored in vlan.dat file. If you want to remove vlan.dat file, then follow the following method to remove vlan from Cisco switch.
All the vlan are successfully deleted from the switch.