一、靜態VLAN劃分
1、檢視介面資訊
# 檢視介面資訊
display interfaces
# 檢視介面狀態和配置的簡要資訊
display interfaces brief
2、靜態VLAN劃分
# 進入系統檢視
<HUAWEI> system-view
# 進入交換機A
[HUAWEI] sysname swithA
# 批次建立VLAN,此處建立VLAN 2和3
[SWITCHA] vlan batch 2 3
# 進入gig0/0/1介面
[SWITCHA] interface gigabitetthernet 0/0/1
# 配置介面型別為access型別(trunk、hybrid)
[SWITCHA-Gigabitethernet0/0/1] port link-type access
# 將介面加入到VLAN中(此處演示將介面加入到VLAN2當中)兩個命令等效選其一即可
[SWITCHA-Gigabitethernet0/0/1] port default vlan 2
[SWITCHA-Gigabitethernet0/0/1] port access vlan 2
# 返回到交換機檢視
[SWITCHA-Gigabitethernet0/0/1] quit
3、批次將介面加入到VLAN
Access介面型別
# 將介面Eth2/0/1~Eth2/0/5批次加入VLAN10。
- 透過埠組批次將介面加入VLAN
<Huawei> system-view
[Huawei] port-group pg1
[Huawei-port-group-pg1] group-member Ethernet 2/0/1 to Ethernet 2/0/5
[Huawei-port-group-pg1] port link-type access
[Huawei-port-group-pg1] port default vlan 10
- 在VLAN檢視下批次將介面加入VLAN
<Huawei> system-view
[Huawei] vlan 10
[Huawei-vlan10] port Ethernet 2/0/1 to 2/0/5
執行此操作前,須先將所有要批次加入VLAN的介面型別配置為Access
Trunk介面型別
# 將介面Eth2/0/1~Eth2/0/5批次加入VLAN10和VLAN20。
<Huawei> system-view
[Huawei] port-group pg1
[Huawei-port-group-pg1] group-member Ethernet 2/0/1 to Ethernet 2/0/5
[Huawei-port-group-pg1] port link-type trunk
[Huawei-port-group-pg1] port trunk allow-pass vlan 10 20
Hybrid介面型別
# 將介面Eth2/0/1~Eth2/0/5批次加入VLAN10和VLAN20。
<Huawei> system-view
[Huawei] port-group pg1
[Huawei-port-group-pg1] group-member Ethernet 2/0/1 to Ethernet 2/0/5
[Huawei-port-group-pg1] port link-type hybrid
[Huawei-port-group-pg1] port hybrid tagged vlan 10
[Huawei-port-group-pg1] port hybrid untagged vlan 20