拓扑图如下:
SW-1配置命令如下:
<Huawei>system-view //进系统视图
[Huawei]sysname SW-1 //修改主机名
[SW-1]vlan batch 10 20 //创建vlan 10 20
[SW-1]interface e0/0/1 //进接口
[SW-1-Ethernet0/0/1]port link-type access //配置工作模式为access
[SW-1-Ethernet0/0/1]port default vlan 10 //将e0/0/1接口加入到vlan10里
[SW-1-Ethernet0/0/1]int e0/0/2 //切换接口
[SW-1-Ethernet0/0/2]port link-type access //配置工作模式为access
[SW-1-Ethernet0/0/2]port default vlan 20 //将e0/0/2接口加入到vlan20里
[SW-1-Ethernet0/0/2]int g0/0/1 //切换接口
[SW-1-GigabitEthernet0/0/1]port link-type trunk //配置工作模式为Trunk模式
[SW