拓扑图
三层路由,交换机改成三层交换机即可,在三层交换机上生成路由表。
SW1配置
<Huawei>system-view
[Huawei]sysname SW1
[SW1]vlan batch 100 200
[SW1-Vlanif200]int g0/0/1
[SW1-GigabitEthernet0/0/1]port link-type access
[SW1-GigabitEthernet0/0/1]port default vlan 100
[SW1]int g0/0/2
[SW1-GigabitEthernet0/0/2]port link-type access
[SW1-GigabitEthernet0/0/2]port default vlan 200
[SW1-GigabitEthernet0/0/2]int Vlanif 100 //进入Vlanif模式,直接配置IP地址。
[SW1-Vlanif100]ip add 192.168.10.1 24
[SW1-Vlanif100]int Vlanif 200
[SW1-Vlanif200]ip add 192.168.20.1 24
[SW1-GigabitEthernet0/0/1]int e0/0/22
[SW1-Ethernet0/0/22]port link-type trunk
[SW1-Ethernet0/0/22]port trunk allow-pass vlan 100 200
PC配置
测试