华为交换机批量创建VLAN和端口组批量配置

批量创建VLAN配置如下(vlan batch):

<Huawei>system-view                    #切换系统视图
[Huawei]vlan batch 10 20 30            #批量创建3个vlan;vlan 10,vlan 20,vlan 30
[Huawei]vlan batch 50 to 60            #批量创建11个vlan;vlan50~60
[Huawei]undo vlan batch 10 20 30       #批量删除vlan10,20,30
[Huawei]display vlan                   #查看vlan信息如下:



The total number of vlans is : 12
--------------------------------------------------------------------------------
U: Up;         D: Down;         TG: Tagged;         UT: Untagged;
MP: Vlan-mapping;               ST: Vlan-stacking;
#: ProtocolTransparent-vlan;    *: Management-vlan;
--------------------------------------------------------------------------------

VID  Type    Ports                                                          
--------------------------------------------------------------------------------
1    common  UT:Eth0/0/1(D)     Eth0/0/2(D)     Eth0/0/3(D)     Eth0/0/4(D)     
                Eth0/0/5(D)     Eth0/0/6(D)     Eth0/0/7(D)     Eth0/0/8(D)     
                Eth0/0/9(D)     Eth0/0/10(D)    Eth0/0/11(D)    Eth0/0/12(D)    
                Eth0/0/13(D)    Eth0/0/14(D)    Eth0/0/15(D)    Eth0/0/16(D)    
                Eth0/0/17(D)    Eth0/0/18(D)    Eth0/0/19(D)    Eth0/0/20(D)    
                Eth0/0/21(D)    Eth0/0/22(D)    GE0/0/1(D)      GE0/0/2(D)      

50   common  
51   common  
52   common  
53   common  
54   common  
55   common  
56   common  
57   common  
58   common  
59   common  
60   common  

VID  Status  Property      MAC-LRN Statistics Description      
--------------------------------------------------------------------------------

1    enable  default       enable  disable    VLAN 0001                         
50   enable  default       enable  disable    VLAN 0050                         
51   enable  default       enable  disable    VLAN 0051                         
52   enable  default       enable  disable    VLAN 0052                         
53   enable  default       enable  disable    VLAN 0053                         
54   enable  default       enable  disable    VLAN 0054                         
55   enable  default       enable  disable    VLAN 0055                         
56   enable  default       enable  disable    VLAN 0056                         
57   enable  default       enable  disable    VLAN 0057                         
58   enable  default       enable  disable    VLAN 0058                         
59   enable  default       enable  disable    VLAN 0059                         
60   enable  default       enable  disable    VLAN 0060

 端口组配置命令(port-group):

[Huawei]port-group test                                  #创建端口组test
[Huawei-port-group-test]display port-group               #查看端口组
[Huawei-port-group-test]group-member e0/0/1 to e0/0/10   #批量选择e0/0/1-e0/0/10端口加入test端口组
[Huawei-port-group-test]port link-type access            #批量更改端口组链路类型
[Huawei-port-group-test]port default vlan 50             #将e0/0/1-e0/0/10端口批量加入vlan 50
[Huawei-port-group-test]undo group-member e0/0/3 e0/0/5 e0/0/9   #从该组中删除e0/0/3 e0/0/5 e0/0/9三个接口
[Huawei]undo port-group test                             #删除端口组test



[Huawei-port-group-test]display this            #查看端口组信息

#
port-group test
 group-member Ethernet0/0/1
 group-member Ethernet0/0/3
 group-member Ethernet0/0/2
 group-member Ethernet0/0/4
 group-member Ethernet0/0/5
 group-member Ethernet0/0/6
 group-member Ethernet0/0/7
 group-member Ethernet0/0/8
 group-member Ethernet0/0/9
 group-member Ethernet0/0/10
#
return     

[Huawei]display port vlan             #查看端口信息


Port                    Link Type    PVID  Trunk VLAN List
-------------------------------------------------------------------------------
Ethernet0/0/1           access       50    -                                   
Ethernet0/0/2           access       50    -                                   
Ethernet0/0/3           access       50    -                                   
Ethernet0/0/4           access       50    -                                   
Ethernet0/0/5           access       50    -                                   
Ethernet0/0/6           access       50    -                                   
Ethernet0/0/7           access       50    -                                   
Ethernet0/0/8           access       50    -                                   
Ethernet0/0/9           access       50    -                                   
Ethernet0/0/10          access       50    -                                   
Ethernet0/0/11          hybrid       1     -                                   
Ethernet0/0/12          hybrid       1     -                                   
Ethernet0/0/13          hybrid       1     -                                   
Ethernet0/0/14          hybrid       1     -                                   
Ethernet0/0/15          hybrid       1     -                                   
Ethernet0/0/16          hybrid       1     -                                   
Ethernet0/0/17          hybrid       1     -                                   
Ethernet0/0/18          hybrid       1     -                                   
Ethernet0/0/19          hybrid       1     -                                   
Ethernet0/0/20          hybrid       1     -                                   
Ethernet0/0/21          hybrid       1     -                                   
Ethernet0/0/22          hybrid       1     -                                   
GigabitEthernet0/0/1    hybrid       1     -                                   
GigabitEthernet0/0/2    hybrid       1     -
点赞