cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3650
Views
2
Helpful
23
Replies

OSPF path selection

Donia
Level 1
Level 1

Hello 

I have a problem that i am receiving prefix on a router with ospf from 2 direction ( primary/ backup ) devices and it should be preferred using metric in the redistribution statement as below

the problem that the metric isn't seen in the router and load balancing is done and i don't know why it is happening

R3#sh ip route ospf | s 10.0.0.0 
10.0.0.0/8 is variably subnetted, 34 subnets, 8 masks
O E2 10.0.0.0/8 [110/2] via R1, 05:20:52, GigabitEthernet2/0/0
                          [110/2] via R2, 7w0d, GigabitEthernet1/0/0

 

R1 configuration 

 

router ospf 1

summary-address 10.0.0.0 255.0.0.0
summary-address 172.16.0.0 255.240.0.0
summary-address 192.168.0.0 255.255.0.0 

redistribute bgp AS metric 200 subnets route-map TO-OSPF

route-map TO-OSPF permit 10
match ip address prefix-list TO-OSPF

ip prefix-list TO-OSPF seq 5 permit 10.0.0.0/8 le 32
ip prefix-list TO-OSPF seq 10 permit 172.16.0.0/12 le 32
ip prefix-list TO-OSPF seq 15 permit 192.168.0.0/16 le 32


R2 Configuration:

 

router ospf 1

summary-address 10.0.0.0 255.0.0.0
summary-address 172.16.0.0 255.240.0.0
summary-address 192.168.0.0 255.255.0.0

redistribute bgp AS metric 100 subnets route-map TO-OSPF

route-map TO-OSPF permit 10
match ip address prefix-list TO-OSPF

ip prefix-list TO-OSPF seq 5 permit 10.0.0.0/8 le 32
ip prefix-list TO-OSPF seq 10 permit 172.16.0.0/12 le 32
ip prefix-list TO-OSPF seq 15 permit 192.168.0.0/16 le 32


from the above configuration R3 should prefer route from R2  which has metric 100 but it isn't the result i got from R3

however if i check another subnet like 192.168.0.0

 

R3#sh ip route ospf | s 192.168.0.0

O E2 192.168.0.0/16 [110/100] via R2, 6w6d, GigabitEthernet1/0/0

can anyone tell me why the metric is changed on subnet 10.0.0.0 however it is ok for subnet 192.168.0.0

 

 

2 Accepted Solutions

Accepted Solutions

Hi @Donia  ,

The fact that you are seeing the metric 2 instead of the metric 100 or 200 for the 10/8 summary route is due to the fact that you are redistributing from multiple sources (bgp and ospf 2). The lower metric coming from ospf 2 is used instead of the metric 100/200 from the

redistribute bgp

statements.

Regards,

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

View solution in original post

Hi,

there will not be LSA for subset routes in OSPF DB of process 1, because you do summarization (you have only summary route LSA in DB).

route-map NETWORKS doesn't have 10.0.0.0/8 as an entry but other 10.x.x.x/18 le 32

So, it is possible that routes from this route-map is considered in summarization. Check routes in OSPF process 2 rib:

show ip ospf 2 rib | inc 10.

 

HTH,
Please rate and mark as an accepted solution if you have found any of the information provided useful.

View solution in original post

23 Replies 23

balaji.bandi
Hall of Fame
Hall of Fame

You need to post full configuration and interface config ? what is connected interface and peer configuraiton ?

 

BB

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

How to Ask The Cisco Community for Help

Harold Ritter
Spotlight
Spotlight

Hi @Donia  ,

The configuration looks good. It is possible that the summary was redistributed before the configuration was applied. You could do a

clear ip ospf redistribution

on R1 and R2 to force the redistribution and see if it solves the issue.

Regards,

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

redistribute bgp AS metric 100 subnets route-map TO-OSPF <<-


metric is appear only in eBGP not in iBGP so if the BGP you run is iBGP this method can not help you 
instead change the cost to iBGP peer and this make R3 prefer one path than other 

it is EBGP not IBGP and the routemap has 3 prefixes one of them has the problem and others appear with the correcr metric ( 100/200) as below from R3

R3#sh ip ospf database external 10.0.0.0




            OSPF Router with ID () (Process ID 1)




                Type-5 AS External Link States




  LS age: 1693
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.0.0 (External Network Number )
  Advertising Router: R2
  LS Seq Number: 8000C51A
  Checksum: 0x7274
  Length: 36
  Network Mask: /8
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 2 
        Forward Address: 0.0.0.0
        External Route Tag: 0




  LS age: 394
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.0.0 (External Network Number )
  Advertising Router: R1
  LS Seq Number: 80000097
  Checksum: 0xB07A
  Length: 36
  Network Mask: /8
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 2 
        Forward Address: 0.0.0.0
        External Route Tag: 0




R3#sh ip ospf database external 192.168.0.0




            OSPF Router with ID () (Process ID 1)




                Type-5 AS External Link States




  LS age: 717
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 192.168.0.0 (External Network Number )
  Advertising Router: R2
  LS Seq Number: 8000081A
  Checksum: 0x548E
  Length: 36
  Network Mask: /16
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 100 
        Forward Address: 0.0.0.0
        External Route Tag: 0




  LS age: 1426
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 192.168.0.0 (External Network Number )
  Advertising Router: R1
  LS Seq Number: 80000048
  Checksum: 0xE370
  Length: 36
  Network Mask: /16
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 200 
        Forward Address: 0.0.0.0
        External Route Tag: 0

can you share 


show ip bgp 10.0.0.0 255.0.0.0 <<-

i don't have 10.0.0.0/8  in BGP but i have alot of 10.x.x.x subnets as below so i didn't check

sh ip bgp

 

R1#sh ip route  10.0.0.0

Routing entry for 10.0.0.0/8, 438 known subnets
Attached (6 connections)
Variably subnetted with 16 masks

O 10.0.0.0/8 is a summary, 3d17h, Null0
B 10.0.152.158/32 [20/0] via PE, 02:03:33
B 10.2.0.0/16 [20/0] via PE, 02:03:33
B 10.1.153.152/30 [20/0] via PE, 02:03:33
B 10.1.153.232/30 [20/0] via PE, 02:03:33
B 10.1.54.152/30 [20/0] via PE, 02:03:33
B 10.1.54.232/30 [20/0] via PE, 02:03:33

R2#sh ip route 10.0.0.0

Routing entry for 10.0.0.0/8, 438 known subnets
Attached (6 connections)
Variably subnetted with 16 masks
O 10.0.0.0/8 is a summary, 7w0d, Null0
B 10.0.152.158/32 [20/0] via PE, 4d04h
B 10.2.0.0/16 [20/0] via PE, 6w6d
B 10.1.153.152/30 [20/0] via PE, 6w6d
B 10.1.153.232/30 [20/0] via PE, 6w6d
B 10.1.54.152/30 [20/0] via PE, 6w6d
B 10.1.54.232/30 [20/0] via PE, 6w6d
B 10.1.100.0/25 [20/0] via PE, 6w6d


Hi @Donia  ,

Did you try using the

clear ip ospf redistribution

on R1 and R2 to see if it fixes the issue?

Regards,

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

i didn't try to do that as i afraid it will impact the service. i am trying before doing that to check if there is any problem / misconfiguration.

@Donia  , it makes sense. Other than bgp, do you redistribute from any other source into ospf?

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

Hi,

normally, while summarizing lowest metric is chosen for summary route from the all prefixes that is covered by summary route.

Based on your output, summary route's metric is 2

(see show ip route or sh ip ospf database external 10.0.0.0 in R3),

so there should be route with this metric (metric 2). Let's try to find it on R1 or R2. Do

sh ip route 10.0.0.0 | include /2]

and question: is it possible to share

show run | sec ospf

from R1 or R2?

HTH,
Please rate and mark as an accepted solution if you have found any of the information provided useful.

Hi @Kanan Huseynli ,

That is a good point. It could be that some 10/8 subnets are redistributed from other sources other than bgp with a metric set to 2, which would cause the behavior you are describing.

 The best way to avoid this issue would be to set the external type to 1 on the primary router and to 2 on the secondary. The external type 1 is always preferred over external type 2, no matter the metric it carries.

Regards,

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

ok i will try to change primary router to be E1 and check but in this case i think there is no need for metric 100/ metric 200

i will depend only on the Type E1 ( primary) /secondary Default which will be E2  correct ?

 @Donia    , since you redistribute from bgp and ospf, setting the external type to E1 on the redistribute bgp statement will not be sufficient. The default E2 on the redistribute ospf 2 statement will be used. The way around this would be to set the metric-type to E1 on the redistribute ospf 2 as well.  It would look something like this:

Primary router:

router ospf 1

redistribute ospf 2 subnets metric-type 1 route-map NETWORKS
redistribute bgp AS subnets metric-type 1 route-map TO-OSPF

 

And yes, you are correct. By setting the E1 on the primary router, you will not need the 100/200 metric anymore.

Regards,

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

I tried to check the routing table but didn't see any other route with metric 2 just other subnets from BGP and also i checked OSPF database to be sure if i am receiving this subnet from other place or not but in the database i just find it on R1/ R2 as Adv routers

i am redistributing BGP routes also redistributing other ospf process as below

router ospf 1 
summary-address 10.0.0.0 255.0.0.0
summary-address 172.16.0.0 255.240.0.0
summary-address 192.168.0.0 255.255.0.0
redistribute ospf 2 subnets route-map NETWORKS
redistribute bgp AS metric 100 subnets route-map TO-OSPF
default-information originate metric 100
distribute-list route-map Filter_Routes in

 

please note that route-map NETWORKS doesn't have 10.0.0.0/8 as an entry but other 10.x.x.x/18 le 32 and other public Ips and also

 route-map Filter_Routes 

is used to avoid any loops