cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1730
Views
20
Helpful
23
Replies

OSPF Routing

RS19
Level 4
Level 4

I have the below scenario

   Loc A           Loc B          Loc C

Router A -> Router B -> Router C

 

I have 3 locations as shown above

 

Location A is connected to Location B & Location B is connected to Location C

All are running OSPF. I want to achieve the below.

 

Router A advertise network 172.16.0.0/16 & 10.0.0.0/8 to Router B with metric ex - 100

So router B has the route for network 172.16.0.0/16 & 10.0.0.0/8 with metric 100 from router A

 

But when Router B advertise the same networks to Router C , it should advertise with the metric which i want to set manually only for network 172.16.0.0/16.

I want to manipulate/influence the metric only for this particular network.

 

So when router B advertise 172.16.0.0/16 to Router C I want to set metric 200

The metric for network 10.0.0.0/8 should be calculated default by OSPF

 

Let me know if this is possible in OSPF with PBR or any other configuration.

23 Replies 23

RS19
Level 4
Level 4

any help

balaji.bandi
Hall of Fame
Hall of Fame

Trying to understand what is the reason here to increase the metric. since C have only route to reach A is via B.

Until we miss some thing here ?

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Attach is the high level diagram

I have location A connected to DC 1 and DC 2. 

Similarly location B is connected to DC 1 and DC 2.

 

Location B learns, location A network via both DC 1 & DC 2.

- In Location B, 10.0.0.0/8 network is learned via both DC1 & DC 2 because of equal cost.

- So the traffic from Location B -> Location A is load balanced between DC1 and DC2 which I want to avoid

 

I would like to set some kind of routing policy in DC2 so that it advertises about 10.0.0.0/8 to Location B with higher metric.

But this location B will always choose DC1 as the path for network 10.0.0.0/8

 

How to achieve this ?

Hello,

you should add some details

 

What type of route is 10.0.0.0/8

 

O   = OSPF intra area

O IA = OSPF inter area

 

O E1 = external type 1

O E2 = eternal type 2

 

This information is important because depending on the type of route you can perform some actions or not.

 

OSPF is link state so there are no easy way to tweak the metric of a route. (no support for offset-lists for example). Also route filtering with a distribute-list applies only to routing table not to OSPF database.

 

Hope to help

Giuseppe

 

Thanks. Will gather the details & will share.

In parallel would like to check with you what is the recommended & the best way to achieve this.

Adding to @Giuseppe Larosa  we need to have some information and configuration and your OSPF routing table on all devices, so we can understand how is your DC configured. 

 

Things possible but only can be advised based on the inputs.

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello RS19,

LSA type 5 for external routes are flooded in the whole OSPF domain.

Only the LSA owner can change/update the LSA, all other routers have to pass it unchanged.

 

However, OSPF external routes are of two types:

O E2 (the seed metric is considered not comparable to internal metric). The OSPF O E2 metric is never changed in the OSPF domain.

O E1 (the seed metric is considered comparable to internal metric). In this case the seed metric is added to cumulated cost to reach the ASBR that generated the O E1 LSA type 5.

 

In your case, if both RA and RC are ASBR for network 172.16.0.0/16 you should :

Use metric of type O E1. Use a lower seed metric on the router that should provide the primary path to the prefix.

Use an higher seed metric of type O E1 on the router that acts as secondary exit point for the prefix.

Note: O E1 routes are preferred over O E2 regardless of the metric value

 

ip prefix-list E1-routes permit 172.16.0.0/16

ip prefix-list E2-routes permit 10.0.0.0/8

route-map RED-INTO-OSPF permit 10

match address prefix E1-routes

set metric 100

set metric-type 1

!

route-map RED-INTO-OSPF permit 20

match address prefix E2-routes

set metric 100

set metric-type 2

!

router ospf

redistribute static route-map RED-INTO-OSPF subnets

 

Similar setup can be perfomed on RC using an higher seed metric.

 

However, as noted by Balaji if RC is not an ASBR an exit point for prefix 172.16.0.0/16 all this is not feasible.

 

Hope to help

Giuseppe

 

Thanks. Will gather the details & will share.

In parallel would like to check with you what is the recommended & the best way to achieve this.

 

The route 10.0.0.0/8 will be  O IA = OSPF inter area

Hello,

so the 10.0.0.0/8 is an O IA route.

To make from location A the path via DC2 preferred you can:

 

a) increase the OSPF cost on the link towards DC1 on Location A. Note this will have an impact on all routes learned by DC1 not only on the prefix 10.0.0.0/8.

 

interface <Link LocationA to DC1>

ip ospf cost 1000

 

b) if you still want to have some routes learned via DC1 on location A you should use PBR applied to internal interface in location A.

ip access-list 101 permit ip any 10.0.0.0 0.255.255.255

 

route-map PBR permit 10

match address 101

set ip next-hop <IP-address-to-DC2>

 

interface <internal-interface-Location-A>

ip policy route-map PBR

 

As I have explained before it is not possible to change the metric for a single route in OSPF like we can do in distance vector protocols like RIPv2 or in EIGRP.

As a result of this you may need to use option B with PBR.

Option A is good if you want to use DC2 for all routes as changing the OSPF cost impacts all routes learned by DC1.

 

Hope to help

Giuseppe

 

Thanks.

I don't want the entire network to flow through DC 1, I want to look at option 2

but in option 2 how will the failover will happen when DC 1 fails which is the next hop ?

 

I understand that metric can not be changed. Is it possible to achieve with distance.

For ex - I will set the administrative distance greater than ospf  only for the particular route.

Is it possible ?

 

what is the best option to achieve this ?

 

 

Hello RS19,

you are thinking of the distance command with the following options as described here

 

https://www.cisco.com/c/en/us/td/docs/ios/iproute_pi/command/reference/iri_book/iri_pi1.html

 

However, for OSPF the route source is the OSPF RID of the advertising router owner of the summary LSA type 3 for prefix 10.0.0.0/8.

So you need to check first the ip ospf database using

 

show ip ospf database summary 10.0.0.0

to see the details

And to see if there are two different LSAs originated by different routers for the prefix.

 

distance distance ip-address wildcard-mask [ip-standard-acl | ip-extended-acl | access-list-name]

 

 

I never tried to use this command with OSPF. It can work if two different LSA type 3 exist for the same prefix.

 

See the following description of the command actions:

 

>> When the optional access list name is used with this command, it is applied when a network is being inserted into the routing table. This behavior allows filtering of networks according to the IP address of the router that supplies the routing information. This option could be used, for example, to filter possibly incorrect routing information from routers that are not under your administrative control.

 

All examples I have seen of this command uses it with RIPv2  or EIGRP where the route source = the next-hop of the route.

 

You can try the command to see if it works with OSPF.

In any case AD manipulation is local: it is not propagated to other routers.

 

Edit:

I have found an example of use with OSPF in a book for CCIE.

I can confirm that the ip address must refer to the OSPF RID of the LSA for prefix 10.0.0.0/8 as I have explained above.

However, in that example the command is used to make some specific routes have an AD 179 greater then RIP AD 120 because it is a scenario with redistribution.

So even if two different LSAs type 3 exist for the prefix I am not sure that the command makes OSPF to choice the other one..

If OSPF first picks the best LSA and then applies the distance command the final result is just an increase of the AD for the prefix and not the use of the other LSA generated by another OSPF router.

 

Hope to help

Giuseppe

 

Thanks for your explanation.

So even if I was able to change the distance it will be local to the DC 2 router.

Does redistribution needs to be configured in DC 2 router to redistributed the higher distance route into OSPF ?

Is this the right solution ?

 

What are the other options would you recommend.

Is it possible to configure some kind of policy based routing in Location B R2 router to achieve this ?

R2 in location receives route from both DC1 & DC2. 

 

If some kind of policy can be configured in R2 so that it will always prefer the route for 10.0.0.0/8 from DC1.

Only when DC1 is down it will route to DC2 ?

Is there any way i can achieve this by configured in Location B router rather in DC router.

 

Hello RS19,

follow my previous post about the use of PBR on Location B router to send traffic destined to 10.0.0.0/8 only via one datacenter instead of performing load balancing.

 

>>So even if I was able to change the distance it will be local to the DC 2 router.

Does redistribution needs to be configured in DC 2 router to redistributed the higher distance route into OSPF ?

Is this the right solution ?

 

all of my notes are based on your network diagram  and all configuration that I have proposed like PBR and distance manipulation refer to the router(s) in location B as per your network diagram. Nothing can be done either in DC1 either in DC2.

You are not using redistribution because the route is O IA inter area for prefix 10.0.0.0/8.

My understanding is that you want Location B to reach network 10.0.0.0/8 using only one of the paths via DC1 (or DC2 this does not matter).

 

>>Is it possible to configure some kind of policy based routing in Location B R2 router to achieve this ?

R2 in location receives route from both DC1 & DC2.

 

Yes, PBR should be used on Location B R2 router as explained in my previous post in this thread (it is not the last one re read the thread and you will find it)

 

>>

If some kind of policy can be configured in R2 so that it will always prefer the route for 10.0.0.0/8 from DC1.

Only when DC1 is down it will route to DC2 ?

 

Yes, PBR configured on R2 will revert to destination based routing if the next-hop to DC1 fails.

Note: you may need an IP SLA to check the availability of the next hop, depending on the type of service between Location B and the two datacenter sites.

 

Hope to help

Giuseppe

 

Review Cisco Networking for a $25 gift card