设备名/VLAN IP PC1 192.168.10.2/24 PC2 192.168.20.2/24 VLAN10 192.168.10.1 VLAN20 192.168.20.1
交换机LSW1配置:
<Huawei>sys # 进入系统视图
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan 10 # 创建vlan10
[Huawei-vlan10]q
[Huawei]vlan 20 # 创建vlan20
[Huawei-vlan20]q
[Huawei]int Ethernet 0/0/2
[Huawei-Ethernet0/0/2]port link-type access # 将端口模式设置为access
[Huawei-Ethernet0/0/2]port default vlan 10 # 将端口划分到vlan10
[Huawei-Ethernet0/0/2]q
[Huawei]int Ethernet0/0/3
[Huawei-Ethernet0/0/3]port link-type access # 将端口模式设置为access
[Huawei-Ethernet0/0/3]port default vlan 20 # 将端口划分到vlan20
[Huawei-Ethernet0/0/3]q
[Huawei]int Ethernet 0/0/1
[Huawei-Ethernet0/0/1]port link-type trunk # 将端口模式设置为trunk
[Huawei-Ethernet0/0/1]port trunk allow-pass vlan 10 20 # 运行vlan10和vlan20流量通过
[Huawei-Ethernet0/0/1]q
[Huawei]
路由器AR1配置:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]int g 0/0/0.1
[Huawei-GigabitEthernet0/0/0.1]ip add 192.168.10.1 24 # 配置.1子接口ip
[Huawei-GigabitEthernet0/0/0.1]dot1q termination vid 10 # 封装给vlan10
[Huawei-GigabitEthernet0/0/0.1]arp broadcast enable # 开启arp广播
[Huawei-GigabitEthernet0/0/0.1]q
[Huawei]int g 0/0/0.2
[Huawei-GigabitEthernet0/0/0.2]ip add 192.168.20.1 24 # 配置.2子接口ip
[Huawei-GigabitEthernet0/0/0.2]dot1q termination vid 20 # 封装给vlan20
[Huawei-GigabitEthernet0/0/0.2]arp broadcast enable # 开启arp广播