Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

Default gateway and tracking

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

HTH, John *** Please rate all useful posts ***
2 REPLIES
Bronze

Re: Default gateway and tracking

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

Cisco Employee

Re: Default gateway and tracking

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"

161
Views
10
Helpful
2
Replies