cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
8215
Views
25
Helpful
18
Replies

IP SLA to remove route?

jokerfmj1
Level 1
Level 1

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.

2 Accepted Solutions

Accepted Solutions

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

View solution in original post

 

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

View solution in original post

18 Replies 18

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

I was under the impression that if the tracker was down then the route
would not be advertised. Is this not the case?

I just don't want to do an EEM script if that isn't necessary.

Thanks!

Hello,

 

what route are you tracking, static, OSPF ?

This is a static route, Georg.

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 ?

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

 

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

Thanks, John... I edited as to hide corporate information/IP numbers, so I just missed that one.

My thanks.

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. 

Georg,

I simply want the route removed. I have EIGRP running upstream and as long as that route is removed the traffic will be pointed else where after EIGRP reconverges.

Thanks.

Hello,

 

if that is what you want, Jon gave you the solution. No need for an EEM script.

 

So when the track fails does it not remove the route ? 

 

Jon

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.

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

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.

 

 

Review Cisco Networking for a $25 gift card