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,建議與總結
對於出現雙主的情況,我們需要從物理層和數據鏈路層進行排查分析,從而解決該問題。
閱讀更多 王海軍老師 的文章