如何将批量的端口加入VLAN
实验:
代码如下:
[SW1]vlan 5
[SW1-vlan5]Q
[SW1]POR
[SW1]port-g
[SW1]port-group huawei
[SW1-port-group-huawei]gr
[SW1-port-group-huawei]group-member g0/0/2 to g0/0/20
# 2-20口,端口都是连续性
[SW1-port-group-huawei]por
[SW1-port-group-huawei]port
[SW1-port-group-huawei]port link-type acc
[SW1-port-group-huawei]port link-type access
# 端口类型为 Access
[SW1-GigabitEthernet0/0/2]port link-type access
[SW1-GigabitEthernet0/0/3]port link-type access
[SW1-GigabitEthernet0/0/4]port link-type access
[SW1-GigabitEthernet0/0/5]port link-type access
[SW1-GigabitEthernet0/0/6]port link-type access
[SW1-GigabitEthernet0/0/7]port link-type access
[SW1-GigabitEthernet0/0/8]port link-type access
[SW1-GigabitEthernet0/0/9]port link-type access
[SW1-GigabitEthernet0/0/10]port link-type access
[SW1-GigabitEthernet0/0/11]port link-type access
[SW1-GigabitEthernet0/0/12]port link-type access
[SW1-GigabitEthernet0/0/13]port link-type access
[SW1-GigabitEthernet0/0/14]port link-type access
[SW1-GigabitEthernet0/0/15]port link-type access
[SW1-GigabitEthernet0/0/16]port link-type access
[SW1-GigabitEthernet0/0/17]port link-type access
[SW1-GigabitEthernet0/0/18]port link-type access
[SW1-GigabitEthernet0/0/19]port link-type access
[SW1-GigabitEthernet0/0/20]port link-type access
[SW1-port-group-huawei]port default vlan 5
# 加入到上面创建的Vlan 5 中
[SW1-GigabitEthernet0/0/2]port default vlan 5
[SW1-GigabitEthernet0/0/3]port default vlan 5
[SW1-GigabitEthernet0/0/4]port default vlan 5
[SW1-GigabitEthernet0/0/5]port default vlan 5
[SW1-GigabitEthernet0/0/6]port default vlan 5
[SW1-GigabitEthernet0/0/7]port default vlan 5
[SW1-GigabitEthernet0/0/8]port default vlan 5
[SW1-GigabitEthernet0/0/9]port default vlan 5
[SW1-GigabitEthernet0/0/10]port default vlan 5
[SW1-GigabitEthernet0/0/11]port default vlan 5
[SW1-GigabitEthernet0/0/12]port default vlan 5
[SW1-GigabitEthernet0/0/13]port default vlan 5
[SW1-GigabitEthernet0/0/14]port default vlan 5
[SW1-GigabitEthernet0/0/15]port default vlan 5
[SW1-GigabitEthernet0/0/16]port default vlan 5
[SW1-GigabitEthernet0/0/17]port default vlan 5
[SW1-GigabitEthernet0/0/18]port default vlan 5
[SW1-GigabitEthernet0/0/19]port default vlan 5
[SW1-GigabitEthernet0/0/20]port default vlan 5
[SW1-port-group-huawei]
[SW1-port-group-huawei]q
[SW1]
检查配置:
[SW1]dis port vlan
Port Link Type PVID Trunk VLAN List
-------------------------------------------------------------------------------
GigabitEthernet0/0/1 hybrid 1 -
GigabitEthernet0/0/2 access 5 -
GigabitEthernet0/0/3 access 5 -
GigabitEthernet0/0/4 access 5 -
GigabitEthernet0/0/5 access 5 -
GigabitEthernet0/0/6 access 5 -
GigabitEthernet0/0/7 access 5 -
GigabitEthernet0/0/8 access 5 -
GigabitEthernet0/0/9 access 5 -
GigabitEthernet0/0/10 access 5 -
GigabitEthernet0/0/11 access 5 -
GigabitEthernet0/0/12 access 5 -
GigabitEthernet0/0/13 access 5 -
GigabitEthernet0/0/14 access 5 -
GigabitEthernet0/0/15 access 5 -
GigabitEthernet0/0/16 access 5 -
GigabitEthernet0/0/17 access 5 -
GigabitEthernet0/0/18 access 5 -
GigabitEthernet0/0/19 access 5 -
GigabitEthernet0/0/20 access 5 -
GigabitEthernet0/0/21 hybrid 1 -
GigabitEthernet0/0/22 hybrid 1 -
GigabitEthernet0/0/23 hybrid 1 -
GigabitEthernet0/0/24 hybrid 1 -
[SW1]