Objetivo: probar las funcionalidades de IP SLAs ICMP Jitter combinado con EEM para generar enrutamiento inteligente…(se podría pensar que es un complemento de BFD?)
Topología:
El enlace principal de la conectividad entre el RouterA y el B es través del service provider. En este laboratorio se prevee chequear la demora y pérdida de los paquetes, reaccionar ante determinados límites permisibles y cambiar el enlace principal mediante el cambio de los costos en las interfaces (en un solo router, no hay manera de rescribir el comportamiento del otro router, pero vamos a ver que se puede hacer)
La configuración de los equipos es la siguiente:
RouterA: ! hostname RouterA ! interface Loopback0 ip address 172.27.1.1 255.255.255.255 /el objetivo de está interfaz es generar el cambio en el router extremo. ! interface Ethernet0/0 ip address 172.18.4.5 255.255.255.252 ip ospf cost 300 /costo del enlace principal. ! interface Ethernet0/1 ip address 172.18.4.1 255.255.255.252 ip ospf cost 400 /costo del enlace secundario. ! interface Ethernet0/2 ip address 172.22.8.1 255.255.255.0 /lan. ! router ospf 1 router-id 1.1.1.1 passive-interface Ethernet0/2 network 0.0.0.0 255.255.255.255 area 0 /proceso de enrutamiento. ! ip sla auto discovery ip sla 1 /ip sla jitter que reporta rtt y packet loss entre otras cosas, siempre va por el enlace principal. icmp-jitter 172.18.4.6 source-ip 172.18.4.5 num-packets 5 tos 160 owner admin tag testipsla frequency 15 timeout 10000 threshold 10000 history hours-of-statistics-kept 3 ip sla schedule 1 life forever start-time now ip sla reaction-configuration 1 react rtt threshold-value 100 90 threshold-type immediate action-type trapOnly /reacciona ante rtt mayores de 100 ms y genera un log. ip sla reaction-configuration 1 react successivePacketLoss threshold-value 2 1 threshold-type immediate action-type trapOnly /reacciona ante las pérdidas de paquetes y genera un log. ip sla logging traps /genera logs para ip sla ! line con 0 logging synchronous ! /Este EEM tiene cómo objetivo detectar cualquier violación de los límites impuestos para el sla a través de los logs y cambiar los costos de las interfaces y darle shutdown a la interface loopback 0 con el objetivo de que el otro extremo también cambie los costos en su interfaces. event manager applet phase1 event tag 1 syslog pattern "Threshold exceeded for rtt" event tag 2 syslog pattern "Threshold exceeded for successivePacketLoss" trigger occurs 1 delay 20 correlate event 1 or event 2 attribute tag 1 occurs 1 attribute tag 2 occurs 1 action 1.0 cli command "enable" action 1.1 cli command "configure term" action 1.2 cli command "interface ethernet 0/0" action 1.3 cli command "ip ospf cost 500" action 1.6 cli command "interface Loopback0" action 1.7 cli command "shutdown" /Este EEM tiene cómo objetivo detectar que se deje de violar los límites impuestos para el sla a través de los logs y cambiar los costos de las interfaces y darle no shutdown a la interface loopback 0 con el objetivo de que el otro extremo también cambie los costos en su interfaces y los ponga cómo estaban originalmente una vez que el enlace principal "dejó de tener problemas" event manager applet phase2 event tag 1 syslog pattern "Threshold below for rtt" event tag 2 syslog pattern "Threshold below for successivePacketLoss" trigger occurs 1 delay 20 correlate event 1 or event 2 attribute tag 1 occurs 1 attribute tag 2 occurs 1 action 1.0 cli command "enable" action 1.1 cli command "configure term" action 1.2 cli command "interface ethernet 0/0" action 1.3 cli command "ip ospf cost 300" action 1.6 cli command "interface Loopback0" action 1.7 cli command "no shutdown" !
RouterB ! hostname RouterB ! no ip domain lookup ! /Este track es seguido por el EEM y sigue al ip sla 1, cuando se cae la loopback0 del router B, el track cambia a down y se genera el EEM phase1. track 1 ip sla 1 delay down 20 up 20 ! interface Ethernet0/0 ip address 172.18.4.6 255.255.255.252 ip ospf cost 300 /costo del enlace principal. ! interface Ethernet0/1 ip address 172.18.4.2 255.255.255.252 ip ospf cost 400 /costo del enlace secundario. ! interface Ethernet0/2 ip address 172.22.9.1 255.255.255.0 /lan. ! router ospf 1 router-id 2.2.2.2 passive-interface Ethernet0/2 network 0.0.0.0 255.255.255.255 area 0 /proceso de enrutamiento. ! ip sla auto discovery ip sla 1 /ip sla echo que permite monitorear la loopback0 del otro router. icmp-echo 172.27.1.1 frequency 10 ip sla schedule 1 life forever start-time now ! line con 0 logging synchronous ! /cuando el track caiga a down, este EEM cambia los costos ospf. event manager applet phase1 event track 1 state down action 1.0 cli command "enable" action 1.1 cli command "configure term" action 1.2 cli command "interface ethernet 0/0" action 1.3 cli command "ip ospf cost 500" event manager applet phase2 /cuando el track se levante, este EEM cambia los costos ospf a como estaban originalmente. event track 1 state up action 1.0 cli command "enable" action 1.1 cli command "configure term" action 1.2 cli command "interface ethernet 0/0" action 1.3 cli command "ip ospf cost 300" !
Comprobación.
RouterA#sh running-config interface ethernet 0/0 Building configuration... Current configuration : 86 bytes ! interface Ethernet0/0 ip address 172.18.4.5 255.255.255.252 ip ospf cost 300 End RouterA#sh ip sla statistics IPSLAs Latest Operation Statistics IPSLA operation id: 1 Type of operation: icmp-jitter Latest RTT: 34 milliseconds Latest operation start time: 12:25:11 PST Wed Apr 9 2014 Latest operation return code: OK RTT Values: Number Of RTT: 5 RTT Min/Avg/Max: 25/34/59 milliseconds Latency one-way time: Number of Latency one-way Samples: 5 Source to Destination Latency one way Min/Avg/Max: 1/1/2 milliseconds Destination to Source Latency one way Min/Avg/Max: 23/32/57 milliseconds Jitter Time: Number of SD Jitter Samples: 4 Number of DS Jitter Samples: 4 Source to Destination Jitter Min/Avg/Max: 0/1/1 milliseconds Destination to Source Jitter Min/Avg/Max: 0/11/34 milliseconds Over Threshold: Number Of RTT Over Threshold: 0 (0%) Packet Late Arrival: 0 Out Of Sequence: 0 Source to Destination: 0 Destination to Source 0 In both Directions: 0 Packet Skipped: 0 Packet Unprocessed: 0 Packet Loss: 0 Loss Periods Number: 0 Loss Period Length Min/Max: 0/0 Inter Loss Period Length Min/Max: 0/0 Number of successes: 79 Number of failures: 0 Operation time to live: Forever
!Ahora introducimos 100 ms de demora.
RouterA# *Apr 9 20:26:26.881: %RTT-3-IPSLATHRESHOLD: IP SLAs(1): Threshold exceeded for rtt RouterA#sh ip sla statistics IPSLAs Latest Operation Statistics IPSLA operation id: 1 Type of operation: icmp-jitter Latest RTT: 113 milliseconds Latest operation start time: 12:26:26 PST Wed Apr 9 2014 Latest operation return code: OK RTT Values: Number Of RTT: 5 RTT Min/Avg/Max: 106/113/126 milliseconds Latency one-way time: Number of Latency one-way Samples: 5 Source to Destination Latency one way Min/Avg/Max: 1/1/4 milliseconds Destination to Source Latency one way Min/Avg/Max: 104/111/122 milliseconds Jitter Time: Number of SD Jitter Samples: 4 Number of DS Jitter Samples: 4 Source to Destination Jitter Min/Avg/Max: 0/2/3 milliseconds Destination to Source Jitter Min/Avg/Max: 0/8/18 milliseconds Over Threshold: Number Of RTT Over Threshold: 0 (0%) Packet Late Arrival: 0 Out Of Sequence: 0 Source to Destination: 0 Destination to Source 0 In both Directions: 0 Packet Skipped: 0 Packet Unprocessed: 0 Packet Loss: 0 Loss Periods Number: 0 Loss Period Length Min/Max: 0/0 Inter Loss Period Length Min/Max: 0/0 RouterA# *Apr 9 20:26:49.881: %LINK-5-CHANGED: Interface Loopback0, changed state to administratively down *Apr 9 20:26:50.890: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to down RouterA#sh running-config interface ethernet 0/0 Building configuration... Current configuration : 86 bytes ! interface Ethernet0/0 ip address 172.18.4.5 255.255.255.252 ip ospf cost 500 end RouterB# *Apr 9 20:27:18.282: %TRACK-6-STATE: 1 ip sla 1 state Up -> Down RouterB#sh running-config interface ethernet 0/0 Building configuration... Current configuration : 86 bytes ! interface Ethernet0/0 ip address 172.18.4.6 255.255.255.252 ip ospf cost 500 end
Si quito la demora todo vuelve a su lugar. Igual funciona para la pérdida de paquetes.