天天看點

VRRP多備份配置舉例

VRRP多備份組配置舉例

一、組網需求

如圖所示,某公司為了實作網關裝置的備援備份,以及内網主機流量的負載分擔,在内部網絡的出口處部署了兩台裝置,并使用VRRP負載分擔功能,将這兩台裝置組成兩台虛拟路由器,分别作為區域A和區域B的預設網關。具體應用需求如下:

· Device A是VRRP備份組1中的Master裝置,Device B是VRRP備份組2中的Master裝置。在正常情況下,區域A的使用者通過Device A進行資料轉發,區域B的使用者通過Device B進行資料轉發。

· 當Device A或者Device A的上行接口發生故障後,Device B能夠迅速承擔區域A内主機流量的轉發任務;Device A故障恢複後,繼續承擔VRRP備份組1的網關功能;

· 當Device B或者Device B的上行接口故障發生故障後,Device A能夠迅速承擔區域B内主機流量的轉發任務;Device B故障恢複後,繼續承擔VRRP備份組2的網關功能。

圖VRRP多備份組配置組網圖

VRRP多備份配置舉例

二、配置步驟

(1) Device A的配置

#配置接口IP位址。

<DeviceA> system-view

[DeviceA] interface gigabitethernet 1/1

[DeviceA-GigabitEthernet1/1] ip address 10.0.0.2 24

[DeviceA-GigabitEthernet1/1] quit

#請參考以上方法配置圖2中其它接口的IP位址,配置步驟這裡省略。

#建立VRRP備份組1,并配置VRRP備份組1的虛拟IP位址為10.0.0.1,并配置Device A在VRRP備份組1中的優先級為120,高于Device B的優先級。

[DeviceA-GigabitEthernet1/1] vrrp vrid 1 virtual-ip 10.0.0.1

[DeviceA-GigabitEthernet1/1] vrrp vrid 1 priority 120

[DeviceA-GigabitEthernet1/1] quit

#建立VRRP備份組2,并配置VRRP備份組2的虛拟IP位址為11.0.0.1。

[DeviceA] interface gigabitethernet 1/3

[DeviceA-GigabitEthernet1/3] vrrp vrid 2 virtual-ip 11.0.0.1

[DeviceA-GigabitEthernet1/3] quit

#設定Device A工作在搶占方式,配置搶占延遲時間為5秒。

[DeviceA-GigabitEthernet1/1] vrrp vrid 1 preempt-mode delay 5

#建立和上行接口GigabitEthernet1/2實體狀态關聯的Track項1。

[DeviceA] track 1 interface gigabitethernet 1/2

#配置監視Track項1,Track項的狀态為Negative時,Device A在VRRP備份組1中的優先級降低的數值為50。

[DeviceA-GigabitEthernet1/1] vrrp vrid 1 track 1 reduced 50

(2)Device B的配置

<DeviceB> system-view

[DeviceB] interface gigabitethernet 1/1

[DeviceB-GigabitEthernet1/1] ip address 10.0.0.3 24

[DeviceB-GigabitEthernet1/1] quit

#請參考以上方法配置圖2中其它接口的IP位址,配置步驟省略。

#建立VRRP備份組1,并配置VRRP備份組1的虛拟IP位址為10.0.0.1。

[DeviceB-GigabitEthernet1/1] vrrp vrid 1 virtual-ip 10.0.0.1

#建立VRRP備份組2,并配置VRRP備份組2的虛拟IP位址為11.0.0.1,并配置Device B在VRRP備份組2中的優先級為120,高于Device A的優先級。

[DeviceB] interface gigabitethernet 1/3

[DeviceB-GigabitEthernet1/3] vrrp vrid 2 virtual-ip 11.0.0.1

[DeviceB-GigabitEthernet1/3] vrrp vrid 2 priority 120

#設定Device B工作在搶占方式,配置搶占延遲時間為5秒。

[DeviceB-GigabitEthernet1/3] vrrp vrid 2 preempt-mode delay 5

[DeviceB-GigabitEthernet1/3] quit

#建立和上行接口GigabitEthernet 1/2實體狀态關聯的Track項2。

[DeviceB] track 2 interface gigabitethernet 1/2

#配置監視Track項2,Track項的狀态為Negative時,Device B在VRRP備份組2中的優先級降低的數值為50。

[DeviceB-GigabitEthernet1/3] vrrp vrid 2 track 2 reduced 50

三、驗證配置

(1) 配置完成後,區域A和區域B中的主機都可以ping通外網。

#檢查區域A的主機到目的端100.0.0.1是否可達。

<host A> ping 100.0.0.1

PING 100.0.0.1 (100.0.0.1): 56 data bytes

56 bytes from 100.0.0.1: seq=0 ttl=128 time=22.43 ms

56 bytes from 100.0.0.1: seq=1 ttl=128 time=7.17 ms

56 bytes from 100.0.0.1: seq=2 ttl=128 time=8.91 ms

56 bytes from 100.0.0.1: seq=3 ttl=128 time=7.45 ms

56 bytes from 100.0.0.1: seq=4 ttl=128 time=9.11 ms

--- 100.0.0.1 ping statistics ---

5 packets transmitted, 5 packets received, 0% packet loss

round-trip min/avg/max = 7.17/11.01/22.43 ms

#檢查區域B的主機到目的端100.1.0.1是否可達。

<host C> ping 100.1.0.1

PING 100.1.0.1 (100.1.0.1): 56 data bytes

56 bytes from 100.1.0.1: seq=0 ttl=128 time=22.43 ms

56 bytes from 100.1.0.1: seq=1 ttl=128 time=7.17 ms

56 bytes from 100.1.0.1: seq=2 ttl=128 time=8.91 ms

56 bytes from 100.1.0.1: seq=3 ttl=128 time=7.45 ms

56 bytes from 100.1.0.1: seq=4 ttl=128 time=9.11 ms

--- 100.1.0.1 ping statistics ---

(2) 通過display vrrp verbose指令檢視配置後的結果。

#檢視Device A上全部IPv4 VRRP備份組的詳細資訊,顯示Device A在VRRP備份組1中為Master裝置,在VRRP備份組2中為Backup裝置。

[DeviceA] display vrrp verbose

IPv4 Virtual Router Information:

Running Mode : Standard

Total number of virtual routers : 2

Interface GigabitEthernet1/1

VRID           : 1                    Adver Timer  : 100

 Admin Status   : Up                   State        : Master

 Config Pri     : 120                  Running Pri  : 120

 Preempt Mode   : Yes                  Delay Time   : 5

 Auth Type      : None

 Virtual IP     : 10.0.0.1

 Virtual MAC    : 0000-5e00-0101

 Master IP      : 10.0.0.2           

VRRP Track Information:

Track Object   : 1                   State : Positive   Pri Reduced : 50              

Interface GigabitEthernet1/3

VRID           : 2                    Adver Timer  : 100

 Admin Status   : Up                   State        : Backup

 Config Pri     : 100                  Running Pri  : 100

 Preempt Mode   : Yes                  Delay Time   : 0

 Auth Type      : None

 Become Master  : 3550ms left

 Virtual IP     : 11.0.0.1

 Master IP      : 11.0.0.3           

#檢視Device B上全部IPv4 VRRP備份組的詳細資訊,顯示Device B在備份組1中為Backup裝置,在備份組2中為Master裝置。

[DeviceB] display vrrp verbose

VRID           : 1                    Adver Timer  : 100

 Admin Status   : Up                   State        : Backup

 Config Pri     : 100                  Running Pri  : 100

 Preempt Mode   : Yes                  Delay Time   : 0

 Auth Type      : None

 Become Master  : 3500ms left

 Virtual IP     : 10.0.0.1

 Master IP      : 10.0.0.2           
VRID           : 2                    Adver Timer  : 100

 Admin Status   : Up                   State        : Master

 Config Pri     : 120                  Running Pri  : 120

 Preempt Mode   : Yes                  Delay Time   : 5

 Auth Type      : None

 Virtual IP     : 11.0.0.1

 Virtual MAC    : 0000-5e00-0102

 Master IP      : 11.0.0.3           
Track Object   : 2                   State : Positive   Pri Reduced : 50              

#Device A出現故障後,通過display vrrp verbose指令檢視Device B上備份組的詳細資訊。可以看到Device B搶占為備份組1的Master。

Running Mode : Standard

VRID           : 1                    Adver Timer  : 100

 Admin Status   : Up                   State        : Master

 Config Pri     : 100                  Running Pri  : 100

 Preempt Mode   : Yes                  Delay Time   : 0

 Auth Type      : None

 Virtual IP     : 10.0.0.1

 Virtual MAC    : 0000-5e00-0101

 Master IP      : 10.0.0.3           
VRID           : 2                    Adver Timer  : 100

 Admin Status   : Up                   State        : Master

 Config Pri     : 120                  Running Pri  : 120

 Preempt Mode   : Yes                  Delay Time   : 5

 Auth Type      : None

 Virtual IP     : 11.0.0.1

 Virtual MAC    : 0000-5e00-0102

 Master IP      : 11.0.0.3           
Track Object   : 2                   State : Positive   Pri Reduced : 50              

以上顯示資訊表示Device A出現故障後,區域A和區域B中的主機仍然可以ping通外網。

#當Device A故障恢複後,顯示Device A上備份組的詳細資訊。

Running Mode : Standard

VRID           : 1                    Adver Timer  : 100

 Admin Status   : Up                   State        : Master

 Config Pri     : 120                  Running Pri  : 120

 Preempt Mode   : Yes                  Delay Time   : 5

 Auth Type      : None

 Virtual IP     : 10.0.0.1

 Virtual MAC    : 0000-5e00-0101

 Master IP      : 10.0.0.2           
Track Object   : 1                   State : Positive   Pri Reduced : 50              
VRID           : 2                    Adver Timer  : 100

 Admin Status   : Up                   State        : Backup

 Config Pri     : 100                  Running Pri  : 100

 Preempt Mode   : Yes                  Delay Time   : 0

 Become Master  : 3550ms left

 Auth Type      : None

 Virtual IP     : 11.0.0.1

 Master IP      : 11.0.0.3