
What is switching?
A switch is a networking hardware component of network infrastructure in a company or organization. The switch performance is the switching process and can connect many devices such as computers, laptops, wifi access points, server nodes, or other devices to another one.
A switch also has features to enable multiple devices to share a network and can prevent interfering traffic with another device in the network.
So, you want to create a different VLAN in the switch device. First, you need to understand VLAN.
What is VLAN?
VLAN referred to as a Virtual Local Area Network is any kind of separate logical broadcast domain of subdividing a physical network that configures by the network administrator. You want to separate LANs with a different IP addresses in your infrastructure to prevent any kind of conflict traffic, so the best method is to divide it into different VLANs.
A Bellow example will show you how to configure VLAN in a Cisco switch by using the packet tracer for this practice.
Scenarios:
- There are 4 PC in the LAB.
- IP network in VLAN 10: 192.168.1.0/24, IP network in VLAN 20: 192.168.2.0/24
- PC1 and PC2 are on the same VLAN-ID 10 (Configure port FastEthernet 1 & 2 access to VLAN 10)
- PC1 connected to port FastEthernet 1, PC2 connected to port FastEthernet 2
- PC3 and PC4 are on the same VLAN-ID 20 (Configure port FastEthernet 3 & 4 access to VLAN 20)
- PC1 connected to port FastEthernet 3, PC2 connected to port FastEthernet 4
- PC1 will successfully ping to PC2 (Same VLAN)
- PC 3 will successfully ping to PC4 (Same VLAN)
- PC 1&2 will not reachable ping to PC 3&4
How to create VLANs in Cisco Switch
1. Create VLAN 10 & 20
#Create VLAN 10#
Switch>enable
Switch#configure terminal
Switch(config)#vlan 10
Switch(config-vlan)name Accounting
Switch(config-vlan)exit
#Create VLAN 20#
Switch>enable
Switch#configure terminal
Switch(config)#vlan 20
Switch(config-vlan)name HR
Switch(config-vlan)exit
###Example command line###

2. Configure port Access to VLAN
#Port FastEthernet 1&2 access VLAN 10#
Switch>enable
Switch#configure terminal
Switch(config)#interface range fastethernet 0/1-2
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit
Switch(config)#
#Port FastEthernet 3&4 access VLAN 20#
Switch(config)#interface range fastethernet 0/3-4
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20
Switch(config-if)#exit
Switch(config)#
###Example command line###

3. Assign an IP address to each PCs
In the packet tracer software, you can go to Desktop->IP Configuration to assign an IP address to the PC in LAB.


Now, we have assigned each PCs with an IP address below
PC1: 192.168.1.10 with subnet: 255.255.255.0
PC1: 192.168.1.11 with subnet: 255.255.255.0
PC1: 192.168.2.10 with subnet: 255.255.255.0
PC1: 192.168.2.11 with subnet: 255.255.255.0
4. Test Ping


