Default gateway and tracking

Unanswered Question
Oct 5th, 2009
User Badges:
  • Purple, 4500 points or more


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:


router# sh run | inc track

track 1 interface FastEthernet0/0 line-protocol

ip route name Anira track 1

Is there a way of keeping a default route out of the table unless F0/0 goes down?



  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (2 ratings)
xcz504d1114 Mon, 10/05/2009 - 08:25
User Badges:
  • Bronze, 100 points or more

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 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.



Joe Clarke Mon, 10/05/2009 - 08:27
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

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 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 name Anira"

action 4.0 cli command "end"


This Discussion