实验拓扑
实验思路:sw1 创建4个vlan 10 20 30 40 把10 20 配置0/0/1 0/0/2 PC机
配置trunk链路
sw2 创建2个vlan 30 40 把30 40 配置0/0/1 0/0/2 PC机
配置trunk链路
实验步骤:
[SW1]vlan batch 10 20 30 40
[SW1]interface Vlanif 10
[SW1-Vlanif10]ip address 192.168.10.254 24
[SW1-Vlanif10]undo shutdown
[SW1]interface Vlanif 20
[SW1-Vlanif20]ip address 192.168.10.254 24
[SW1-Vlanif20]undo shutdown
[SW1]interface Vlanif 30
[SW1-Vlanif30]ip address 192.168.10.254 24
[SW1-Vlanif30]undo shutdown
[SW1]interface Vlanif 40
[SW1-Vlanif40]ip address 192.168.10.254 24
[SW1-Vlanif40]undo shutdown
[SW1]interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1]port link-type access
[SW1-GigabitEthernet0/0/1]port default vlan 10
[SW1]interface GigabitEthernet 0/0/2
[SW1-GigabitEthernet0/0/2]port link-type access
[SW1-GigabitEthernet0/0/2]port default vlan 20
[SW1]interface GigabitEthernet 0/0/5
[SW1-GigabitEthernet0/0/5]port link-type trunk
[SW1-GigabitEthernet0/0/5]port trunk allow-pass vlan 10 20 30 40
[SW2]vlan batch 30 40
[SW2]interface GigabitEthernet 0/0/1
[SW2-GigabitEthernet0/0/1]port link-type access
[SW2-GigabitEthernet0/0/1]port default vlan 30
[SW2]interface GigabitEthernet 0/0/2
[SW2-GigabitEthernet0/0/2]port link-type access
[SW2-GigabitEthernet0/0/2]port default vlan 40
[SW2]interface GigabitEthernet 0/0/5
[SW2-GigabitEthernet0/0/5]port link-type trunk
[SW2-GigabitEthernet0/0/5]port trunk allow-pass vlan 10 20 30 40
实验结果:
两个三层交换通过trunk链路 实现不同vlan不同网段之间的通信