1,问题描述
在园区网络中,接入交换机通过双链路上连至两台核心交换机,业务网关起VRRP址址并部署在核心交换机上,由于物理或者配置方面的原因会导致VRRP状态出现双主。
拓扑如下:
SW1和SW2作为主备核心交换机,接入交换机SW3通过两条链路上连至SW1和SW2,vlan 10作为业务VLAN的网关。
下面就分别从不同的层次来分析造成VRRP双主的原因以及解决办法。
2,处理过程
可以通过在ENSP中模拟现网的情况,分别从物理层和数据链路层进行故障分析和排障。
一、物理层的原因
由于物理连线错误 ,导致主备两台之间无法交互VRRP心跳线报文,因此造成双主。
如上图所示,本来应该是SW3的g0/0/1口连接SW1的g0/0/1,但由于连线错误,变成了SW3的g0/0/1连接SW1的g0/0/3。
由于SW1上的g0/0/3什么都没有配置,因此SW1与SW2之间无法交互VRRP心跳报文,因此出现双主。
SW1的上配置及VRRP状态:
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10
#
interface GigabitEthernet0/0/3
#
Vlanif10 | Virtual Router 1
State : Master
Virtual IP : 10.0.0.1
Master IP : 10.0.0.2
PriorityRun : 120
PriorityConfig : 120
MasterPriority : 120
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Create time : 2015-11-11 16:53:23 UTC-08:00
Last change time : 2015-11-11 17:41:42 UTC-08:00
SW2上的配置及VRRP的状态:
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
Vlanif10 | Virtual Router 1
State : Master
Virtual IP : 10.0.0.1
Master IP : 10.0.0.3
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 100
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Create time : 2015-11-11 16:54:15 UTC-08:00
Last change time : 2015-11-11 17:38:41 UTC-08:00
解决办法,仔细排查物理链路,看是否和规划的一致。通过重新连接线缆,即可让VRRP状态恢复正常。
将SW3的g0/0/1口连接至SW1的g0/0/1口,即可使VRRP状态恢复。
Vlanif10 | Virtual Router 1
State : Master
Virtual IP : 10.0.0.1
Master IP : 10.0.0.2
PriorityRun : 120
PriorityConfig : 120
MasterPriority : 120
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Create time : 2015-11-11 16:53:23 UTC-08:00
Last change time : 2015-11-11 17:41:42 UTC-08:00
Vlanif10 | Virtual Router 1
State : Backup
Virtual IP : 10.0.0.1
Master IP : 10.0.0.2
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 120
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Create time : 2015-11-11 16:54:15 UTC-08:00
Last change time : 2015-11-11 17:53:18 UTC-08:00
二、数据链路层
由于SW3上连至SW1的链路没有透相应的vlan,导致主备两台交换机VRRP心跳报文交互失败,因此也会产生双主。
SW3上g0/0/1口的配置:
[SW3]dis cu interface g0/0/1
#
interface GigabitEthernet0/0/1
port link-type trunk
#
这时可以在SW1和SW2上看一下VRRP的状态
SW1的:
VRID State Interface Type Virtual IP
----------------------------------------------------------------
1 Master Vlanif10 Normal 10.0.0.1
----------------------------------------------------------------
Total:1 Master:1 Backup:0 Non-active:0
VRID State Interface Type Virtual IP
----------------------------------------------------------------
1 Master Vlanif10 Normal 10.0.0.1
----------------------------------------------------------------
Total:1 Master:1 Backup:0 Non-active:0
解决办法,在SW3的g0/0/1口上透传VLAN 10,即可解决该问题
SW3上的配置
[SW3]dis cu int g0/0/1
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
SW1的VRRP状态:
Vlanif10 | Virtual Router 1
State : Master
Virtual IP : 10.0.0.1
Master IP : 10.0.0.2
PriorityRun : 120
PriorityConfig : 120
MasterPriority : 120
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Create time : 2015-11-11 16:53:23 UTC-08:00
Last change time : 2015-11-11 17:41:42 UTC-08:00
SW2的VRRP状态:
Vlanif10 | Virtual Router 1
State : Backup
Virtual IP : 10.0.0.1
Master IP : 10.0.0.2
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 120
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Create time : 2015-11-11 16:54:15 UTC-08:00
Last change time : 2015-11-11 18:04:15 UTC-08:00
即VRRP状态恢复正常了。
3,根因
对于出现VRRP双主的情况,归根到底就是两台设备之间VRRP心跳报文交互失败,从而备设备认为主设备已经down,将自己的vrrp状态切成master状态,所以会了现双主。
4,建议与总结
对于出现双主的情况,我们需要从物理层和数据链路层进行排查分析,从而解决该问题。
閱讀更多 王海軍老師 的文章