如果路由器出现故障设置 VRRP 的最佳方法

网络工程 思科 cisco催化剂 cisco 命令 虚拟现实 FRP
2021-08-02 15:19:06

我正在做我的 VRRP 网络实验室。我的理解是,如果 Master 失败,则 Backup 将接管。在这种情况下,我有两个第 3 层 SW 通过 LACP 连接在一起,这两个第 3 层交换机通过 LACP 连接一个接入交换机和一个具有静态 IP 的防火墙。现在,两个第 3 层 sw 正在通过 SVI(Vlan 400)进行 VRRP。现在,如果我关闭连接到 FW 的 Master 上的一个接口,那么假设备份 VRRP 将接管,但连接到 Access 的 PC 无法 ping FW IP (192.168.122.192)。任何建议我如何解决它?

在此处输入图片说明

这是配置文件 Core SW1

interface Loopback0
 ip address 10.10.10.10 255.255.255.255
!
interface Port-channel10
 switchport trunk allowed vlan 172,201,300,400
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface Port-channel20
 switchport trunk allowed vlan 172,201,300,400
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface Port-channel30
 switchport trunk allowed vlan 172,201,300,400
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface GigabitEthernet1/2
 no switchport
 description ---connected to DHCP---
 ip address 10.100.100.1 255.255.255.0
 ip helper-address 10.100.100.2
 negotiation auto
!
interface GigiabitEthernet 2/2
no switchport
description --connected to FW---
ip address 10.10.10.1 255.255.255.252
negotiation auto

interface Vlan400
 ip address 10.10.0.10 255.255.254.0
 ip helper-address 10.100.100.2
 vrrp 10 description -Load balance-
 vrrp 10 ip 10.10.0.1
 vrrp 10 ip 10.10.0.2 secondary
 vrrp 10 priority 254
 vrrp 10 authentication text cisco
!
router ospf 1
 network 10.10.0.0 0.0.3.255 area 1
 network 10.10.10.0 0.0.0.3 area 0
 network 10.10.10.10 0.0.0.0 area 0
 network 10.30.0.0 0.0.3.255 area 1
 network 10.100.100.0 0.0.0.255 area 1

核心SW2

interface Loopback0
 ip address 20.20.20.20 255.255.255.255
!
interface Port-channel20
 switchport access vlan 300
 switchport trunk allowed vlan 172,201,300,400
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface Port-channel40
 switchport trunk allowed vlan 172,201,300,400
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface Port-channel45
 switchport trunk allowed vlan 172,201,300,400
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface GigabitEthernet2/0
 no switchport
 description ---Connected to FireWall---
 ip address 20.20.20.1 255.255.255.252
 ip ospf priority 0
 negotiation auto
!
interface Vlan400
 ip address 10.10.0.11 255.255.252.0
 ip helper-address 10.100.100.2
 vrrp 10 description -Load balance-
 vrrp 10 ip 10.10.0.1
 vrrp 10 ip 10.10.0.2 secondary
 vrrp 10 authentication text cisco
!
router ospf 1
 network 10.10.0.0 0.0.3.255 area 1
 network 10.30.0.0 0.0.3.255 area 1
 network 20.20.20.0 0.0.0.3 area 0
 network 20.20.20.20 0.0.0.0 area 0

防火墙

interface Loopback0
 ip address 40.40.40.40 255.255.255.255

!
interface GigabitEthernet2/0
 ip address 10.10.10.2 255.255.255.252
 description ---CoreSW1---
 ip nat inside
 ip virtual-reassembly
 ip ospf priority 255
 negotiation auto
!
interface GigabitEthernet3/0
 ip address 20.20.20.2 255.255.255.252
 description --CoreSW2---
 ip nat inside
 ip virtual-reassembly
 ip ospf priority 255
!
router ospf 1
 log-adjacency-changes
 network 10.10.10.0 0.0.0.3 area 0
 network 20.20.20.0 0.0.0.3 area 0
 network 40.40.40.40 0.0.0.0 area 0
 network 192.168.122.0 0.0.0.255 area 2 (ISP)
1个回答

我注意到的一件事是,您没有跟踪到防火墙的链接,并且您无法将 VRRP 配置为在链接出现故障时故障转移到另一台交换机。如果整个交换机发生故障,您将进行故障转移。

您可能希望将主 VRRP 交换机的优先级设置为105,将备份设置为100,然后10在与防火墙的链接出现故障时递减配置抢占,以便备份将抢占主,并且当链接恢复时主将恢复。您还应该延迟,以便弹跳链接不会导致主要链接来回跳跃。

就像是:

核心 SW1:

track 100 interface GigiabitEthernet2/2 line-protocol
!
interface Vlan400
 ip address 10.10.0.10 255.255.254.0  !*** doesn't match the other switch ***
 ip helper-address 10.100.100.2
 vrrp 10 ip 10.10.0.1
 vrrp 10 priority 105
 vrrp 10 preempt delay 30
 vrrp 10 track 100 decrement 10
 vrrp 10 authentication text cisco
!

核心 SW2:

interface Vlan400
 ip address 10.10.0.11 255.255.252.0  !*** doesn't match the other switch ***
 ip helper-address 10.100.100.2
 vrrp 10 ip 10.10.0.1
 vrrp 10 priority 100
 vrrp 10 preempt delay 30
 vrrp 10 authentication text cisco
!

此外,对于交换机,尝试按照您的配置方式进行负载平衡是一个非常糟糕的主意。您希望 STP 根网桥与 FHRP 主网桥匹配,否则您将获得次优流量。如果需要,您可以使用一台交换机作为奇数 VLAN 的 STP 根 FHRP 主交换机,另一台交换机作为偶数 VLAN 或其他类似方案的相同交换机,但来自 VLAN 的所有流量都将转到STP 根,它应该是该 VLAN 的 FHRP 主节点。