11-26-2010 06:17 AM - edited 03-03-2019 06:08 AM
Hi,
I need to execute a set of commands in the cisco router for automating.
I got two ISP's and in my router I got default route for only one ISP. If this ISP goes down, I need to remove the deafult route for this ISP and add the default route for the other ISP. I need some kind of script to do this while I am not at office (may be using rsh command). Could someone guide me for this setup?
Thanks in advance,
Ribin Jones S.B
Solved! Go to Solution.
11-26-2010 08:21 AM
Ribin
As expected syntax has changed, actually with 12.4(20)T, use this instead -
track 10 ip sla 1 reachability
as for switching over if over a certain time, i'm not sure. I have never done this as it can lead to link flapping ie. one ping takes a little longer and then the router switches routes and then the next ping works fine and it switches back.
I suspect you may be able to, if i get time i'll have a look, as there are options like threshold that you can configure under the ip sla bit.
Probably worth testing this first though.
Jon
11-26-2010 07:12 AM
ribin.jones wrote:
Hi,
I need to execute a set of commands in the cisco router for automating.
I got two ISP's and in my router I got default route for only one ISP. If this ISP goes down, I need to remove the deafult route for this ISP and add the default route for the other ISP. I need some kind of script to do this while I am not at office (may be using rsh command). Could someone guide me for this setup?
Thanks in advance,
Ribin Jones S.B
Ribin
There is a function called IP SLA that comes with IOS that can do this for you automatically ie. if the primary link goes down the route is removed and a route for the secondary link is automatically put into the routing table. If the primary comes back up then the secondary route is removed and replaced with the primary.
What router model do you have and what IOS version/feature set are you running ?
Jon
11-26-2010 07:17 AM
Hi,
Router model - Cisco 2811
IOS version - flash:c2800nm-adventerprisek9-mz.124-20.T.bin
Regards,
Ribin
11-26-2010 07:51 AM
Ribin
Okay it should look something like this -
ip sla 1
icmp-echo
timeout
frequency 10 <-- this is in seconds and you can change it to what you want ie. how often the ping happens
ip sla schedule 1 life forever start-time now
track 10 rtr 1 reachability
ip route 0.0.0.0 0.0.0.0
ip route 0.0.0.0 0.0.0.0
what the above does is ping your primary next-hop address and if it responds then it keeps using the primary default-route. If it stops responding then it removes the primary route and inserts the secondary route. If the ping starts working again it reverses that and installs the primary route again.
Give it a go and let me know how you get on.
Jon
11-26-2010 08:03 AM
What does this line say?
"track 10 rtr 1 reachability"
I see below options:
Router(config)#track 10 ?
application Application
interface Select an interface to track
ip IP protocol
list Group objects in a list
stub-object Stub tracking object
- Ribin
11-26-2010 08:07 AM
Also, does this work only if ping to a defined destination stops? or can we set it like it the ping response goes over a certain value then change the route?
- Ribin
11-26-2010 08:12 AM
ribin.jones wrote:
What does this line say?
"track 10 rtr 1 reachability"
I see below options:
Router(config)#track 10 ?
application Application
interface Select an interface to track
ip IP protocol
list Group objects in a list
stub-object Stub tracking object- Ribin
Ribin
Apologies, i made a mistake in config -
ip route 0.0.0.0 0.0.0.0
should be -
ip route 0.0.0.0 0.0.0.0
I'm not sure why you don't have the option "rtr". Did all the "ip sla" config go in okay ?
I was assuming it was all supported with advanced IP services feature set. I will check.
Other thing is they do keep changing syntax for IP SLA so i'll check that as well.
Jon
11-26-2010 08:17 AM
Thanks and Yes, all other commands worked well.
- Ribin
11-26-2010 08:21 AM
Ribin
As expected syntax has changed, actually with 12.4(20)T, use this instead -
track 10 ip sla 1 reachability
as for switching over if over a certain time, i'm not sure. I have never done this as it can lead to link flapping ie. one ping takes a little longer and then the router switches routes and then the next ping works fine and it switches back.
I suspect you may be able to, if i get time i'll have a look, as there are options like threshold that you can configure under the ip sla bit.
Probably worth testing this first though.
Jon
11-26-2010 08:42 AM
Great...The secondary ISP route took effect when ping to a defined IP stopped. But when the ping to a defined IP is back, the router doesn't take the primary route. Traffic still goes via the secondary ISP route.
- Ribin
11-26-2010 08:45 AM
Ribin
Did you definitely add the 250 to the end of the secondary route ?
Jon
11-26-2010 08:48 AM
Seems I did some mistake.
In "icmp-echo
I gave a known public IP of one of our machine in another location in the place of
- Ribin
11-26-2010 08:50 AM
ribin.jones wrote:
Seems I did some mistake.
In "icmp-echo
" I gave a known public IP of one of our machine in another location in the place of
, which was the one I mentioned as "defined IP" in my preious post. When this machine was shutdown, my router took the second route. May be I need to try with the ISP's next hope in the router? - Ribin
Ribin
If you can try with the ISP next-hop as the address to ping and make sure secondary route has the 250 at the end. If that still doesn't work we can look at what IP SLA thinks is going on.
Jon
11-26-2010 08:54 AM
Thanks Jon...may be I won't be able to try this today. Will get back once I try this.
- Ribin
11-26-2010 09:05 AM
No problem. When you do test it, after you setup the initial config, after you drop the line to the ISP and after the line to ISP is brought back up again can you run "sh ip sla monitor statistics" as this will show what IP SLA is doing.
Jon
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