其他分享
首页 > 其他分享> > HUAWEI-GVRP+VLAN划分五种方法配置案例

HUAWEI-GVRP+VLAN划分五种方法配置案例

作者:互联网

HUAWEI-GVRP+VLAN划分五种方法配置案例

image

说明:本实验配置GVRP将SW1的VLAN传递至SW2,以四台PC机测试划分VLAN的四种方法.

本端设备 接口 接口类型 IP地址或所属VLAN 对端设备 接口 接口类型 IP地址或所属VLAN
SW1 GE 0/0/1 Trunk VLAN 10 20 SW2 GE 0/0/1 Trunk VLAN 10 20
SW1 Ethernet 0/0/1 access VLAN 10 PC1 Ethernet 0/0/1 NULL 192.168.10.10
SW1 Ethernet 0/0/2 hybrid VLAN 20 PC2 Ethernet 0/0/1 NULL 192.168.20.10
SW1 Ethernet 0/0/3 hybrid VLAN 30 PC3 Ethernet 0/0/1 NULL 192.168.30.10
SW2 Ethernet 0/0/1 hybrid VLAN 10 PC4 Ethernet 0/0/1 NULL 192.168.10.20
SW2 Ethernet 0/0/2 hybrid VLAN 20 PC7 Ethernet 0/0/1 NULL 192.168.20.20
SW2 Ethernet 0/0/3 hybrid VLAN 30 PC8 Ethernet 0/0/1 NULL 192.168.30.20

配置步骤:

配置VLAN的划分方式:

项目实施:

配置全局GVRP,在G0/0/1开启GVRP功能

[SW1]vlan batch 10 20 30 
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]gvrp 
[SW1]interface GigabitEthernet0/0/1
[SW1-GigabitEthernet0/0/1] port link-type trunk
[SW1-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 20 30
[SW1-GigabitEthernet0/0/1] gvrp
[SW2] gvrp
[SW2]interface GigabitEthernet0/0/1
[SW2-GigabitEthernet0/0/1] port link-type trunk
[SW2-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 20 30
[SW2-GigabitEthernet0/0/1] gvrp

1.基于接口划分VLAN

[SW1]interface Ethernet0/0/1
[SW1-Ethernet0/0/1] port link-type access
[SW1-Ethernet0/0/1] port default vlan 10

2.基于子网划分VLAN

[SW2]vlan 10
[SW2-vlan10] ip-subnet-vlan 1 ip 192.168.10.20 255.255.255.0 priority 1
#
[SW2]interface Ethernet0/0/1
[SW2-Ethernet0/0/1] port hybrid untagged vlan 10
[SW2-Ethernet0/0/1] ip-subnet-vlan enable

3.基于源MAC划分VLAN

[SW1]vlan 20
[SW1-vlan20] mac-vlan mac-address 5489-98f0-7ae1 priority 0
#
[SW1]interface Ethernet0/0/2
[SW1-Ethernet0/0/2] port hybrid untagged vlan 20
[SW1-Ethernet0/0/2] mac-vlan enable

4.基于协议划分VLAN

[SW2]vlan 20
[SW2-vlan20] protocol-vlan 0 ipv4
#
[SW2]interface Ethernet0/0/2
[SW2-Ethernet0/0/2] port hybrid untagged vlan 20
[SW2-Ethernet0/0/2] protocol-vlan vlan 20 0 priority 0

5.基于策略划分VLAN

[SW1]vlan 30
[SW1-vlan30] policy-vlan mac-address 5489-98c9-4393 ip 192.168.30.10 interface Ethernet0/0/3
#
[SW1]interface Ethernet0/0/3
[SW1-Ethernet0/0/3] port hybrid untagged vlan 30
[SW2]vlan 30
[SW2-vlan30] policy-vlan mac-address 5489-9888-13b5 ip 192.168.30.20 interface Ethernet0/0/3
#
[SW2]interface Ethernet0/0/3
[SW2-Ethernet0/0/3] port hybrid untagged vlan 30

项目验证:

image

image

image

基于接口验证:

[SW1]dis port vlan 
Port                    Link Type    PVID  Trunk VLAN List
-------------------------------------------------------------------------------
Ethernet0/0/1           access       10    -                                   
Ethernet0/0/2           hybrid       1     -                                   
Ethernet0/0/3           hybrid       1     -                                   
Ethernet0/0/4           hybrid       1     -                                   
Ethernet0/0/5           hybrid       1     -                                   
Ethernet0/0/6           hybrid       1     -                                   
Ethernet0/0/7           hybrid       1     -                                   
Ethernet0/0/8           hybrid       1     -                                   
Ethernet0/0/9           hybrid       1     -                                   
Ethernet0/0/10          hybrid       1     -                                   
Ethernet0/0/11          hybrid       1     -                                   
Ethernet0/0/12          hybrid       1     -                                   
Ethernet0/0/13          hybrid       1     -                                   
Ethernet0/0/14          hybrid       1     -                                   
Ethernet0/0/15          hybrid       1     -                                   
Ethernet0/0/16          hybrid       1     -                                   
Ethernet0/0/17          hybrid       1     -                                   
Ethernet0/0/18          hybrid       1     -                                   
Ethernet0/0/19          hybrid       1     -                                   
Ethernet0/0/20          hybrid       1     -                                   
Ethernet0/0/21          hybrid       1     -                                   
Ethernet0/0/22          hybrid       1     -                                   
GigabitEthernet0/0/1    trunk        1     1 10 20 30
GigabitEthernet0/0/2    hybrid       1     -    

基于源MAC验证:

[Huawei]dis mac-vlan vlan 20 
---------------------------------------------------
MAC Address     MASK            VLAN    Priority   
---------------------------------------------------
5489-98f0-7ae1  ffff-ffff-ffff  20      0          

Total MAC VLAN address count: 1 

基于子网验证:

[SW2]dis ip-subnet-vlan vlan all 
 ----------------------------------------------------------------
 Vlan    Index   IpAddress           SubnetMask          Priority    
 ----------------------------------------------------------------
 10      1       192.168.10.20       255.255.255.0       1 
 ----------------------------------------------------------------
 ip-subnet-vlan count: 1  		 total count: 1 

基于协议验证:

[SW2]dis protocol-vlan vlan all 
----------------------------------------------------------------
 VLAN           Protocol Index    Protocol Type                          
----------------------------------------------------------------
 20             0                 ipv4    

基于策略验证:

[SW1]display policy-vlan all
 ------------------------------------------------------------------------
 MacAddress      IPAddress         Port                  Vlan    Priority    
 ------------------------------------------------------------------------
 5489-98c9-4393  192.168.30.10     Eth0/0/3              30      0   
 ------------------------------------------------------------------------
Total Policy-VLAN count: 1 
[SW2]dis policy-vlan all 
 ------------------------------------------------------------------------
 MacAddress      IPAddress         Port                  Vlan    Priority    
 ------------------------------------------------------------------------
 5489-9888-13b5  192.168.30.20     Eth0/0/3              30      0   
 ------------------------------------------------------------------------
Total Policy-VLAN count: 1 

TIPS:相关资料参考华为官方文档

标签:vlan,GVRP,Ethernet0,VLAN,hybrid,HUAWEI,SW1,SW2
来源: https://www.cnblogs.com/wm-plengong/p/16260827.html