Hsrp 和vrrp在企業網中的應用

 

案例一
隨着Internet的日益普及,人們對網絡的依賴性也越來越強。這同時對網絡的穩定性提出了更高的要求,人們自然想到了基於設備的備份結構,就像在服務器中爲提高數據的安全性而採用雙硬盤結構一樣。路由器是整個網絡的核心和心臟,如果路由器發生致命性的故障,將導致本地網絡的癱瘓,如果是骨幹路由器,影響的範圍將更大,所造成的損失也是難以估計的。因此,對路由器採用熱備份是提高網絡可靠性的必然選擇。在一個路由器完全不能工作的情況下,它的全部功能便被系統中的另一個備份路由器完全接管,直至出現問題的路由器恢復正常,這就是熱備份路由協議(HotStandbyRouterProtocol),HSRP-RFC2281技術要解決的問題
HSRP:熱備份路由器協議(HSRP:Hot Standby Router Protocol),是cisco平臺一種特有的技術,是cisco的私有協議。熱備份路由協議(HSRP)的設計目標是支持特定情況下 IP 流量失敗轉移不會引起混亂、並允許主機使用單路由器,以及即使在實際第一跳路由器使用失敗的情形下仍能維護路由器間的連通性。換句話說,當源主機不能動態知道第一跳路由器的 IP 地址時,HSRP 協議能夠保護第一跳路由器不出故障。
案例拓補圖
 

實驗所需設備
兩臺cisco路由器,兩臺交換機作爲核心層交換機,兩臺交換機作爲接入層的交換機,還有4臺pc作爲測試用的設備
實驗用到的命令
路由器的配置命令
Router>enable
Router#configure terminal
Router(config)#interface fastEthernet 0/0
Router(config-if)#no shutdown
Router(config)#interface fastEthernet 0/0.10
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#ip address 192.168.10.1 255.25.255.0
Router(config-subif)#standby ip 192.168.10.254(配置虛擬網關)
Router(config-subif)#standby 10 priority 120(設置優先級)
Router(config)#interface fastEthernet 0/0.20
Router(config-subif)#encapsulation dot1Q 20
Router(config-subif)#ip address 192.168.20.1 255.255.255.0
Router(config-subif)#standby ip 192.168.20.254
Router(config-subif)#standby 10 priority 120
R1的配置結果
R1(config)#do show run
Building configuration...
 
Current configuration : 779 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
!        
interface FastEthernet0/0.10
 encapsulation dot1Q 10
 ip address 192.168.10.1 255.255.255.0
 standby 10 ip 192.168.10.254
 standby 10 priority 120
!
interface FastEthernet0/0.20
 encapsulation dot1Q 20
 ip address 192.168.20.1 255.255.255.0
 standby 20 ip 192.168.20.254
!
ip http server
no ip http secure-server
!
 
!
line con 0
 exec-timeout 0 0
 logging synchronous
line aux 0
line vty 0 4
!
!
End
交換機的配置命令
Router>enable
Router#configure terminal
 
Router(config)#interface fastEthernet 0/0
Router(config-if)#switchport mode trunk
Router(config-if)#switchport trunk allowed vlan all
Router(config-if)#int fa 0/15
Router(config-if)#switchport mode trunk
Router(config-if)#switchport trunk allowed vlan all
交換機的配置結果
SW1(config)#do show run
Building configuration...
 
Current configuration : 1026 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname SW1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
interface FastEthernet0/0
 switchport mode trunk
!
interface FastEthernet0/1
 switchport access vlan 10
!
interface FastEthernet0/2
 switchport access vlan 20
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
 switchport mode trunk
!
interface Vlan1
 no ip address
!
ip http server
no ip http secure-server
!
control-plane
 
!
line con 0
 exec-timeout 0 0
 logging synchronous
line aux 0
line vty 0 4
!
!
End
測試的結果
Sending 5, 100-byte ICMP Echos to 192.168.20.254, timeout is 2 seconds:
!!!!!
Router(config)#do ping 192.168.10.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.254, timeout is 2 seconds:
!!!!!
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章