Cisco Packet Tracer Tutorial: Configuring VLANs on a Switch

The abbreviation of VLAN is Virtual LAN. The concept of VLAN itself is to create networks on a network, in other words VLAN can be used to divide a network into several networks where each divided network cannot be connected to one another.
This tutorial will discuss how to create VLANs on a network that uses 2 Switches. In this network there are 2 switches and 6 PCs, where each switch is connected with 3 PCs. In 1 switch is divided into 3 VLANs, namely vlan 1, vlan 2, and vlan 3, with each vlan there is 1 PC. Here’s the picture:

In these networks, it is the PC with the same VLAN that can connect to each other and make data connections. So PC0 is only connected to PC3, PC1 is only connected to PC4, and PC2 is only connected with PC5.
Following are the steps in creating a VLAN on a network that uses 2 switches:

  • Open the Cisco Packet Tracer application

  • Insert 2 Switches
  • Connect Switch0 with Switch1 using a cross-over cable, through the FastEthernet0 / 1 Port on each switch
  • Insert 6 PCs
  • Configuring the IP of these PCs. Click PC0, move to the Desktop tab, click IP configuration, select Static, enter 192.168.1.1 for the IP Address and 255.255.255.0 for the Subnet Mask.
  • Repeat step 5 for PC1 to PC5. But the IP Address entered is different, while the Subnet Mask is the same. IP Address PC1 192.168.1.2, IP Address PC2 192.168.1.3, IP Address PC3 192.168.1.4, IP Address PC4 192.168.1.5, IP Address PC5 192.168.1.6.

  • Connect PC0, PC1, PC2 to Switch0 using a straight-through cable. Where on the switch, for PC0 using the FastEthernet1 / 1 Port, PC1 uses the FastEthernet2 / 1 Port, and PC2 uses the Port FastEthernet3 / 1.
  • Connect PC3, PC4, PC5 to Switch1 using a straight-through cable. Where on the switch, for PC3 using the FastEthernet1 / 1 Port, PC4 uses the FastEthernet2 / 1 Port, and PC5 uses the Port FastEthernet3 / 1.
  • Configure VLAN on Switch0. Click Switch0, move to the CLI tab, enter the command below:

Switch> enable
Switch # configure terminal
Switch (config) #interface fastEthernet 0/1
Switch (config-if) #switchport mode dynamic desirable
Switch (config-if) #switchport mode trunk
Switch (config-if) #exit
Switch (config) #
Switch (config) #vlan 2
Switch (config-vlan) #exit
Switch (config) #vlan 3
Switch (config-vlan) #exit
Switch (config) #
Switch (config) #interface fastEthernet 1/1
Switch (config-if) #switchport mode access
Switch (config-if) #exit
Switch (config) #
Switch (config) #interface fastEthernet 2/1
Switch (config-if) #switchport mode access
Switch (config-if) #switchport access vlan 2
Switch (config-if) #exit
Switch (config) #
Switch (config) #interface fastEthernet 3/1
Switch (config-if) #switchport mode access
Switch (config-if) #switchport access vlan 3
Switch (config-if) #exit
Switch (config) #
Switch (config) #end
Switch #

Information:

For FastEthernet0 / 1 Port uses trunk mode because it is used as a connecting line to Switch1
For FastEthernet1 / 1 Port, FastEthernet2 / 1 Port, FastEthernet3 / 1 Port uses access mode because it is used as a connecting line to PC0, PC1, and PC2.
For the FastEthernet2 / 1 port using VLAN 2 access, the FastEthernet3 / 1 port uses VLAN 3 access, while the FastEthernet1 / 1 port does not need to configure the VLAN because it is default on VLAN 1.

  1. Configure VLAN on Switch1. Click Switch1, move to the CLI tab, enter the command below:

Switch> enable
Switch # configure terminal
Switch (config) #interface fastEthernet 0/1
Switch (config-if) #switchport mode dynamic desirable
Switch (config-if) #switchport mode trunk
Switch (config-if) #exit
Switch (config) #
Switch (config) #vlan 2
Switch (config-vlan) #exit
Switch (config) #vlan 3
Switch (config-vlan) #exit
Switch (config) #
Switch (config) #interface fastEthernet 1/1
Switch (config-if) #switchport mode access
Switch (config-if) #exit
Switch (config) #
Switch (config) #interface fastEthernet 2/1
Switch (config-if) #switchport mode access
Switch (config-if) #switchport access vlan 2
Switch (config-if) #exit
Switch (config) #
Switch (config) #interface fastEthernet 3/1
Switch (config-if) #switchport mode access
Switch (config-if) #switchport access vlan 3
Switch (config-if) #exit
Switch (config) #
Switch (config) #end
Switch #

Information:

For FastEthernet0 / 1 Port uses trunk mode because it is used as a connecting line to Switch0
For FastEthernet1 / 1 Port, FastEthernet2 / 1 Port, FastEthernet3 / 1 Port uses access mode because it is used as a connecting line to PC3, PC4, and PC5.
For the FastEthernet2 / 1 port using VLAN 3 access, the FastEthernet3 / 1 port uses VLAN 3 access, while the FastEthernet1 / 1 port does not need to configure the VLAN because it is default on VLAN 1.

  • Ping from PC0 to PC3, PC1 to PC4, PC2 to PC5. Click on the PC, move to the Desktop tab, click Command Prompt, type: ping .

PC0 can only connect to PC3, PC1 can only connect to PC4, PC2 can only connect to PC5, if other than that, repeat carefully the previous steps.

Leave a comment

Your email address will not be published. Required fields are marked *