当前位置:网站首页>华为VRRP+MSTP联动接口检测实验案例

华为VRRP+MSTP联动接口检测实验案例

2022-08-09 10:44:00 嘎嘎不是鸭

一、MSTP(Multiple Spanning Tree Protocol)多生成树协议

1、MSTP把一个交换网络划分成多个域,每个域内形成多棵生成树,生成树之间彼此独立。每棵生成树叫做一个多生成树实例MSTI(Multiple Spanning Tree Instance),每个域叫做一个MST域(MST Region:Multiple Spanning Tree Region)。

 

2、所谓生成树实例就是多个VLAN的一个集合。通过将多个VLAN捆绑到一个实例,可以节省通信开销和资源占用率。MSTP各个实例拓扑的计算相互独立,在这些实例上可以实现负载均衡。可以把多个相同拓扑结构的VLAN映射到一个实例里,这些VLAN在端口上的转发状态取决于端口在对应MSTP实例的状态。

 

作用:1、防止二层环路以及链路冗余

           2、基于VLAN的负载均衡

 

二、VRRP(Virtual Router Redundancy Protocol)虚拟网关冗余协议

    VRRP广泛应用在边缘网络中,它的设计目标是支持特定情况下IP数据流量失败转移不会引起混乱,允许主机使用单路由器,以及即使在实际第一跳路由器使用失败的情形下仍能够维护路由器间的连通性。

    为了防止网关单点故障,致使主机无法通信,利用VRRP协议当主网关故障时可自动切换为备份网关,不影响主机的通信

实验拓扑

要求:LSW1作为VLAN10和VLAN20的主根桥以及主网关,VLAN30和VLAN40的次根桥以及备份网关

LSW2作为VLAN30和VLAN40的主根桥以及主网关,VLAN10和VLAN20的次根桥以及备份网关

对上行口g0/0/4进行检测,如果接口down掉,主备网关角色对调,避免次优路径

LSW1配置

[LSW1]port-group group-member g0/0/1 to g0/0/3
[LSW1-port-group]port link-type trunk
[LSW1-port-group]port trunk allow-pass vlan al
[LSW1]vlan batch 10 20 30 40 100	
[LSW1]int g0/0/4
[LSW1-GigabitEthernet0/0/4]port link-type access
[LSW1-GigabitEthernet0/0/4]port default vlan 100

[LSW1]stp mode mstp        
[LSW1-mst-region]region-name abab              
[LSW1-mst-region]instance 1 vlan 10 20                 
[LSW1-mst-region]instance 2 vlan 30 40 
[LSW1-mst-region]active region-configuration  
[LSW1]stp instance 1 root primary          
[LSW1]stp instance 2 root secondary

[LSW1]interface Vlanif 10
[LSW1-Vlanif10]ip address 192.168.10.252 24
[LSW1]interface Vlanif 20
[LSW1-Vlanif20]ip address 192.168.20.252 24
[LSW1]interface Vlanif 30
[LSW1-Vlanif10]ip address 192.168.10.252 24
[LSW1]interface Vlanif 40
[LSW1-Vlanif20]ip address 192.168.20.252 24
[LSW1]int Vlanif 100
[LSW1-Vlanif100]ip address 192.168.100.1 24

[LSW1]ospf 100     
[LSW1-ospf-100]area 0 
[LSW1-ospf-100-area-0.0.0.0]net 0.0.0.0 255.255.255.255 

[LSW1]int vlan 10
[LSW1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.254
[LSW1-Vlanif10]vrrp vrid 1 priority 120
[LSW1-Vlanif10]vrrp vrid 1 track interface g0/0/4 reduced 60
[LSW1]int vlan 20
[LSW1-Vlanif20]vrrp vrid 1 virtual-ip 192.168.20.254
[LSW1-Vlanif20]vrrp vrid 1 priority 120
[LSW1-Vlanif20]vrrp vrid 1 track interface g0/0/4 reduced 60
[LSW1]int vlan 30
[LSW1-Vlanif30]vrrp vrid 2 virtual-ip 192.168.30.254
[LSW1]int vlan 40
[LSW1-Vlanif40]vrrp vrid 2 virtual-ip 192.168.40.254

LSW2配置

[LSW2]port-group group-member g0/0/1 to g0/0/3
[LSW2-port-group]port link-type trunk 
[LSW2-port-group]port trunk allow-pass vlan all
[LSW2]vlan batch 10 20 30 40 200
[LSW2]int g0/0/4
[LSW2-GigabitEthernet0/0/4]port link-type access
[LSW2-GigabitEthernet0/0/4]port default vlan 100

[LSW2]stp mode mstp
[LSW2]stp region-configuration
[LSW2-mst-region]region-name abab
[LSW2-mst-region]instance 1 vlan 10 20         
[LSW2-mst-region]instance 2 vlan 30 40
[LSW2-mst-region]active region-configuration
[LSW2]stp instance 2 root primary             
[LSW2]stp instance 1 root secondary

[LSW2]interface Vlanif 10
[LSW2-Vlanif10]ip address 192.168.10.253 24
[LSW2]interface Vlanif 20
[LSW2-Vlanif20]ip address 192.168.20.253 24
[LSW2]interface Vlanif 30
[LSW2-Vlanif10]ip address 192.168.10.253 24
[LSW2]interface Vlanif 40
[LSW2-Vlanif20]ip address 192.168.20.253 24
[LSW2]int Vlanif 200
[LSW2-Vlanif100]ip address 192.168.200.1 24

[LSW2]ospf 100
[LSW2-ospf-100]area 0 
[LSW2-ospf-100-area-0.0.0.0]net 0.0.0.0 255.255.255.255 

[LSW2]int vlan 10
[LSW2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.254
[LSW2]int vlan 20
[LSW2-Vlanif20]vrrp vrid 1 virtual-ip 192.168.20.254
[LSW2]int vlan 30
[LSW2-Vlanif30]vrrp vrid 2 virtual-ip 192.168.30.254
[LSW2-Vlanif30]vrrp vrid 2 priority 120
[LSW2-Vlanif30]vrrp vrid 2 track interface g0/0/4 reduced 60
[LSW2]int vlan 40
[LSW2-Vlanif40]vrrp vrid 2 virtual-ip 192.168.40.254
[LSW2-Vlanif40]vrrp vrid 2 priority 120
[LSW2-Vlanif40]vrrp vrid 2 track interface g0/0/4 reduced 60

LSW3配置

[LSW3]int g0/0/1
[LSW3-GigabitEthernet0/0/1]port link-type access
[LSW3-GigabitEthernet0/0/1]port default vlan 10
[LSW3]int g0/0/2
[LSW3-GigabitEthernet0/0/2]port link-type access
[LSW3-GigabitEthernet0/0/2]port default vlan 20
[LSW3]int g0/0/3
[LSW3-GigabitEthernet0/0/3]port link-type trunk
[LSW3-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[LSW3]int g0/0/4
[LSW3-GigabitEthernet0/0/4]port link-type trunk
[LSW3-GigabitEthernet0/0/4]port trunk allow-pass vlan all
[LSW3]stp mode mstp
[LSW3]stp region-configuration
[LSW3-mst-region]region-name abab
[LSW3-mst-region]instance 1 vlan 10 20
[LSW3-mst-region]instance 2 vlan 30 40
[LSW3-mst-region]active region-configuration

LSW4配置

[LSW4]int g0/0/1
[LSW4-GigabitEthernet0/0/1]port link-type access
[LSW4-GigabitEthernet0/0/1]port default vlan 30
[LSW4]int g0/0/2
[LSW4-GigabitEthernet0/0/2]port link-type access
[LSW4-GigabitEthernet0/0/2]port default vlan 40
[LSW4]int g0/0/3
[LSW4-GigabitEthernet0/0/3]port link-type trunk
[LSW4-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[LSW4]int g0/0/4
[LSW4-GigabitEthernet0/0/4]port link-type trunk
[LSW4-GigabitEthernet0/0/4]port trunk allow-pass vlan all
[LSW4]stp mode mstp
[LSW4]stp region-configuration
[LSW4-mst-region]region-name abab
[LSW4-mst-region]instance 1 vlan 10 20
[LSW4-mst-region]instance 2 vlan 30 40
[LSW4-mst-region]active region-configuration

R1配置

[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.100.2 24
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.200.2 24
[R1]int g0/0/2
[R1-GigabitEthernet0/0/2]ip address 8.8.8.254 24
[R1]ospf 100
[R1-ospf-100]area 0
[R1-ospf-100-area-0.0.0.0]net 0.0.0.0 255.255.255.255

验证:

LSW1作为实例1的根桥,LSW2作为实例2的根桥

LSW1作为VLAN10、20的主网关,LSW2作为VLAN30、40的主网关

当网络正常时PC1访问服务器

当网络正常时PC3访问服务器

当LSW1上行口down掉后PC1访问服务器

当LSW2上行口down掉后PC3访问服务器

原网站

版权声明
本文为[嘎嘎不是鸭]所创,转载请带上原文链接,感谢
https://ppgsec.blog.csdn.net/article/details/117406287