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

Manipulating OSPF To Achieve Desired Routing


I have a bit of a tricky setup that I want to achieve. We have 2 sites... at each site, we have a router connected to a BGP MPLS network (same MPLS network at each site). Between each site, we have a 1Gb connection. We also have a 4Mb connection.

Our IGP is OSPF. The routers connected to the MPLS network use BGP and redistribute routes into OSPF.

The setup I want to achieve is that for normal operation, traffic going out to the MPLS network should use the local MPLS router, and in case of a failure of the WAN link, it should use the 4Mb link (as opposed to the 1Gb link, which it would want to use). However, I want all OTHER traffic between the 2 sites to use the 1Gb link.

Is there a way I can advertise routes in one way to a neighbor, and a different way to another neighbor from the same router (eg can I advertise the routes with a massive cost to 1 neighbor, and the routes with a small cost to another neighbor).

I have attached a diagram that should show what I am trying to achieve.



New Member

Re: Manipulating OSPF To Achieve Desired Routing

Hi Goulin,

note sure whether this might help, just try.

Since your target is to make sure MPLS network or traffic flows in 4mb link, you might need to look into the BGP advertising. Perhaps some route-selection need to be configured to advertise 4mb link has higher priorities than 1Gb link. As-Path, weight or local preference need configured at 4mb link at both end routers.

since 4mb link and 1Gb link are in OSPF area. you may considered configuring cost at ospf interface. Mke sure the Ospf interface at 4Mb link higher than 1Gb link. the config

"int serial0/0"

"ip ospf cost 20"

please make note the ospf default cost is zero.

just my two cents..

Cisco Employee

Re: Manipulating OSPF To Achieve Desired Routing


You can do it by playing with OSPF cost on your different interfaces:

To better explain, I gave names to your routers from your drawing:


| |----R5(BGP)

| |


First rule is to have the cost of R3-R1-R2-R4 > cost of R3-R4. This rule will ensure traffic between your local networks go via R3-R4.

2nd rule is cost of R4-R5 (R3-R1) < any other path between R4 and R1 (R3 and R2)

Each site will use its local MPLS access

3rd rule is cost R4-R2-R1 (R3-R1-R2-R5) < R4-R3-R1 (R3-R4-R5)

A site which just lost its MPLS link will use the 4Mb link as a backup

From your design, I assume R4, R2 and R5 are on the same VLAN and you are redistributing the BGP routes in the same way on R1 and R5 (same metric and metric-type E2).

The following cost should do the job:


| |

5 5---R5

| |


So configure those different cost on the different interfaces and let us know if it's working !!