Introduction to 5 division methods of Ethernet VLAN (based on port, based on MAC address, based on IP subnet, based on protocol, based on policy) and basic configuration commands

2.8.3 Ethernet VLAN (VLAN division method)

1. Based on port division

Brief description : Manually specify the VLAN to which the port belongs on the port.

Note : None

Based on port division

Configuration command : (configure vlan 10 to which the interface belongs)
interface e0/0/1

  • Access mode: port link-type access,port default vlan 10
  • Trunk mode: port link-type trunkport trunk pvid vlan 10
  • Hybrid mode: port link-type hybrid,port hybrid pvid vlan 10

2. Based on MAC address division

Brief description : Configure mac-vlan to realize the binding of network device MAC address and vlan. When the device is configured with mac-vlan device and connected to different ports, the vlan will not be changed.

Precautions:

  1. In VLAN mode: bind MAC address and VLAN
  2. In the interface: enable the mac-vlan mode,mac-vlan enable
  3. Huawei device ports are in hybrid mode by default, and only vlan1 data is allowed , so you need to pay attention to configuring the allowed vlan.

Configuration command: (configure the binding of MAC address and vlan under vlan10)

vlan 10
 mac-vlan mac-address 5489-98f1-51db priority 0
 #后面的priority 0缺省产生,可不明确指定

interface Ethernet0/0/2
 port hybrid untagged vlan 10 # 放行VLAN10
 mac-vlan enable    # 开启MAC-Vlan功能

#用于测试的目标主机
interface Ethernet0/0/3
 port link-type access
 port default vlan 10

Division based on MAC address

3. Based on IP subnetting

Brief description : Set the protocol to bind with Vlan, and when the specified protocol enters, it will be marked with the corresponding VLAN tag (too little use, no in-depth understanding)

Precautions:

  1. In VLAN mode: IP subnet binding
  2. In the interface: enable the ip-subnet-vlan function ,ip-subnet-vlan enable
  3. Huawei device ports are in hybrid mode by default, and only vlan1 data is allowed , so you need to pay attention to configuring the allowed vlan.

Configuration command: (configure the binding between host 192.168.1.3 and vlan under vlan10)

vlan 10
 ip-subnet-vlan ip 192.168.1.3 32
 
interface Ethernet0/0/4
 port hybrid untagged vlan 10  # 因为默认hybrid不放行vlan10
 ip-subnet-vlan enable		   # 开启ip-subnet-vlan功能

Based on IP subnetting

4. Based on agreement division

Brief description : Set the protocol to bind with Vlan, and when the specified protocol enters, it will be marked with the corresponding VLAN tag (too little use, no in-depth understanding)

Precautions:

  1. Protocol binding in VLAN mode
  2. Enable the protocol-vlan function on the interface

Configuration command:

vlan 10
 protocol-vlan ipv4 

interface Ethernet0/0/11
 protocol-vlan vlan 10 all

Five, based on strategy division

Brief description : Specify MAC, IP, and ports through policies , and divide VLANs only when network devices meet all conditions .

Precautions:

  1. Policy configuration in VLAN mode
  2. It is not necessary to enable the mac-vlan and ip-subnet-vlan functions under the interface . If it is a mixed configuration, it can also be configured without being affected.
  3. Huawei device ports are in hybrid mode by default, and only vlan1 data is allowed , so you need to pay attention to configuring the allowed vlan.

Configuration command:

vlan 10
 policy-vlan mac-address 5489-989A-779B ip 192.168.1.4 interface e0/0/2 

interface Ethernet0/0/2
 port hybrid untagged vlan 10

policy-based partitioning

Guess you like

Origin blog.csdn.net/qq_45443704/article/details/128254667