1、新建 vlan100 和 vlan200,并进入端口,设为 access 模式,并设置各自的 vlan。
<Huawei>sys
[Huawei]vlan batch 100 200
[Huawei]interface g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type access
[Huawei-GigabitEthernet0/0/1]port default vlan 100
[Huawei-GigabitEthernet0/0/1]quit
[Huawei]interface g0/0/0/11
[Huawei-GigabitEthernet0/0/11]port link-type access
[Huawei-GigabitEthernet0/0/11]port default vlan 200
[Huawei-GigabitEthernet0/0/11]q
[Huawei]interface g0/0/0/2
//进入 2 端口,设置为 trunk 模式,允许 vlan100 和 vlan200 通过
[Huawei-GigabitEthernet0/0/2]port link-type trunk
[Huawei-GigabitEthernet0/0/2] port trunk allow-pass vlan 100 200
2、路由器设置
<Huawei>sys
[Huawei]interface g0/0/2.1
//启用 vlan dot1q 协议,并允许 vlan100 相关帧通
[Huawei-GigabitEthernet0/0/2.1]dot1q termination vid 100
//设置 IP 地址作为 vlan100 的网关
[Huawei-GigabitEthernet0/0/2.1]ip address 192.168.1.1
//启用广播协议
[Huawei-GigabitEthernet0/0/2.1]arp broadcast enable
[Huawei-GigabitEthernet0/0/2.1]interface g0/0/2.2
[Huawei-GigabitEthernet0/0/2.2]dot1q termination vid 200
[Huawei-GigabitEthernet0/0/2.2]ip address 192.168.2.1
[Huawei-GigabitEthernet0/0/2.2]arp broadcast enable