(1) Configure the IP address of the PC according to the figure
(2) Create VLAN 10 VALN 20 on SW1, and assign the interface to the corresponding VLAN
[SW1]vlan 10 to 20
[SW1]vlan 10`
[SW1-vlan10]port g1/0/1
[SW1-vlan10]vlan 20
[SW1-vlan20]port g1/0/2
[SW1-vlan20]inter g1/0/3
[SW1-GigabitEthernet1/0/3]port link-type trunk
[SW1-GigabitEthernet1/0/3]port trunk permit vlan 10 20
(3) Create VLAN 10 VALN 20 on SW2, and assign the interface to the corresponding VLAN
[SW2]vlan 10 to 20
[SW2]vlan 10
[SW2-vlan10]port g1/0/1
[SW2-vlan10]vlan 20
[SW2-vlan20]port g1/0/2
[SW2-vlan20]inter g1/0/3
[SW2-GigabitEthernet1/0/3]port link-type trunk
[SW2-GigabitEthernet1/0/3]port trunk permit vlan 10 20
(4) Ping PC4 and PC5 on PC3, view the result
结论:
①VLAN的作用是缩小广播域,不同网段不能通信不是真正的目的
②相同VLAN之间可以通信,不同VLAN之间默认不能通信,(不同VLAN间通信需要三层设备)