(1)按照图示PC配置IP地址
(2)在SW1上创建VLAN10 VALN 20,并将接口划入相应的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)在SW2上创建VLAN10 VALN 20,并将接口划入相应的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)在PC3 ping PC4和PC5,查看结果
代码语言:txt复制结论:
①VLAN的作用是缩小广播域,不同网段不能通信不是真正的目的
②相同VLAN之间可以通信,不同VLAN之间默认不能通信,(不同VLAN间通信需要三层设备)