01-25-2019 01:03 PM
Hey, all.
So I want to use IP SLA to remove a route on my Nexus 7K. I've found lots of articles telling me how to use a secondary route if the IP SLA fails, but I can't seem to find any commands to stop advertising/remove that route entirely if the IP SLA fails.
Is there a way?
Thanks.
Solved! Go to Solution.
01-25-2019 02:07 PM
Hello,
you need to use an EEM script that removes/adds the route based on the status of your SLA. If the SLA is down (that happens if the tracked IP address, 8.8.8.8 in this case) is unreachable, the route will be removed. If it is reachable again (SLA up), it will be added:
Here is an example:
N7K#configure terminal
N7K(config)#feature sla sender
N7K(config)#track 1 ip sla 1 reachability
N7K(config)#delay down 8 up 10
N7K(config)#ip sla 1
N7K(config-ip-sla)#icmp-echo 8.8.8.8 source-ip 192.168.1.1
N7K(config-ip-sla-echo)#frequency 300
N7K(config-ip-sla-echo)#timeout 6000
N7K(config-ip-sla-echo)#exit
N7K(config)#ip sla schedule 1 life forever start-time now
!
event manager applet ADD_ROUTE
event 1 track state up
action 1.0 cli command "enable"
action 1.1 cli command “config t”
action 1.2 cli command “ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0”
action 1.3 end
!
event manager applet REMOVE_ROUTE
event 1 track state down
action 1.0 cli command "enable"
action 1.1 cli command “config t”
action 1.2 cli command “no ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0”
action 1.3 end
01-28-2019 06:52 AM - edited 01-28-2019 06:53 AM
Not used Nexus but used IP SLA before and yes that should work with the minor modification -
ip route 10.1.1.1/32 10.2.2.2 track 100 (note the track number)
you do not need a replacement route for this to work, it is just that most examples show that.
Jon
01-25-2019 02:07 PM
Hello,
you need to use an EEM script that removes/adds the route based on the status of your SLA. If the SLA is down (that happens if the tracked IP address, 8.8.8.8 in this case) is unreachable, the route will be removed. If it is reachable again (SLA up), it will be added:
Here is an example:
N7K#configure terminal
N7K(config)#feature sla sender
N7K(config)#track 1 ip sla 1 reachability
N7K(config)#delay down 8 up 10
N7K(config)#ip sla 1
N7K(config-ip-sla)#icmp-echo 8.8.8.8 source-ip 192.168.1.1
N7K(config-ip-sla-echo)#frequency 300
N7K(config-ip-sla-echo)#timeout 6000
N7K(config-ip-sla-echo)#exit
N7K(config)#ip sla schedule 1 life forever start-time now
!
event manager applet ADD_ROUTE
event 1 track state up
action 1.0 cli command "enable"
action 1.1 cli command “config t”
action 1.2 cli command “ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0”
action 1.3 end
!
event manager applet REMOVE_ROUTE
event 1 track state down
action 1.0 cli command "enable"
action 1.1 cli command “config t”
action 1.2 cli command “no ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0”
action 1.3 end
01-25-2019 02:23 PM
01-25-2019 02:26 PM
Hello,
what route are you tracking, static, OSPF ?
01-28-2019 05:40 AM
This is a static route, Georg.
01-28-2019 05:47 AM - edited 01-28-2019 07:54 AM
Hello,
unless you track the primary static route (as you have already tested), I don't see any other way than using the EEM script to remove it...
Edit: I just read Jon's message and he is absoluetly right. I think the confusion comes from your initial post:
--> I've found lots of articles telling me how to use a secondary route if the IP SLA fails, but I can't seem to find any commands to stop advertising/remove that route entirely if the IP SLA fails.
What do you want to remove permanently, the secondary or the primary route ?
01-28-2019 06:26 AM
Georg,
I'm sorry I'm a little confused as to what you mean. Are you saying this should work or that this won't work:
ip sla 1
icmp-echo 10.1.1.1 source-interface Vlan5
threshold 500
!
ip sla monitor schedule 1 life forever start-time now
!
track 100 ip sla 1 reachability
!
ip route 10.1.1.1/32 10.2.2.2 track 1
01-28-2019 06:52 AM - edited 01-28-2019 06:53 AM
Not used Nexus but used IP SLA before and yes that should work with the minor modification -
ip route 10.1.1.1/32 10.2.2.2 track 100 (note the track number)
you do not need a replacement route for this to work, it is just that most examples show that.
Jon
01-28-2019 06:53 AM
01-28-2019 07:41 AM - edited 01-28-2019 07:49 AM
Hello,
I am not entirely sure I understand what you are trying to accomplish, to be honest. The 'track' command will remove the static route, but then you need something else to replace that. Maybe you can post you full config...
Edit: I just read Jon's post, and he is absolutely correct.
01-28-2019 09:27 AM
01-28-2019 10:01 AM
Hello,
if that is what you want, Jon gave you the solution. No need for an EEM script.
01-25-2019 02:28 PM
So when the track fails does it not remove the route ?
Jon
01-25-2019 02:29 PM
you have not made clear on the orginal post, so you have asked for IP SLA @Georg Pauwen provided one for you.
explain more, if you looking to do with Dynamic Routing protocol and provide the existing config to advise better.
03-17-2021 09:52 AM
In my case, I have 2 default routes set up.
ip route 0.0.0.0 0.0.0.0 100.100.100.1 name Outbound-Internet-SiteA-primary track 10
ip route 0.0.0.0 0.0.0.0 100.200.100.1 5 name BKUP-Outbound-Internet-SiteB
track 10 ip sla 1 reachability
delay down 30 up 180
ip sla 1
icmp-echo 4.2.2.2 source-ip 100.100.100.2
frequency 5
ip sla schedule 1 life forever start-time now
When IP SLA1 is down, track 10 waits 30 seconds, then removes it from routing table and then my secondary route weighted at 5 is then added to the routing table and takes over, forcing my traffic to now traverse my Backup link for internet.
The problem is, sometimes my primary comes back up fine, but then goes down again after 7 or 8 minutes. In my previous incident, this happened 5 or 6 times and as you can imagine, if anyone is doing an outbound conference call over ip or video presentation, they're going down each time and having to re-establish that session in just enough time for it to happen again.
Is there a way, using the EEM Script above, to either delay or even bypass the track timers to add a long wait time before running the ADD_ROUTE applet? I don't want to go back to my primary too soon. Both links are same speed, so I can run off either.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide