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

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

For an introduction to the new site, click here. And see here for current known issues.

New Member

OSPF Distance command question

Hi everyone,

I have a home lab setup with three 3640 routers, easily named and connected as "Top", "Left", and "Right". They are connected in a triangle, with the top router on the top and the other two on the bottom. Each router has 2 serial cables connecting it to the other 2 routers, and each router has a loopback configured.

The link on the bottom is RIPv2, and the left side and right side links are running OSPF. I am redistributing from RIP to OSPF on the 2 bottom routers so that the top router can reach the bottom link. Everything is hunky-dory, except that suboptimal routes are being introduced due to OSPF having a lower AD than RIP - so the left router will reach the right router's loopback via the top router - taking a longer path through 2 serial ports because the OSPF route is preferred over the shorter RIP route. Fine - I understand this.

My idea was this - why not configure an access list permitting the RIP routes (the bottom serial link and the bottom two routers' loopbacks), and then apply a distance command of 125 in ospf using that access-list. I read in the CCNP book that this is a good way to prevent suboptimal routes from being installed in the routing table.

What happened, in effect, was this:

before distance command, the top router would reach the left router's loopback via it's serial connection to the left router.

after the distance command, the top router had 2 equal cost paths to the left router's loopback, one via the left router and the other via the right router.

the right router originated an LSA advertising the left router's loopack address via itself when I configured the distance command.

Here are the pertinent details of the routing table:


O E1 [110/84] via, 00:05:50, Serial1/0


O E1 [110/84] via, 00:00:20, Serial1/1

[110/84] via, 00:00:20, Serial1/0 is the left router is the right router with the distance command configured.

Any help would be greatly appreciated. Also any advice on a perhaps better way to avoid suboptimal routes that does not involve originating routes that a router should really not originate.

Cheers and thanks in advance.


Jim Woodward

New Member

Re: OSPF Distance command question

It looks as if the loopbacks aren't part of the OSPF process as they're shown as external type 1. Add the loopback IPs to the OSPF network statements.

If your goal is to allow the bottom serial link to be visible to the top router by OSPF, but not have it participate in the OSPF routing process, you can include its IPs in the OSPF network statements of the bottom routers and make the interfaces passive.

You could also redistribute connected on both of the bottom routers and tweak the metrics as desired.

New Member

Re: OSPF Distance command question

Hi Hennigan,

Thanks for your reply. I have just reconfigured my routers for the OSPF/RIP redistribution, and will try out your suggestions. Thanks for your help - will post my results forthwith (heh).

Thanks, and cheers.

Jim Woodward

New Member

Re: OSPF Distance command question

Reply to your response:

Hi Hennigan,

I'm sorry if I wasn't clear before. The loopbacks are not part of the OSPF process, they are in fact part of the RIP network. So the left loopback, the right loopback, and the Serial connection between the two routers comprise the RIP network. The serial links btwn. the Top router and the other 2 routers + the Top router's loopback make up the OSPF area 0.

My goal is this: that the left router reach the right router and the right router's loopback via RIP (1 hop) instead of via OSPF (2 serial links distance). And vice versa, for the right router to access the left router and it's loopback via the RIP Serial link btwn. them instead of the long way through OSPF via the Top router.

CreatePlease to create content