VRRP在cisco中的配置

 一、基礎知識:
      虛擬路由冗餘協議(VRRP)與熱備份路由協議(HSRP)都是一種默認網關冗餘方法,它們都是讓一組路由器構成一臺虛擬路由器。和HSRP不同的是,VRRP是開發的協議,而HSRP是思科專屬的。
      使用VRRP創建的虛擬路由器被稱爲VRRP組,它代表一組路由器。
      在VRRP組中是通過優先級來決定主虛擬路由器的。
      優先級範圍:1—255。如果優先級設置爲0,那麼主路由器和任何路由器將不再是VRRP組中的路由器。(通過將優先級設置爲0來讓主路由器自動辭職。)
二、VRRP的配置與驗證:
      配置主要命令:
1.定義VRRP組
Vrrp group-number ip virtual-ip-address
2.配置指定VRRP路由器的優先級:
Vrrp group-number priority priority-value
3.允許主虛擬路由器失效的情況下切換到備用虛擬路由器:
Vrrp group-number preempt
      驗證命令:
1.查看VRRP詳細配置信息:
Show vrrp all
2.查看VRRP簡要配置信息:
Show vrrp brief
3.查看VRRP接口配置信息:
Show vrrp interface FastEthernet*/*
三、實驗:
      拓撲圖:
clip_p_w_picpath002
      實驗目的:
在這個實驗配置了兩個VRRP組——vrrp 1和vrrp 2。在vrrp 1中,路由器R1爲主虛擬路由器,R2爲備用虛擬路由器;在vrrp 2中,路由器R1爲備用虛擬路由器,路由器R1爲主虛擬路由器。在兩個路由器都正常工作的時候,PC1和PC2通過R1訪問遠端,PC3通過R2訪問遠端。
      具體配置:
      路由器R1的具體配置:
R1(config)#int f0/0
R1(config-if)#ip address 10.0.0.253 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#int s1/0
R1(config-if)#ip add 200.0.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#int f0/0
R1(config-if)#vrrp 1 ip 10.0.0.253
R1(config-if)#vrrp 1 priority 200
R1(config-if)#vrrp 1 preempt
R1(config-if)#vrrp 2 ip 10.0.0.254
R1(config-if)#vrrp 2 priority 100
R1(config-if)#vrrp 2 preempt
R1(config-if)#exit
R1(config)#router rip
R1(config)#ver 2
R1(config)#no auto-summary
R1(config)#network 10.0.0.0
R1(config)#network 200.0.1.0
      路由器R2的配置:
R2#sh run
Building configuration...
Current configuration : 1019 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
!
boot-start-marker
boot-end-marker
!
memory-size iomem 5
no aaa new-model
ip subnet-zero
!  
ip cef
!
no ftp-server write-enable
!
interface FastEthernet0/0
ip address 10.0.0.254 255.255.255.0
duplex auto
speed auto
vrrp 1 ip 10.0.0.253
vrrp 1 priority 150
vrrp 2 ip 10.0.0.254
vrrp 2 priority 200
!
interface Serial1/0
ip address 200.0.2.1 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/3
no ip address
shutdown
serial restart-delay 0
!
router rip
version 2
network 10.0.0.0
network 200.0.2.0
no auto-summary
!
ip http server
ip classless
!
control-plane
!
line con 0
transport preferred all
transport output all
line aux 0
transport preferred all
transport output all
line vty 0 4
!
End
     路由器R3的配置:
R3#sh run
Building configuration...
Current configuration : 965 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R3
!
boot-start-marker
boot-end-marker
!
memory-size iomem 5
no aaa new-model
ip subnet-zero
!
ip cef
!
no ftp-server write-enable
!
interface Serial0/0
ip address 200.0.1.2 255.255.255.0
serial restart-delay 0
!
interface Serial0/1
ip address 200.0.2.2 255.255.255.0
serial restart-delay 0
!
interface Serial0/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial0/3
no ip address
shutdown
serial restart-delay 0
!
interface FastEthernet1/0
ip address 200.0.0.254 255.255.255.0
duplex auto
speed auto
!
router rip
version 2
network 200.0.0.0
network 200.0.1.0
network 200.0.2.0
no auto-summary
!
ip http server
ip classless
!
control-plane
!
line con 0
transport preferred all
transport output all
line aux 0
transport preferred all
transport output all
line vty 0 4
!
End
      在交換機上要記得將連接路由器、主機的接口用NO SHUTDOWN開啓!
驗證配置:
在路由器R1上:
clip_p_w_picpath004
clip_p_w_picpath006
      在路由器R2上:
clip_p_w_picpath008
clip_p_w_picpath010
實驗做完了,當然,大家也可以通過關閉接口等方法來驗證VRRP是否有效果~
Have fun!
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章