H3C之VRRP實驗部署


環境:H3C模擬器

1.實驗拓撲:

  

  SWA與SWB通過各自的以太網端口GigabitEthernet 1/0/1~GigabitEthernet 1/0/2相互連接SWC、SWD。HostA、HostB、HostC通過以太網線分別連接SWC、SWD各自的以太網端口。本組網模擬了實際組網中涉及的VRRP主要應用。

【配置步驟】

1.1配置VRRP單備份組

通過配置VRRP單備份組,實現HostA能夠訪問HostC。HostA的缺省網關為192.168.0.254/24。

SWA和SWB屬於虛擬IP地址為192.168.0.254/24的備份組1。當SWA正常工作時,局域網流量通過SWA轉發,當SWA出現故障時,局域網流量通過SWB轉發。

搭建實驗環境

按照上圖,搭建實驗環境,完成交換機SWA、SWB、SWC、SWD的鏈路連接。配置主機HostA的IP地址為192.168.0.1/24,網關為192.168.0.254;配置主機HostC的IP地址為10.0.0.1/24,網關為10.0.0.254/24。

基本配置

在SWA上創建VRRP單備份組1,並配置備份組1的虛擬IP地址為192.168.0.254/24。
 [SWA]interface Vlan-interface 10

 [SWA-Vlan-interface10]vrrp vrid 1 virtual-ip 192.168.0.254

 在SWA上,設置在備份組1中的優先級為120.設置SWA工作在搶占模式。

 [SWA-Vlan-interface10]vrrp vrid 1 priority 120

 [SWA-Vlan-interface10]vrrp vrid 1 preempt-mode

 在SWB上創建VRRP單備份組1,並配置備份組1的虛擬IP地址為192.168.0.254/24。

 [SWB]interface Vlan-interface 10

 [SWB-Vlan-interface10]vrrp vrid 1 virtual-ip 192.168.0.254

 在SWB上,設置在備份組1中的優先級為100.設置SWB工作在搶占模式。

 [SWB-Vlan-interface10]vrrp vrid 1 priority 100

 [SWB-Vlan-interface10]vrrp vrid 1 preempt-mode

 由配置可見,在SWA、SWB上分別創建VRRP單備份組1,形成了VRRP端口。

 測試連通性

 在HostA上ping HostC,顯示如下:

關閉STP配置:
[SWA]interface GigabitEthernet 1/0/1

[SWA-GigabitEthernet1/0/1]undo stp enable

[SWB]interface GigabitEthernet 1/0/1

[SWB-GigabitEthernet1/0/1]undo stp enable

[SWD]interface GigabitEthernet 1/0/1

[SWD-GigabitEthernet1/0/1]undo stp enable

[SWD]interface GigabitEthernet 1/0/2

[SWD-GigabitEthernet1/0/2]undo stp enable
完成trunk基本配置:
[SWA]interface g1/0/2

[SWA-GigabitEthernet1/0/2]port link-type trunk

[SWA-GigabitEthernet1/0/2]port trunk permit vlan  10

[SWB]interface GigabitEthernet 1/0/2

[SWB-GigabitEthernet1/0/2]port link-type trunk

[SWB-GigabitEthernet1/0/2]port trunk permit vlan 10

[SWC]interface GigabitEthernet 1/0/1

[SWC-GigabitEthernet1/0/1]port link-type trunk

[SWC-GigabitEthernet1/0/1]port trunk permit vlan 10

[SWC-GigabitEthernet1/0/1]quit

[SWC]interface GigabitEthernet 1/0/2

[SWC-GigabitEthernet1/0/2]port link-type trunk

[SWC-GigabitEthernet1/0/2]port trunk permit vlan 10
完成路由基本配置:
[SWA]rip 1

[SWA-rip-1]version 2

[SWA-rip-1]undo summary

[SWA-rip-1]network 192.168.0.0

[SWA-rip-1]network 192.168.255.0

[SWA-rip-1]silent-interface Vlan-interface 10

 

[SWB]rip 1

[SWB-rip-1]version 2

[SWB-rip-1]undo summary

[SWB-rip-1]network 192.168.0.0

[SWB-rip-1]network 192.168.255.0

[SWB-rip-1]silent-interface Vlan-interface 10

 

[SWD]rip 1

[SWD-rip-1]ver

[SWD-rip-1]version 2

[SWD-rip-1]undo su

[SWD-rip-1]undo summary

[SWD-rip-1]network 10.0.0.0

[SWD-rip-1]network 192.168.255.0

[SWD-rip-1]quit

 檢查VRRP端口

完成上一步驟后,在SWA、SWB上檢查VRRP端口表項:

<SWA>display vrrp verbose

IPv4 Virtual Router Information:

 Running mode : Standard

 Total number of virtual routers : 1

   Interface Vlan-interface10

     VRID             : 1                   Adver Timer  : 100

     Admin Status     : Up                  State        : Master 

     Config Pri       : 120                 Running Pri  : 120

     Preempt Mode     : Yes                 Delay Time   : 0

     Auth Type        : None

     Virtual IP       : 192.168.0.254

     Virtual MAC      : 0000-5e00-0101 

     Master IP        : 192.168.0.252 

從顯示信息中可以看出,SWA為VRRP單備份組1 Master設備,備份組1的虛擬IP地址為192.168.0.254/24。

[SWB]display vrrp verbose

IPv4 Virtual Router Information:

 Running mode : Standard

 Total number of virtual routers : 1 

   Interface Vlan-interface10

     VRID             : 1                   Adver Timer  : 100 

     Admin Status     : Up                  State        : Backup

     Config Pri       : 100                 Running Pri  : 100

     Preempt Mode     : Yes                 Delay Time   : 0

     Become Master    : 3370ms left 

     Auth Type        : None

     Virtual IP       : 192.168.0.254 

     Master IP        : 192.168.0.252

 

從顯示信息中可以看出,SWB為VRRP單備份組1 Backup設備,備份組1的虛擬IP地址為192.168.0.254/24。

1.2配置VRRP雙備份組

在SWA上創建VRRP單備份組1,並配置備份組1的虛擬IP地址為192.168.0.254/24。在SWA上創建VRRP單備份組2,並配置備份組2的虛擬IP地址為192.168.1.254/24。

[SWA]interface Vlan-interface 10

[SWA-Vlan-interface10]vrrp vrid 1 virtual-ip 192.168.0.254

[SWA]interface Vlan-interface 20

[SWA-Vlan-interface20]vrrp vrid 2 virtual-ip 192.168.1.254

在SWA上,設置在備份組1中的優先級為120,設置在備份組2中的優先級為100。設置SWA工作在搶占模式。

[SWA-Vlan-interface10]vrrp vrid 1 priority 120

[SWA-Vlan-interface10]vrrp vrid 1 preempt-mode

[SWA-Vlan-interface20]vrrp vrid 2 priority 100

[SWA-Vlan-interface20]vrrp vrid 2  preempt-mode

在SWB上創建VRRP單備份組1,並配置備份組1的虛擬IP地址為192.168.0.254/24。在SWB上創建VRRP單備份組2,並配置備份組2的虛擬IP地址為192.168.1.254/24。

[SWB]interface Vlan-interface 10

[SWB-Vlan-interface10]vrrp vrid 1 virtual-ip 192.168.0.254

[SWB]interface Vlan-interface 20

[SWB-Vlan-interface20]vrrp vrid 2 virtual-ip 192.168.0.254

在SWB上,設置在備份組1中的優先級為100,設置SWB工作在搶占模式。在SWB上,設置在備份組2中的優先級為120,設置SWB工作在搶占模式。

[SWA-Vlan-interface10]vrrp vrid 1 priority 100

[SWA-Vlan-interface10]vrrp vrid 1 preempt-mode

[SWA-Vlan-interface20]vrrp vrid 2 priority 120

[SWA-Vlan-interface20]vrrp vrid 2 preempt-mode

由配置可見,在SWA、SWB上分別創建VRRP單備份組1,VRRP單備份組2,形成了VRRP端口。

測試連通性

在HostA上ping HostC,顯示如下:

C:\>ping 10.0.0.1

Ping 10.0.0.1 (10.0.0.1): 56 data bytes, press CTRL_C to break

56 bytes from 10.0.0.1: icmp_seq=0 ttl=253 time=11.000 ms

56 bytes from 10.0.0.1: icmp_seq=1 ttl=253 time=20.000 ms

56 bytes from 10.0.0.1: icmp_seq=2 ttl=253 time=4.000 ms

56 bytes from 10.0.0.1: icmp_seq=3 ttl=253 time=7.000 ms

56 bytes from 10.0.0.1: icmp_seq=4 ttl=253 time=4.000 ms

--- Ping statistics for 10.0.0.1 ---

5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss

結果顯示,從HostA可以ping通HostC,並且從HostA發送給HostC的報文通過SWA轉發。

檢查VRRP端口

完成上一步驟后,在SWA、SWB上檢查VRRP端口表項:

<SWA>display vrrp verbose

IPv4 Virtual Router Information:

 Running mode : Standard

 Total number of virtual routers : 2

   Interface Vlan-interface10

     VRID             : 1                   Adver Timer  : 100

     Admin Status     : Up                  State        : Master

     Config Pri       : 120                 Running Pri  : 120

     Preempt Mode     : Yes                 Delay Time   : 0

     Auth Type        : None

     Virtual IP       : 192.168.0.254

     Virtual MAC      : 0000-5e00-0101

     Master IP        : 192.168.0.252

 

   Interface Vlan-interface20

     VRID             : 2                   Adver Timer  : 100

     Admin Status     : Up                  State        : Backup

     Config Pri       : 100                 Running Pri  : 100

     Preempt Mode     : Yes                 Delay Time   : 0

     Become Master    : 3120ms left

     Auth Type        : None

     Virtual IP       : 192.168.1.254

     Master IP        : 192.168.1.253

從顯示信息中可以看出,SWA為VRRP單備份組1 Master設備,備份組1的虛擬IP地址為192.168.0.254/24。SWA為VRRP單備份組2 Backup設備,備份組2的虛擬IP地址為192.168.1.254/24。

<SWB>display vrrp verbose

IPv4 Virtual Router Information:

 Running mode : Standard

 Total number of virtual routers : 2

   Interface Vlan-interface10

     VRID             : 1                   Adver Timer  : 100

     Admin Status     : Up                  State        : Backup

     Config Pri       : 100                 Running Pri  : 100

     Preempt Mode     : Yes                 Delay Time   : 0

     Become Master    : 2940ms left

     Auth Type        : None

     Virtual IP       : 192.168.0.254

     Master IP        : 192.168.0.252

 

   Interface Vlan-interface20

     VRID             : 2                   Adver Timer  : 100

     Admin Status     : Up                  State        : Master

     Config Pri       : 120                 Running Pri  : 120

     Preempt Mode     : Yes                 Delay Time   : 0

     Auth Type        : None

     Virtual IP       : 192.168.1.254

     Virtual MAC      : 0000-5e00-0102

     Master IP        : 192.168.1.253

 

從顯示信息中可以看出,SWB為VRRP單備份組1 Backup設備,備份組1的虛擬IP地址為192.168.0.254/24。從SWB為VRRP單備份組2 Master設備,備份組2的虛擬IP地址為192.168.1.254/24。

檢查VRRP特性

在SWB上,關閉與SWC相連端口GigabitEthernet1/0/2。

[SWB]interface GigabitEthernet 1/0/2

[SWB-GigabitEthernet1/0/2]shu

[SWB-GigabitEthernet1/0/2]shutdown

 

同時在HostB上ping HostC,顯示如下:

C:\>ping -n 10.0.0.1

Ping 10.0.0.1 (10.0.0.1): 56 data bytes, press CTRL_C to break

Request timeout

56 bytes from 10.0.0.1: icmp_seq=1 ttl=253 time=23.000 ms

56 bytes from 10.0.0.1: icmp_seq=2 ttl=253 time=11.000 ms

56 bytes from 10.0.0.1: icmp_seq=3 ttl=253 time=8.000 ms

56 bytes from 10.0.0.1: icmp_seq=4 ttl=253 time=4.000 ms

--- Ping statistics for 10.0.0.1 ---

5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss

結果顯示,從HostB可以ping通HostC,只丟棄了1個報文。證明當SWB設備出現故障時,VRRP狀態發生了遷移。HostB發送給HostC的報文通過SWA轉發。在SWB上檢查VRRP端口表項:

<SWA>display vrrp verbose

IPv4 Virtual Router Information:

 Running mode : Standard

 Total number of virtual routers : 2

   Interface Vlan-interface10

     VRID             : 1                   Adver Timer  : 100

     Admin Status     : Up                  State        : Master

     Config Pri       : 120                 Running Pri  : 120

     Preempt Mode     : Yes                 Delay Time   : 0

     Auth Type        : None

     Virtual IP       : 192.168.0.254

     Virtual MAC      : 0000-5e00-0101

     Master IP        : 192.168.0.252

 

   Interface Vlan-interface20

     VRID             : 2                   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       : 192.168.1.254

     Virtual MAC      : 0000-5e00-0102

     Master IP        : 192.168.1.252

從顯示信息中可以看出,SWA為VRRP單備份組1 Master設備,備份組1的虛擬IP地址為192.168.0.254/24。SWA為VRRP單備份組2 Master設備,備份組2的虛擬IP地址為192.168.1.254/24。

 

此文章若有錯誤請大大佬指正 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM