Hi there, everyone!
This post describes VLAN Assignment. Please check out the information displayed below.
VLAN assignment modes:
? Port-based VLAN assignment: VLAN IDs are assigned based on switch ports. The configuration is simple, and this mode applies to various scenarios.
? MAC address-based VLAN assignment: VLAN IDs are assigned based on source MAC addresses of packets. This mode applies to scenarios where users' positions change frequently.
? IP subnet-based VLAN assignment: VLAN IDs are assigned based on source IP addresses of packets. This mode applies to scenarios where hosts on the same network segment are managed uniformly.
? Protocol-based VLAN assignment: VLAN IDs are assigned based on protocol types of packets. This mode applies to scenarios where hosts with the same applications or services are managed uniformly.
? Policy-based VLAN assignment: VLAN IDs are assigned based on policies such as source MAC addresses, source IP addresses, and port number of packets. This mode applies to scenarios demanding high security.
Among the preceding VLAN assignment modes, port-based VLAN assignment is often used and its configuration is the most simplest. How do we configure and use this mode?
Before configure port-based VLAN assignment, let's review common link types of ports.
Access port: connects a switch to a PC.
Trunk port: connects switches.
Hybrid port: connects a switch to a PC or connects switches. The hybrid port is often used when a switch connects to a PC through a hub or switches are connected through a hub.
Let's move to port-based VLAN assignment configuration.
Scenario 1: Two PCs connect to a switch. How the hosts are isolated using port-based VLAN assignment?

? Check whether the two PCs on the same network segment can be pinged successfully when the two PCs directly connect to the switch and no VLAN is assigned. 
The ping operation is successful. Why?
By default, ports on a Huawei switch join VLAN 1. As long as the two PCs connected to the switch belong to the same network segment, the two PCs can communicate.
? How are PCs isolated using VLAN assignment? Add ports to different VLANs. For example, GE0/0/1 and GE0/0/2 as access ports join VLAN 10 and VLAN 20 respectively.

? The two PCs in different VLANs cannot communicate with each other.

Scenario 2: Four PCs connect to switches. How do we implement isolation and interworking of the PCs using port-based VLAN assignment?
By default, the four PCs belong to the same network segment and can be pinged mutually. Assume that PC1 and PC2 belong to the same department, and PC3 and PC4 belong to the same department. How do we implement interworking of the same department and between departments using port-based VLAN assignment?

? PC1 and PC2 of the same department are added to VLAN 100. GE0/0/1 ports on Switch 1 and Switch 2 join VLAN 100 as access ports.


? PC3 and PC4 of the same department are added to VLAN 200.


? GE0/0/3 ports on Switch 1 and Switch 2 join VLAN 200 as trunk ports.


? PC1 and PC2 in the same department can communicate, and PC3 and PC4 in different departments cannot communicate.


In the preceding two scenarios, fewer VLANs and ports are configured. In practice, many VLANs and ports need to be configured. Which measure can be taken to complete the configuration rapidly? I will describe how to perform the configuration in a batch and rapidly restore the default VLAN configuration of ports?
1. Create VLANs in a batch.
< Huawei > system-view
[Huawei]vlan batch 2 to 100
2. Add ports to VLANs in a batch.
[Huawei] port-group group-member GigabitEthernet 0/0/10 to
GigabitEthernet 0/0/20
[Huawei-port-group]port link-type access
[Huawei-port-group]port default vlan 100
3. Rapidly restore the default VLAN configuration of ports.
What is the default VLAN configuration? All ports on Huawei switches join only VLAN 1 by default.
How is the default configuration of three ports rapidly restored?
? Access port: Run the undo port default vlan command.
? Trunk and hybrid ports:
Restore the default PVID, delete all VLANs from ports, and add ports to VLAN 1.
trunk | hybrid |
undo port trunk pvid vlan | undo port hybrid pvid vlan |
This issue describes VLAN assignment. For more information about VLAN technology, see the next issue.
To be continued...

Issue | Name | Description |
First issue | This issue describes the definition and purpose of VLAN technology and modes in which interfaces are added to VLANs. | |
Second issue | This issue describes VLAN assignment modes and applicable scenarios, and mainly describes the configuration and scenario of interface-based assignment. | |
Third issue | This issue describes main technologies and applicable scenarios of inter-VLAN communication, including the VLANIF interface, sub-interface, and super-VLAN. This issue also describes common VLANIF interface configuration. | |
Fourth issue | This issue describes main technologies and applicable scenarios of VLAN isolation, such as MUX VLAN and ACL. |
★★★Summary★★★ All About Huawei Switch Features and Configurations

![VLAN Assignment [All About Switches 14]-3974051-1](static/image/smiley/huaan/ha_sh.gif)

