This topic will teach you how to set up VLANs on Cisco Catalyst Switches and how to connect ports to different VLANs. Let’s start with a basic setup for a network:
Let’s look at a basic example. Connected to Switch are PC1 and PC2.
As a starting point, let’s examine Switch’s default VLAN configuration:
Switch#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Et0/0, Et0/1, Et0/2, Et0/3
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
We have Vlan 1 which is the default LAN. All of the active ports are set to vlan 1.
It’s not saved in the running-config or startup-config. Instead, it’s saved on your flash memory in a file called vlan.dat. Just type delete flash:vlan.dat to get rid of this file and the VLAN information will be gone. Both PC1 and PC2 now have the same IP address as we have configured them in the same subnet.
Let’s check to see if PC1 and PC2 can ping each other:
It is still possible for PC1 to reach PC2 with the default switch configuration. Might be able to make a separate VLAN for PC 1 and PC 2:
Switch(config)#vlan 100
Switch(config-vlan)#name PC's
Switch(config-vlan)#exit
This is the process for making a new VLAN. You are free to give it a name if you so like. Here VLAN is referred to a name as ” PC’s”
Switch#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Et0/0, Et0/1, Et0/2, Et0/3
100 PC's active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
On Switch, VLAN 100 is established, and as you can see, it is operational. Currently, nevertheless, there are no ports in VLAN 100. Let’s configure them:-
Switch(config)#int Et0/0
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 100
!
Switch(config-if)#int Et0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 100
To begin, We will use the switchport mode access command to set the switchport to access mode. The switchport access vlan command allows us to transfer our interfaces to a different VLAN.