1. 接口加入VLAN [HUAWEI-GigabitEthernet0/0/1] port link-type access //设置接口的链路类型为Access [HUAWEI-GigabitEthernet0/0/1] port default vlan 10 [HUAWEI-GigabitEthernet0/0/1] port link-type trunk //设置接口的链路类型为Trunk [HUAWEI-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 [HUAWEI-GigabitEthernet0/0/1]port link-type hybrid //设置接口的链路类型为Hybrid [HUAWEI-GigabitEthernet0/0/1]port hybrid tagged vlan 10 //接口GigabitEthernet0/0/1以Tagged方式加入VLAN 10 [HUAWEI-GigabitEthernet0/0/1]port hybrid untagged vlan 20 //接口GigabitEthernet0/0/1以Untagged方式加入VLAN 20 [HUAWEI-GigabitEthernet0/0/1]port link-type dot1q-tunnel //设置接口的链路类型为QinQ [HUAWEI-GigabitEthernet0/0/1] port default vlan 10
  2. 批量创建VLAN [HUAWEI] vlan batch 11 to 20 [HUAWEI] vlan batch 10 15 to 19 25 28 to 30
  3. 接口批量加入VLAN (1)access接口类型 [HUAWEI] port-group pg1 //创建端口组pg1 [HUAWEI-port-group-pg1]group-member gigabitethernet1/0/1 to gigabitethernet1/0/5 [HUAWEI-port-group-pg1] port link-type access //批量修改端口gigabitethernet1/0/1 to gigabitethernet1/0/5的链路类型为access [HUAWEI-port-group-pg1] port default vlan 10 (2)trunk接口类型 [HUAWEI] port-group pg1 //创建端口组pg1 [HUAWEI-port-group-pg1]group-member gigabitethernet1/0/1 to gigabitethernet1/0/5 [HUAWEI-port-group-pg1]port link-type trunk [HUAWEI-port-group-pg1]port trunk allow-pass vlan 10 20 (3)hybrid接口类型 [HUAWEI] port-group pg1 [HUAWEI-port-group-pg1]group-member gigabitethernet1/0/1 to gigabitethernet1/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
  4. 恢复接口下VLAN的缺省配置 (1)access接口 [HUAWEI-GigabitEthernet0/0/1]undo port default vlan
    (2)trunk接口 [HUAWEI-GigabitEthernet0/0/1]undo port trunk pvid vlan [HUAWEI-GigabitEthernet0/0/1]undo port trunk allow-pass vlan all [HUAWEI-GigabitEthernet0/0/1]port trunk pvid vlan 1 (3)hybrid接口 [HUAWEI-GigabitEthernet0/0/1]undo port hybrid pvid vlan [HUAWEI-GigabitEthernet0/0/1]undo port hybrid vlan all [HUAWEI-GigabitEthernet0/0/1]port hybrid untagged vlan 1
  5. 删除VLAN [HUAWEI] undo vlan 10 [HUAWEI] undo vlan batch 10 to 20
  6. 修改接口的链路类型 (1)当接口上VLAN的缺省配置为默认加入VLAN 1,并且PVID为VLAN 1 [HUAWEI-GigabitEthernet0/0/1] port link-type access [HUAWEI-GigabitEthernet0/0/1] port default vlan 10 [HUAWEI-GigabitEthernet0/0/1] port link-type hybrid [HUAWEI-GigabitEthernet0/0/1] port hybrid pvid vlan 10
    [HUAWEI-GigabitEthernet0/0/1]port hybrid untagged vlan 2 [HUAWEI-GigabitEthernet0/0/1]port hybrid tagged vlan 20 [HUAWEI-GigabitEthernet0/0/1] port link-type dot1q-tunnel [HUAWEI-GigabitEthernet0/0/1] port default vlan 10 (2)接口上VLAN的配置不是缺省值 [HUAWEI-GigabitEthernet0/0/1] undo port default vlan //复Access或Dot1q-tunnel接口上VLAN的缺省配置 恢复Trunk接口上VLAN的缺省配置 [HUAWEI-GigabitEthernet0/0/1]undo port trunk pvid vlan [HUAWEI-GigabitEthernet0/0/1]undo port trunk allow-pass vlan all [HUAWEI-GigabitEthernet0/0/1]port trunk allow-pass vlan 1 恢复Hybrid接口上VLAN的缺省配置 [HUAWEI-GigabitEthernet0/0/1]undo port hybrid pvid vlan [HUAWEI-GigabitEthernet0/0/1]undo port hybrid vlan all [HUAWEI-GigabitEthernet0/0/1]port hybrid untagged vlan 1