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. And see here for current known issues.

New Member

OSPF distance command issue

I have a router A(distro) which connects to router C(core) and router C connects to router B (Wan) and another core D. I have a route 10.32.0.0/21 and I want to route it through router B (WAN) but currently I'm learning it through router D and then C as extern typ 1. I tried to configure distance command in router C and tried to give admin distance 120 but that didn't help. What am I doing wrong here, can someone explain:

distance 120 192.168.202.33 0.0.0.0

192.168.202.33 is the ospf neighbor between C and D.

Is there any other command can be used instead of a distance?

Thanks.

14 REPLIES
Hall of Fame Super Bronze

Re: OSPF distance command issue

The distance command, on this case, will only be used to compare the OSPF route vs same route originated by another dynamic routing protocol.

If both routes are OSPF, the choice is made on this order:

1) intra-area

2) inter-area

3) external E1

4) external E2

If both routes are the same type, you can influence the preference by using the cost metric on the interface. The lowest the cost, the more preferred is the route.

New Member

Re: OSPF distance command issue

Edison, thank you for your response but if i use cost metric then i don't think i can link this with an access-list. My issue is that I want only certain routes to be preferred over this WAN and rest would still route through core, any other suggestion?

Thanks.

Hall of Fame Super Bronze

Re: OSPF distance command issue

You mentioned those routes were external. Are they redistributed by the same ASBR ?

You can have routes redistributed as E1 or E2 with a route-map. Select the routes you want to be preferred from one ASBR as E1 while the least preferred as E2.

New Member

Re: OSPF distance command issue

Edison, These router redistributed by bgp and i they appear as E1 in the core and E2 in the WAN and that's why it always takes the route via E1, I was thinking to specify higher ospf cost on the Core interface so that it can be less preferable, what you think?

Hall of Fame Super Bronze

Re: OSPF distance command issue

That should do it...

New Member

Re: OSPF distance command issue

Hi

Increasing cost didn't help either: Let me explain you more in detail: please look at the show ip osfp dat ext attched

I learn 10.34.96.0 from Core-C, Core-D (core-D learns this from MPLS) and WAN-B but I want Core-C to go to WAN-B and not Core-D for this route because WAN-B also connects to MPLS as well. I specified cost command in core C on the interface which connects to Core-D. I suspect that I might needed this command in the Core-D instead. Please correct and again, thank you for all your help.

Hall of Fame Super Bronze

Re: OSPF distance command issue

The cost won't influence a 'per route' decision, it will influence all ospf routes.

From what I gather, you have Router C (Core), connected to Router D (Core) and Router B (WAN) in a triangular shape.

Router C is learning 10.34.96.0/24 from both Router D and Router B, so far I'm good ?

Both routes should be in the OSPF database from Router C, can you confirm that ?

You can select which route will be installed in Router C's routing table by altering the cost on either ingress interface. If you want Router B to be preferred, lower the cost on this interface or higher the cost on the interface connecting to Router D.

If you can post the output from Router C:

show ip os data | i 10.34.96.

show ip os int bri

On the last command, please specify which is Router D and which is Router B.

Thanks

New Member

Re: OSPF distance command issue

Yes you are right, Router C (Core), connected to Router D (Core) and Router B (WAN).

Router C is learning 10.34.96.0/21 from both Router D and Router B. and Yes both routes are in the OSPF database and here is the output

Core-C#sh ip ospf database | in 10.34.96.0

10.34.96.0 32.245.132.160 1969 0x80000536 0x001F48 13979

10.34.96.0 32.245.132.161 1184 0x80000537 0x009A4A 13979

Core-C#sh ip ospf interface brie (vlan 24 and 33 connects to Core-D)

Interface PID Area IP Address/Mask Cost State Nbrs F/C

Vl33 1 0 192.168.202.34/30 10 BDR 1/1

Vl1 1 0 192.168.203.1/30 10 DR 0/0

Lo0 1 0 10.12.1.203/32 1 LOOP 0/0

Vl25 1 0 192.168.203.25/30 10 DR 1/1

Vl24 1 0 192.168.201.30/30 10 BDR 1/1

Vl22 1 12 192.168.203.21/30 10 BDR 1/1

Vl21 1 13 192.168.203.33/30 10 BDR 1/1

Vl20 1 13 192.168.203.29/30 10 BDR 1/1

Wan-B#sh ip ospf database | in 10.34.96.0

10.34.96.0 32.245.132.160 208 0x80000537 0x001D49 13979

10.34.96.0 32.245.132.161 1422 0x80000537 0x009A4A 13979

Wan-B#sh ip ospf interface brief

Interface PID Area IP Address/Mask Cost State Nbrs F/C

Vl850 1 0 192.168.90.13/30 10 DR 0/0

Tu1 1 0 192.168.239.13/30 65535 P2P 0/0

Vl25 1 0 192.168.203.26/30 10 BDR 1/1

Vl1 1 0 192.168.203.50/30 10 DR 0/0

Lo0 1 0 10.12.1.23/32 1 LOOP 0/0

Vl801 1 2 192.168.90.5/30 10 BDR 1/1

Se8/0/1 1 21 192.168.21.129/30 226 P2P 1/1

Vl815 1 215 192.168.215.21/30 10 BDR 1/1

Vl890 1 641 10.64.1.1/29 10 BDR 1/1

I exacly did as you said, I increased the cost on the ingress interface on router C (vlan 24 and 33) which connects to router D but that didn't help.

Thanks.

Hall of Fame Super Bronze

Re: OSPF distance command issue

If you notice, Router B (which is the router you want to learn the route from) has the exact same OSPF database for 10.34.96.0/24 network (which is a good behavior in OSPF database).

The Router IDs are 32.245.132.160 and .161

You can also notice the cost to Router B and Router D from Router C is the same, so you should have both routes installed in Router C's routing table (load balancing).

Who are the 2 router IDs mentioned above ? The MPLS routers ?

Can I see a show ip route 10.34.96.0 on Router C, Router D and Router B ?

New Member

Re: OSPF distance command issue

Edison

yes, the two routers 32.245.132.160 and .161 are MPLS router and here is the show ip route

from router,B, C and D.

Core-C#sh ip route 10.34.96.0

Routing entry for 10.34.96.0/21

Known via "ospf 1", distance 110, metric 31

Tag 13979, type extern 1

Last update from 192.168.201.29 on Vlan24, 1d02h ago

Routing Descriptor Blocks:

* 192.168.201.29, from 32.245.132.160, 1d02h ago, via Vlan24

Route metric is 31, traffic share count is 1

Route tag 13979

192.168.202.33, from 32.245.132.160, 1d02h ago, via Vlan33

Route metric is 31, traffic share count is 1

Route tag 13979

Core-D#sh ip route 10.34.96.0

Routing entry for 10.34.96.0/21

Known via "ospf 1", distance 110, metric 21

Tag 13979, type extern 1

Last update from 192.168.201.22 on Vlan20, 1d03h ago

Routing Descriptor Blocks:

* 192.168.201.22, from 32.245.132.160, 1d03h ago, via Vlan20

Route metric is 21, traffic share count is 1

Route tag 13979

Wan-B#sh ip route 10.34.96.0

Routing entry for 10.34.96.0/21

Known via "ospf 1", distance 110, metric 41

Tag 13979, type extern 1

Last update from 192.168.203.25 on Vlan25, 1d02h ago

Routing Descriptor Blocks:

* 192.168.203.25, from 32.245.132.160, 1d02h ago, via Vlan25

Route metric is 41, traffic share count is 1

Route tag 13979

Do you think it will work if MPLS provider advertise these routes as metric-type1 on both sides and then i specify AD or on the ingress interface on Core-C?

Thanks and happy new year to all!!

Hall of Fame Super Bronze

Re: OSPF distance command issue

Based on the output provided, Router C is receiving routes from both Core D and Core B.

It's balancing those routes via the 2 Vlans (look at the traffic share count).

The problem (not sure if it's problem, though) I see is that Core D and Core B are only installing the route from 32.245.132.160 while the route from 32.245.132.161 is missing.

Can you verify 32.245.132.161 is advertising the same type of route (E1) ? If it's advertising an (E2), it will only be installed into the routing table once the E1 disappears.

Your design is optimal and I wouldn't change a thing. Not sure why you want to prefer a link over the other on this case. They both providing equal cost routing and fault tolerance.

New Member

Re: OSPF distance command issue

It's balancing routes via two vlan becasee core C connected to two core router (router D and lets say route E). Core C and Wan-B are installing routes from 32.245.132.160 is because these are they are etern type 1 route but when i look at the ospf database either in Wan-B or core-C is see route from both MPLS32.245.132.160 and .161. My desgin appears as optimal but I have asymmetric routing issue. When a packets leaves from a distero connected to core-C I expect it to go out to go to core-C then wan-B and then to MPLS cloud and then the remote but instead it goes to core-C then core-D and E and then Wan on the other side and then to MPLS cloud and on the other hand when packet leaves from a remote site and destined to a network lives in distro (which is connected to Core-C) it comes straight from MPLS cloud to WAN-B and then to core-C and then to distro therfore resulting an asymmetric routing. I hope i explained it well.

Hall of Fame Super Bronze

Re: OSPF distance command issue

You mentioned before

Core-C#sh ip ospf interface brie (vlan 24 and 33 connects to Core-D)

And those are the only 2 routes installed in Core C.

____________________

Core-C#sh ip route 10.34.96.0

Routing entry for 10.34.96.0/21

Known via "ospf 1", distance 110, metric 31

Tag 13979, type extern 1

Last update from 192.168.201.29 on Vlan24, 1d02h ago

Routing Descriptor Blocks:

* 192.168.201.29, from 32.245.132.160, 1d02h ago, via Vlan24

Route metric is 31, traffic share count is 1

Route tag 13979

192.168.202.33, from 32.245.132.160, 1d02h ago, via Vlan33

Route metric is 31, traffic share count is 1

Route tag 13979

_____________________

Where is the route from WAN-B ?

I'm afraid there are more OSPF speaking devices in between and I may be giving you the wrong advise based on the information given from you. Can you draw a network topology ?

New Member

Re: OSPF distance command issue

YEs these are the only two routes installed in core-C which I learn from core D and E which represent vlan 24 and 33 respectively. I have attached a visio diagram and the show ip route from wan-B and core-D. I route to remote sites via DC1 (in the diagram) as oppose to using the wan-B. Please let me know if there are questions and thank you for your time and help.

Wan-B#sh ip route 10.34.96.0

Routing entry for 10.34.96.0/21

Known via "ospf 1", distance 110, metric 41

Tag 13979, type extern 1

Last update from 192.168.203.25 on Vlan25, 1d11h ago

Routing Descriptor Blocks:

* 192.168.203.25, from 32.245.132.160, 1d11h ago, via Vlan25

Route metric is 41, traffic share count is 1

Route tag 1397

Wan-D#sh ip route 10.34.96.0

Routing entry for 10.34.96.0/21

Known via "ospf 1", distance 110, metric 21

Tag 13979, type extern 1

Last update from 192.168.201.22 on Vlan20, 1d11h ago

Routing Descriptor Blocks:

* 192.168.201.22, from 32.245.132.160, 1d11h ago, via Vlan20

Route metric is 21, traffic share count is 1

Route tag 13979

299
Views
4
Helpful
14
Replies