Cisco Tips & Tricks

May 15, 2006

Preferring OSPF over EIGRP routes

Filed under: IP Routing, ospf — ciscotips @ 8:15 pm

When we have two different routing protocols running, there is always a confusion in route preference. Lets say if we have both EIGRP and OSPF running in our backbone, routes learned from EIGRP will be preferred because OSPF has a default administrative distance of 110 and EIGRP has a default administrative distance of 90 for internal routes.

If the same route prefixes are learned under both routing protocols, EIGRP-learned routes will be installed into the IP routing table because of the lower administrative distance (90 is less than 110). The key to having OSPF routes installed in the Routing Information Base (RIB), instead of EIGRP routes, is to make the administrative distance of OSPF less than that of EIGRP using the distance command.

Usage as per Cisco command refference:-

distance ospf

To define OSPF route administrative distances based on route type, use the distance ospf command in router configuration mode. To restore the default value, use the no form of this command.

distance ospf {[intra-area dist1] [inter-area dist2] [external dist3]}

no distance ospf

Syntax Description
intra-area dist1
(Optional) Sets the distance for all routes within an area. The default value is 110.

inter-area dist2
(Optional) Sets the distance for all routes from one area to another area. The default value is 110.

external dist3
(Optional) Sets the distance for routes from other routing domains, learned by redistribution. The default value is 110.

Defaults
dist1: 110

dist2: 110

dist3: 110

Command Modes
Router configuration

Usage Guidelines
You must specify at least one of the keyword-argument pairs.

This command performs the same function as the distance command used with an access list. However, the distance ospf command allows you to set a distance for an entire group of routes, rather than a specific route that passes an access list.

A common reason to use the distance ospf command is when you have multiple OSPF processes with mutual redistribution, and you want to prefer internal routes from one over external routes from the other.

Examples
The following example changes the external distance to 200, making the route less reliable:

Router A Configuration

router ospf 1

redistribute ospf 2 subnet

distance ospf external 200

!

router ospf 2

redistribute ospf 1 subnet

distance ospf external 200

Router B Configuration

router ospf 1
redistribute ospf 2 subnet

distance ospf external 200
!
router ospf 2

redistribute ospf 1 subnet

distance ospf external 200

Advertisements

3 Comments »

  1. Great!!

    Comment by Roy — May 15, 2006 @ 8:27 pm

  2. This is awesome buddy …nice tip ..i will be coming back for looking more

    Comment by Satya — February 18, 2007 @ 9:07 pm

  3. This answers one of the questions i stumbled on the Cisco ICND exam, recently

    Comment by Jonn H Glover — April 9, 2007 @ 3:28 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: