In the realm of network infrastructure, Virtual Local Area Networks (VLANs) play a pivotal role in enhancing network efficiency, security, and manageability. As a trusted Huawei switch supplier, I am well - versed in the process of configuring a Huawei switch for VLANs. In this blog, I will guide you through the step - by - step process of setting up VLANs on Huawei switches, covering different models such as the Huawei S5700 Switch, Huawei S6700, and Huawei Switch S6730.
Understanding VLANs
Before delving into the configuration process, it's essential to understand what VLANs are. A VLAN is a logical grouping of network devices that can span multiple physical LAN segments. VLANs allow network administrators to segment a network into smaller, more manageable groups, regardless of the physical location of the devices. This segmentation can improve network performance by reducing broadcast traffic, enhance security by isolating sensitive data, and simplify network management.
Prerequisites
- Physical Connection: Ensure that your Huawei switch is properly connected to the power supply and the network. You may also need a console cable to connect your computer to the switch's console port for initial configuration.
- Access to the Switch: You should have administrative access to the switch, which usually involves knowing the username and password. If it's a new switch, the default credentials can be used initially.
- Basic Network Knowledge: Familiarity with basic networking concepts such as IP addresses, subnets, and Ethernet frames is helpful.
Configuring VLANs on Huawei Switches
Step 1: Enter System View
The first step in configuring a VLAN on a Huawei switch is to enter the system view. You can do this by logging in to the switch via the console port or a Telnet/SSH session. Once logged in, you'll be in the user view. To enter the system view, use the following command:
<HUAWEI> system - view
[HUAWEI]
The prompt changes from <HUAWEI> to [HUAWEI], indicating that you are now in the system view.
Step 2: Create VLANs
In the system view, you can create VLANs using the vlan command. For example, to create VLAN 10 and VLAN 20, use the following commands:
[HUAWEI] vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
The vlan batch command allows you to create multiple VLANs at once. You can also create a single VLAN using the vlan command followed by the VLAN ID, e.g., [HUAWEI] vlan 30.
Step 3: Configure VLAN Interfaces
If you want to enable communication between different VLANs or between the VLAN and the external network, you need to configure VLAN interfaces. Each VLAN interface acts as a virtual router interface for the VLAN. To create a VLAN interface for VLAN 10 and assign an IP address to it, use the following commands:
[HUAWEI] interface vlanif 10
[HUAWEI - Vlanif10] ip address 192.168.10.1 24
Here, 192.168.10.1 is the IP address assigned to the VLAN interface, and 24 represents the subnet mask (255.255.255.0). Repeat this process for other VLANs as needed.
Step 4: Assign Ports to VLANs
After creating the VLANs and configuring the VLAN interfaces, you need to assign physical ports on the switch to the appropriate VLANs. There are two main types of port modes: access mode and trunk mode.


Access Mode
In access mode, a port belongs to a single VLAN. To configure a port (e.g., GigabitEthernet 0/0/1) to be in access mode and assign it to VLAN 10, use the following commands:
[HUAWEI] interface GigabitEthernet 0/0/1
[HUAWEI - GigabitEthernet0/0/1] port link - type access
[HUAWEI - GigabitEthernet0/0/1] port access vlan 10
Trunk Mode
Trunk mode is used when a port needs to carry traffic from multiple VLANs. To configure a port (e.g., GigabitEthernet 0/0/2) to be in trunk mode and allow traffic from VLAN 10 and VLAN 20, use the following commands:
[HUAWEI] interface GigabitEthernet 0/0/2
[HUAWEI - GigabitEthernet0/0/2] port link - type trunk
[HUAWEI - GigabitEthernet0/0/2] port trunk allow - pass vlan 10 20
Step 5: Save the Configuration
After completing the VLAN configuration, it's important to save the configuration to the switch's non - volatile memory. This ensures that the configuration will be retained even after a power cycle. To save the configuration, use the following command:
[HUAWEI] save
The current configuration will be written to the device.
Are you sure to continue? [Y/N]: y
Info: The configuration has been saved successfully.
Verifying VLAN Configuration
You can verify the VLAN configuration on the switch using several commands. For example, to display the VLAN information, use the display vlan command:
[HUAWEI] display vlan
This command will show you a list of all the VLANs created on the switch, along with their status and the ports assigned to each VLAN. To display the port link - type and VLAN assignment information for a specific port, use the display interface command followed by the port name, e.g., [HUAWEI] display interface GigabitEthernet 0/0/1.
Troubleshooting
- VLAN Not Working: If devices in a VLAN cannot communicate with each other, check the port assignments. Make sure that the ports are correctly configured as access or trunk ports and that the VLAN IDs match.
- Connectivity Issues: If there are connectivity issues between VLANs, verify the VLAN interface configuration. Ensure that the IP addresses assigned to the VLAN interfaces are in the correct subnet and that there are no routing issues.
- Configuration Loss: If the configuration is lost after a power cycle, it may be because the configuration was not saved properly. Always remember to use the
savecommand after making any changes.
Conclusion
Configuring VLANs on Huawei switches is a straightforward process that can significantly improve the performance, security, and manageability of your network. By following the steps outlined in this blog, you can create and manage VLANs on different Huawei switch models, such as the Huawei S5700 Switch, Huawei S6700, and Huawei Switch S6730.
As a Huawei switch supplier, I am committed to providing high - quality products and professional technical support. If you are interested in purchasing Huawei switches or need further assistance with VLAN configuration, please feel free to contact us for procurement and in - depth discussions. Our team of experts is ready to help you build a more efficient and secure network infrastructure.
References
- Huawei Switch Configuration Guide
- Networking Fundamentals Textbooks
