华为交换机——批量将端口加入VLAN

如何将批量的端口加入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]

完成!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值