華為VRRP配置(虛擬網關備份協議)


這里只單純配置了VRRP

創建兩個vlan 10 20,做負載分擔

 

 

兩台是設備Eth-trunk1口放行vlan10 20

SW1配置

[sw1]vlan batch 10 20    #創建vlan10 20

[sw1-Vlanif10]dis this
#
interface Vlanif10
 ip address 192.168.10.1 255.255.255.0 #配置物理網關地址
 vrrp vrid 1 virtual-ip 192.168.10.254 #配置vrrp組1 配置虛擬網關地址
 vrrp vrid 1 priority 120 #配置優先級為120,默認100數字越大越優先,使它成為vlan10的Master
 vrrp vrid 1 track interface GigabitEthernet0/0/3 reduced 30 #檢測上聯端口,如果斷開優先級降低30(之后會作為backup)
#
  
[sw1-Vlanif20]dis this
#
interface Vlanif20
 ip address 192.168.20.1 255.255.255.0 #配置vlan20的物理網關
 vrrp vrid 2 virtual-ip 192.168.20.254 #配置vlan20的虛擬網關
 vrrp vrid 2 preempt-mode timer delay 20 #延遲20秒后搶占        
#

 

SW2配置

[sw2]vlan batch 10 20
[sw2-Vlanif10]dis this
#
interface Vlanif10
 ip address 192.168.10.2 255.255.255.0  #配置vlan10網關
 vrrp vrid 1 virtual-ip 192.168.10.254  #配置vrrp組1 配置虛擬網關和SW1一樣
 vrrp vrid 1 preempt-mode timer delay 20  #延遲20s后搶占
#

[sw2-Vlanif20]dis this
#
interface Vlanif20
 ip address 192.168.20.2 255.255.255.0  #配置vlan20網關
 vrrp vrid 2 virtual-ip 192.168.20.254  #配置vrrp組2 配置虛擬網關和SW1一樣
 vrrp vrid 2 priority 120  #配置優先級為120,使vrrp2 成為vlan20的Master

vrrp vrid 2 track interface GigabitEthernet0/0/22 reduced 30 #配置上聯鏈路檢測,如果斷開優先級減去30 使它成為backup

#

 

 查看vrrp狀態

SW1

<sw1>dis vrrp
  Vlanif10 | Virtual Router 1
    State : Master    #vrid1組為vlan10的Master
    Virtual IP : 192.168.10.254
    Master IP : 192.168.10.1
    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
    Track IF : GigabitEthernet0/0/3   Priority reduced : 30
    IF state : UP
    Create time : 2021-09-07 08:22:09 UTC-08:00
    Last change time : 2021-09-07 10:22:52 UTC-08:00

  Vlanif20 | Virtual Router 2
    State : Backup    #vrid2組為vlan20的backup
    Virtual IP : 192.168.20.254
    Master IP : 192.168.20.2
    PriorityRun : 100
    PriorityConfig : 100
    MasterPriority : 120
    Preempt : YES   Delay Time : 20 s
    TimerRun : 1 s
    TimerConfig : 1 s
    Auth type : NONE
    Virtual MAC : 0000-5e00-0102
    Check TTL : YES
    Config type : normal-vrrp
    Create time : 2021-09-07 08:31:38 UTC-08:00
    Last change time : 2021-09-07 10:54:05 UTC-08:00

 

SW2

[sw2]dis vrrp
  Vlanif10 | Virtual Router 1
    State : Backup    #vrid1為vlan10的backup
    Virtual IP : 192.168.10.254
    Master IP : 192.168.10.1
    PriorityRun : 100
    PriorityConfig : 100
    MasterPriority : 120
    Preempt : YES   Delay Time : 20 s
    TimerRun : 1 s
    TimerConfig : 1 s
    Auth type : NONE
    Virtual MAC : 0000-5e00-0101
    Check TTL : YES
    Config type : normal-vrrp
    Create time : 2021-09-07 08:22:37 UTC-08:00
    Last change time : 2021-09-07 10:22:52 UTC-08:00

  Vlanif20 | Virtual Router 2
    State : Master    #vrid2為vlan20的Master
    Virtual IP : 192.168.20.254
    Master IP : 192.168.20.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-0102
    Check TTL : YES
    Config type : normal-vrrp
    Track IF : GigabitEthernet0/0/22   Priority reduced : 30
    IF state : UP
    Create time : 2021-09-07 08:32:01 UTC-08:00
    Last change time : 2021-09-07 10:54:05 UTC-08:00

 

這樣可實現負載分擔,vlan10的流量走SW1,vlan20的流量走SW2

 
 


免責聲明!

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



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