CCIE Pursuit Blog

July 9, 2007

The Administrative Distance Of A Static Route Pointed To An Interface Is NOT Zero

Filed under: IOS,Tech Tips,Training Materials — cciepursuit @ 2:34 pm

I’ve been lied to….bamboozled….tricked.  🙂 

While viewing one of the Internetwork Expert COD lessons (about PPP) Brian Dennis dropped this (paraphrased) bombshell on me:

“The administrative distance (AD) of a static route is always 1 by default, regardless of whether it is pointing to an interface or an IP address. ”

Great.  First I find out the “no arp frame-relay” is just a waste of keystrokes and now this!  I don’t know where I first learned that the default AD of a static route pointing to an interface is 0 (versus the default AD of 1 for a static route pointing to an IP address), but I’ve accepted it as gospel for quite a while.  In a comment to this post, Mark pointed out that on page 99 of Jeff Doyle’s Routing TCP/IP Volume 1, 2nd Edition still purports this to be true.  I was able to verify that this is true (on page 128 of my PDF version – my printed copy is in the office):

“For example, IPv4 static routes pointing to a next-hop address have an administrative distance of 1, and static routes referencing an exit interface have an administrative distance of 0. If two static routes point to the same destination, but one references a next-hop address and one references an exit interface, the latter with the lower administrative distance will be preferred.”

We are all familiar with this table:

Route Source Default Distance Values
Connected interface 0
Static route 1
Enhanced Interior Gateway Routing Protocol (EIGRP) summary
  route
5
External Border Gateway Protocol (BGP) 20
Internal EIGRP 90
IGRP 100
OSPF 110
Intermediate System-to-Intermediate System
  (IS-IS)
115
Routing Information Protocol (RIP) 120
Exterior Gateway Protocol (EGP) 140
On Demand Routing (ODR) 160
External EIGRP 170
Internal BGP 200
Unknown 255

Since the router treats a static route pointing to an interface the same as a connected interface, it makes sense that the AD should be the same as a connected interface (zero).   I’ve never configured a static route to point to an interface in the “real world” so I’ve never really checked out the validity of the zero AD.  It should be very easy to verify, so let’s check it out:

Here’s our (simple) topology (click to enlarge):

Static Route AD Topology

There are two static routes configured on R4 to reach loopback addresses on R5.  One of the routes points the next-hop IP address of R5’s s0/1 interface and the other just points to R4’s s0/1 interface.

The static routes on R4:
r4:
ip route 5.5.5.0 255.255.255.0 s0/1
ip route 55.55.55.0 255.255.255.0 10.1.1.5

R4#sh ip route static
     55.0.0.0/24 is subnetted, 1 subnets
S       55.55.55.0 [1/0] via 10.1.1.5       <- AD of 1
     5.0.0.0/24 is subnetted, 1 subnets
S       5.5.5.0 is directly connected, Serial0/1 <-no AD listed so AD=0?

But if we look at the individual IP routes, we see:

R4#sh ip route 55.55.55.55
Routing entry for 55.55.55.0/24
  Known via “static“, distance 1, metric 0 <-AD of 1
  Routing Descriptor Blocks:
  * 10.1.1.5
      Route metric is 0, traffic share count is 1

R4#sh ip route 5.5.5.5
Routing entry for 5.5.5.0/24
  Known via “static“, distance 1, metric 0 (connected) <-AD of 1
  Routing Descriptor Blocks:
  * directly connected, via Serial0/1
      Route metric is 0, traffic share count is 1

This verifies that the default AD for a static route is one, regardless of whether the route points to a next-hop IP address or an outgoing interface.

Brian Dennis further proved that this is true by configuring two /24 routes to the same IP address, one pointing to a next-hop IP address and one to the point-to-point interface.  The router load-balanced over both links.  This proves that the routes have the same AD because if they did not, the router would only install the route with the lower AD (assuming the routes have the same longest match).

So, is the zero AD for static routes just a Cisco urban legend?  Does the routing bible (Routing TCP/IP) contain “Satanic Verses“?  Well, probably not.  In his excellent post concerning this issue, Ivan Pepelnjak advises that at one time the AD of a static route pointing to an interface WAS zero:

“In his excellent question, Matt reminded me of (almost prehistoric) days when static routes pointing to a connected interface (not IP next-hop) had administrative distance zero. I also remembered that we’ve had interesting routing problems as those static routes actually behaved like connected routes (and were redistributed into routing protocols with redistribute connected command).

This is no longer the case (and hasn’t been since at least IOS release 12.2 …”

You should definitely read the entire post.  Ivan also may have pinpointed when the change was made: 

“Searching through Cisco’s Bug toolkit turned up only a single relevant bug: CSCdi38232 (redistribute connected should not redistribute static route to OSPF), which was fixed in IOS release 10.2 and 10.3, that’s probably also when they’ve fixed the administrative distance.”


Cisco Documentation:ip route

Default Distance Value Table

3 Comments »

  1. Well, me too was knowing it to be correct,
    un till I figured through an article out that it was as per the history of IOS.

    And has been rectified due to the issues of redistribution.. 🙂

    Comment by Dara — July 9, 2007 @ 3:55 pm | Reply

  2. Hello!

    In our study gruoup we discussed this for quite a while and are wondering if you could re-produce the experiment but this time watch if the router load-balances (which would prove you right) or if it should choose one interface (which would not)

    Also, could you please post the IOS version you are using?

    Many thanks, I will try to get a hold of some routers, too.. just because I am busy with this for so long now. 🙂

    Regards,

    Andreas

    Comment by Andreas — February 24, 2008 @ 2:21 am | Reply

  3. Just a little info. I am studying the BSCI and it notes that if you need a static to appear as a directly connected interface to configure it with the egress interface. This is probably where everyone is getting this info from. But as mentioned before this has changed.

    Comment by Mark — March 5, 2009 @ 10:43 am | Reply


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.