La technologie HSRP étant démunie d’un tracking de route natif ou d’interface distante, une fonction permet de palier à ce manque. Il s’agit de la mise en œuvre d’une option permettant d’appeler une sonde SLA directement appliquée sur l’interface concernée.
Qu’est-ce que IPSLA:
IPSLA (Internent Protocol Service Level Agreement) est un service délivré sur les plateformes Cisco IOS. Ce service permet de réaliser des mesures devant permettre l’analyse d’un flux. Plus précisément et à titre d’exemple, ce mécanisme est très utilisé dans le cadre d’audits réseaux permettant ainsi de vérifier le respect des indicateurs, mais surtout le bon fonctionnement du service délivré.
Dans ce contexte nous utiliserons ce mécanisme non pas pour vérifier le respect des indicateurs de service, mais pour accroitre la résilience d’un mécanisme dédié à la tolérance de panne du service de passerelle HSRP.
La topologie:
La configuration du mécanisme:
R5
hostname R5 ! boot-start-marker boot-end-marker ! ! no aaa new-model ! resource policy ! memory-size iomem 5 ip subnet-zero ip cef ! ! no ip domain lookup ! Création d’une sonde SLA 1 ip sla monitor 1 ! On indique le type de requête et sa destination type echo protocol ipIcmpEcho 192.168.1.50 ! On détermine la durée de vie d’une requête timeout 2000 ! On spécifie la récurrence de la requête threshold 2000 ! On indique la fréquence des demandes (toutes les 3 secondes)R4
frequency 3 ! Mise en œuvre d’une règle permettant d’indiquer que la requête démarre aussitôt et qu’elle fonctionne en permanence.
ip sla monitor schedule 1 life forever start-time now ! ! key chain hsrp key 1 key-string hsrp ! ! ! Création d’une règle de tracking track 1 rtr 1 delay down 5 ! ! interface FastEthernet0/0 ip address 192.168.2.2 255.255.255.0 speed auto full-duplex standby ip 192.168.2.254 standby preempt delay minimum 1 standby authentication md5 key-string hsrp standby name lan ! Application de la règle de tracking au processus HSRP standby track 1 decrement 30 ! interface FastEthernet0/1 ip address 172.16.2.2 255.255.255.0 speed auto full-duplex ! ip classless ip route 0.0.0.0 0.0.0.0 172.16.2.1 ! no 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
hostname R4 ! boot-start-marker boot-end-marker ! ! no aaa new-model ! resource policy ! memory-size iomem 5 ip subnet-zero ip cef ! ! no ip domain lookup ip sla monitor 1 type echo protocol ipIcmpEcho 192.168.1.50 timeout 2000 threshold 2000 frequency 3 ip sla monitor schedule 1 life forever start-time now ! ! key chain hsrp key 1 key-string hsrp ! ! track 1 rtr 1 delay down 5 ! ! interface FastEthernet0/0 ip address 192.168.2.1 255.255.255.0 speed auto full-duplex standby ip 192.168.2.254 standby priority 110 standby preempt delay minimum 1 standby authentication md5 key-string hsrp standby name lan standby track 1 decrement 30 ! interface FastEthernet0/1 ip address 172.16.1.2 255.255.255.0 speed auto full-duplex ! ip classless ip route 0.0.0.0 0.0.0.0 172.16.1.1 ! no 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
R6
hostname R6 ! boot-start-marker boot-end-marker ! ! no aaa new-model ! resource policy ! memory-size iomem 5 ip subnet-zero ip cef ! ! no ip domain lookup ! ! interface FastEthernet0/0 ip address 172.16.1.1 255.255.255.0 speed auto full-duplex ! interface FastEthernet0/1 ip address 172.16.2.1 255.255.255.0 speed auto full-duplex ! interface FastEthernet1/0 ip address 192.168.1.50 255.255.255.0 speed auto full-duplex ! ip classless ip route 192.168.2.0 255.255.255.0 172.16.1.2 ip route 192.168.2.0 255.255.255.0 172.16.2.2 ! no 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
Exemple de mise en application du mécanisme :
Ci-dessous un cas de figure pratique permettant de d’appréhender le fonctionnement et l’intérêt de l’utilisation du mécanisme.
Rupture du service sur le maitre.
Je coupe le lien interconnectant R6 à R4
R6(config-if)#shu
R6(config-if)#shutdown
R6(config-if)#
R6(config-if)#
*Mar 1 00:28:17.663: %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to administratively down
*Mar 1 00:28:18.663: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to down
R6(config-if)#
R4 détecte la coupure est bascule
R4#
*Mar 1 00:25:38.351: %HSRP-6-STATECHANGE: FastEthernet0/0 Grp 0 state Active -> Speak
R4#
R5 détecte la coupure est bascule
R5#
*Mar 1 00:25:59.807: %HSRP-6-STATECHANGE: FastEthernet0/0 Grp 0 state Standby -> Active
R5#
Reprise d’activité:
Je reactive l’interface de R6
R6(config-if)#no shut
R6(config-if)#
R6(config-if)#
R6(config-if)#
*Mar 1 00:30:42.255: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state t o up
*Mar 1 00:30:43.255: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthern et0/0, changed state to up
R6(config-if)#
R4 reprend le rôle de maître
R4#
*Mar 1 00:27:56.399: %HSRP-6-STATECHANGE: FastEthernet0/0 Grp 0 state Standby -> Active
R4#
On vérifie :
R4#sh standby
FastEthernet0/0 – Group 0
State is Active
8 state changes, last state change 00:01:37
Virtual IP address is 192.168.2.254
Active virtual MAC address is 0000.0c07.ac00
Local virtual MAC address is 0000.0c07.ac00 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 1.708 secs
Authentication MD5, key-string « hsrp »
Preemption enabled, delay min 1 secs
Active router is local
Standby router is 192.168.2.2, priority 100 (expires in 9.728 sec)
Priority 110 (configured 110)
Track object 1 state Up decrement 30
IP redundancy name is « lan » (cfgd)
R5 reprend le rôle d’esclave
R5#
*Mar 1 00:28:17.891: %HSRP-6-STATECHANGE: FastEthernet0/0 Grp 0 state Active -> Speak
R5#
On vérifie :
R5#sh standby
FastEthernet0/0 – Group 0
State is Standby
10 state changes, last state change 00:01:06
Virtual IP address is 192.168.2.254
Active virtual MAC address is 0000.0c07.ac00
Local virtual MAC address is 0000.0c07.ac00 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 2.188 secs
Authentication MD5, key-string « hsrp »
Preemption enabled, delay min 1 secs
Active router is 192.168.2.1, priority 110 (expires in 8.188 sec)
Standby router is local
Priority 100 (default 100)
Track object 1 state Up decrement 30
IP redundancy name is « lan » (cfgd)
Les commandes de diagnostiques (IPSLA):
-
sh ip sla monitor statistics
R4#sh ip sla monitor statistics
Round trip time (RTT) Index 1
Latest RTT: 41 ms
Latest operation start time: *00:08:09.099 UTC Fri Mar 1 2002
Latest operation return code: OK
Number of successes: 14
Number of failures: 0
Operation time to live: Forever
-
sh ip sla monitor operational-state
R5#sh ip sla monitor operational-state
Entry number: 1
Modification time: *00:07:55.035 UTC Fri Mar 1 2002
Number of Octets Used by this Entry: 2288
Number of operations attempted: 31
Number of operations skipped: 0
Current seconds left in Life: Forever
Operational state of entry: Active
Last time this entry was reset: Never
Connection loss occurred: FALSE
Timeout occurred: FALSE
Over thresholds occurred: FALSE
Latest RTT (milliseconds): 12
Latest operation start time: *00:09:25.039 UTC Fri Mar 1 2002
Latest operation return code: OK
RTT Values:
RTTAvg: 12 RTTMin: 12 RTTMax: 12
NumOfRTT: 1 RTTSum: 12 RTTSum2: 144
Autres commandes permettant d’aider au diagnostique:
-
Show Logging
*Jan 22 20:28:58.559: %SYS-5-CONFIG_I: Configured from console by console
*Jan 22 20:29:56.835: %TRACKING-5-STATE: 1 ip sla 1 reachability Down->Up
*Jan 22 20:30:00.895: %HSRP-5-STATECHANGE: Ethernet1/0 Grp 0 state Standby -> Active
*Jan 22 20:32:08.739: %SYS-5-CONFIG_I: Configured from console by console
-
Debug ip icmp
- Utilisant une requête de type ICMP, le debug ICMP peut s’avérer utile.
R4#*Mar 1 00:12:00.135: ICMP: echo reply rcvd, src 192.168.1.50, dst 172.16.1.2
R4#*Mar 1 00:12:03.135: ICMP: echo reply rcvd, src 192.168.1.50, dst 172.16.1.2
R4#*Mar 1 00:12:06.131: ICMP: echo reply rcvd, src 192.168.1.50, dst 172.16.1.2
R4#*Mar 1 00:12:09.135: ICMP: echo reply rcvd, src 192.168.1.50, dst 172.16.1.2
R4#