10-05-2009 07:45 AM - edited 03-06-2019 08:00 AM
All,
I have a situation where I don't want a default gateway unless an interface is down. The default gateway is still getting put into the table even though I'm tracking based on this interface:
router# sh track
Track 1
Interface FastEthernet0/0 line-protocol
Line protocol is Up
1 change, last change 00:01:15
Delay up 20 secs, down 10 secs
Tracked by:
STATIC-IP-ROUTING 0
router# sh run | inc track
track 1 interface FastEthernet0/0 line-protocol
ip route 0.0.0.0 0.0.0.0 10.125.95.3 name Anira track 1
Is there a way of keeping a default route out of the table unless F0/0 goes down?
Thanks!
John
10-05-2009 08:25 AM
If you're not monitoring the distant end's reachability, you can just use a floating static route.
I'm assuming you have a static route going out your fa0/0 when it is up, and it has the default AD of 1.
ip route 0.0.0.0 0.0.0.0 10.125.95.3 2
Both your solution and this solution only protect you if your interface actually goes down, it doesn't verify that the next hop going out of fa0/0 has NLRI. If you want to have that capability, you will need to setup IP SLA and track the SLA.
HTH,
Craig
10-05-2009 08:27 AM
Depending on the version of IOS, you could use the Embedded Event Manager to do this. For example, assuming 12.4(2)T or higher:
event manager applet add-default-route
event track 1 state down
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "ip route 0.0.0.0 0.0.0.0 10.125.95.3 name Anira"
action 4.0 cli command "end"
event manager applet no-default-route
event track 1 state up
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "no ip route 0.0.0.0 0.0.0.0 10.125.95.3 name Anira"
action 4.0 cli command "end"
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