Batch Operations on Switch Ports

Publication Date:  2013-12-28 Views:  890 Downloads:  0
Issue Description
The version of S series switches is V200R001C00.
Multiple VLANs are created on a switch, and ports on the switches belong to different VLANs. A typical enterprise scenario uses a trunk port as the uplink port. This case assumes that ports 1 through 10 belong to VLAN 10, ports 11 through 20 belong to VLAN 20, and port 21 is the uplink trunk port.
In common cases, VLAN 10 and VLAN 20 are created. To improve efficiency, classify continuous ports into the corresponding VLANs.
In this case, an error message is displayed because the default type of ports on Huawei switches is hybrid. Hybrid ports on Huawei switches cannot be added to VLANs using the port command in the VLAN view. Only access ports can be added to VLANs using the port command in the VLAN view.
Alarm Information
[Huawei]vlan 10
[Huawei-vlan10]port GigabitEthernet 0/0/1 to 0/0/10
Error: Trunk or Hybrid port(s) can not be added or deleted in this manner.
Handling Process
Run the port-group command, instead of the port link-type command that sets the port type one by one.
[Huawei]port-group 1to10
[Huawei-port-group-1to10]group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/10
[Huawei-port-group-1to20]port link-type access
[Huawei-GigabitEthernet0/0/1]port link-type access
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/3]port link-type access
[Huawei-GigabitEthernet0/0/4]port link-type access
[Huawei-GigabitEthernet0/0/5]port link-type access
[Huawei-GigabitEthernet0/0/6]port link-type access
[Huawei-GigabitEthernet0/0/7]port link-type access
[Huawei-GigabitEthernet0/0/8]port link-type access
[Huawei-GigabitEthernet0/0/9]port link-type access
[Huawei-GigabitEthernet0/0/10]port link-type access
[Huawei-port-group-1to10]port default vlan 10
[Huawei-GigabitEthernet0/0/1]port default vlan 10
[Huawei-GigabitEthernet0/0/2]port default vlan 10
[Huawei-GigabitEthernet0/0/3]port default vlan 10
[Huawei-GigabitEthernet0/0/4]port default vlan 10
[Huawei-GigabitEthernet0/0/5]port default vlan 10
[Huawei-GigabitEthernet0/0/6]port default vlan 10
[Huawei-GigabitEthernet0/0/7]port default vlan 10
[Huawei-GigabitEthernet0/0/8]port default vlan 10
[Huawei-GigabitEthernet0/0/9]port default vlan 10
[Huawei-GigabitEthernet0/0/10]port default vlan 10
After creating a port group using the port-group command, you can perform batch operations on ports in the group in the port group view. This method can be used when a large number of ports require the same configuration.
Root Cause
In this case, an error message is displayed because the default type of ports on Huawei switches is hybrid. Hybrid ports on Huawei switches cannot be added to VLANs using the port command in the VLAN view. Only access ports can be added to VLANs using the port command in the VLAN view.
Suggestions
Note that only unconfigured ports can be added to a port group. If a port has some settings, delete the settings by restoring the default settings and then add the port to the port group.

END