当前位置:   article > 正文

【随笔】VRRP+MSTP

【随笔】VRRP+MSTP

虚拟路由冗余协议(Virtual Router Redundancy Protocol,VRRP)

设计采用主备模式,将VRRP组内多个路由设备都映射为一个虚拟路由设备。
一个VRRP组中只能由一台处于主控角色的路由器,可以有一个或多个备份角色的路由器。

VRRP 使用选择策略从路由器组中选出一台作为主控,负责 ARP 响应和 IP 数据包转发,组中的其他路由器作为备份的角色处于待命状态。
当主控空路由发生故障时,备份路由器能在几秒的时间延后升级的主路由器。VRRP使得局域网内的主机看上去只使用了一个设备。

设置抢占模式
R1(config)# interface vlan 10
R1(config-if)# ip address 172.16.10.2 255.255.255.0
R1(config-if)# standby 1 ip 172.16.10.1  # 设置网关
R1(config-if)# standby 1 preempt # 设置为抢占模式
  • 1
  • 2
  • 3
  • 4

抢占模式的意义, 当 R1 路由器中断又恢复后,则恢复 R1 的主导地位。

设置优先级
R2(config)# interface vlan 10
R2(config-if)# ip address 172.16.10.3 255.255.255.0
R2(config-if)# standby 1 ip 172.16.10.1 #设置网关
R2(config-if)# standby 1 preempt # 设置为抢占模式
R2(config)# interface vlan 20
R2(config-if)# ip address 172.16.20.2 255.255.255.0
R2(config-if)# standby 1 ip 172.16.20.1 #设置网关
R2(config-if)# standby 1 preempt # 设置为抢占模式
R2(config-if)# standby 1 priority 254 # vlan20的standby优先级设为254
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

配置完成后,交换机的上行数据可实现负载均衡,下行数据依靠上级路由表进行转发。

# 设置优先级
R2(config)# interface vlan 10
R2(config-if)# ip ospf cost 65535  # 开销值设置为 65535
R1(config)# interface vlan 20
R1(config-if)# ip ospf cost 65535  # 开销值设置为 65535
  • 1
  • 2
  • 3
  • 4
  • 5

开销值越低,表示该链路的传输速度越快,路由器会优先选择这些链路进行数据传输。
当IP OSPF Cost的值被设置得很大时,该链路在OSPF计算最佳路径时基本上会被排除在外。

MSTP

MSTP priority的值越小,则越优先
实现了多设备的集成化

R1(config)# spanning-tree mst 1 priority 4096  #实例在R1的优先级为4096
R1(config)# spanning-tree mst 2 priority 8192  #实例在R2的优先级为8192
R2(config)# spanning-tree mst 1 priority 4096  #实例在R1的优先级为8192
R2(config)# spanning-tree mst 2 priority 8192  #实例在R2的优先级为4096
  • 1
  • 2
  • 3
  • 4

汇聚与接入交换机(配置MSTP)

S1(config)# spanning-tree #开启
S1(config)# spanning-tree mode mstp
S1(config)# spanning-tree mst configuration
S1(config-mst)# instance 1 vlan 10,30

S1(config-mst)# revision 1  # 配置多生成树的版本号
S1(config-mst)# instance 2 vlan 20,40  # 将 vlan20、vlan40 放入实例2中
S1(config-mst)# revision 1
S1(config-mst)# exit
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

依次对 S2、S3。。。进行配置

检查 VRRP 状态

show vrrp

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/代码探险家/article/detail/941557
推荐阅读
相关标签
  

闽ICP备14008679号