Preparation
One switch (2960-24TT)
Four PCs
1. Configure the IP address of each PC
2. Create VLAN and assign ports
Step 1: Create vlan 10
Switch(config)#vlan 10
Switch(config-vlan)#
Step 2: Name it test10.
Switch(config-vlan)#name test10
Switch(config-vlan)#exit
Step 3: Create vlan 20 and name it test20.
Switch(config)#vlan 20
Switch(config-vlan)#name test20
Switch(config-vlan)#exit
Step 4: Assign the port to vlan10.
Switch(config)#int f0/1
Switch(config-if)#switch mode access
Switch(config-if)#switch access vlan 10
Switch(config-if)#int range f0/1-10
Switch(config-if-range)#switch mode access
Switch(config-if-range)#switch access vlan 10
Switch(config-if-range)#exit
Step 5: Assign the port to vlan20.
Switch(config)#int f0/11
Switch(config-if)#switch mode access
Switch(config-if)#switch access vlan 20
Switch(config-if)#int range f0/11-20
Switch(config-if-range)#switch mode access
Switch(config-if-range)#switch access vlan 20
Switch(config-if-range)#exit
Step 6: Check vlan configuration
3. Test
Click "PC0" in the Packer tracer, click "run" under the "Desktop" tab in the pop-up window, enter ping 192.168.1.12 and ping 192.168.1.21, the test results are shown in the figure below, where PC0 and PC1 They are in the same VLAN and can be pinged successfully; PC0 and PC2 are not in the same VLAN, so they cannot be pinged successfully.