OSPF-BGP redistribution

Answered Question
Apr 1st, 2010
User Badges:


Hi

R1 takes backup link to reach R2 rather than MPLS route. On R1 there is mutual redistribution of OSPF with BGP.
Diagram on the setup is attached. Any clue


cheers

RR

Attachment: 
Correct Answer by Giuseppe Larosa about 7 years 1 month ago

Hello Ronald,


testing on a C6500:


red ospf 200 metric ?
  <0-16777214>  OSPF default metric


red ospf 200 metric 40000
% Only classful networks will be redistributed


so we need to use the subnets keyword


we set a metric in addition to using metric type O E2 (default) the idea is to make external routes coming from eBGP sessions preferred.


this is just an additional security measure if setting metric-type to 1 in redistributing BGP into main OSPF process you should be fine


red ospf 200 ?
  match        Redistribution of OSPF routes
  metric       Metric for redistributed routes
  metric-type  OSPF/IS-IS exterior metric type for redistributed routes
  route-map    Route map reference
  subnets      Consider subnets for redistribution into OSPF
  tag          Set tag for routes redistributed into OSPF
  vrf          VPN Routing/Forwarding Instance


the exact syntax should be

red bgp ASN metric-type 1 subnets


into main OSPF process (OSPF PID 10)


Hope to help

Giuseppe

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
Jon Marshall Thu, 04/01/2010 - 08:46
User Badges:
  • Super Blue, 32500 points or more
  • Hall of Fame,

    Founding Member

  • Cisco Designated VIP,

    2017 LAN, WAN

Ronald


Is there mutual distribution on R2 as well.


Can you pick a route on R1 that should be going via MPLS but is going via R2 and post"sh ip route


Jon

ronald.ramzy Thu, 04/01/2010 - 09:09
User Badges:

Jon,


There is mutual registribution on R2.

Backup Link is T1 point to point hence R1 is considering this link to reach R2. Result of traceroute shows all routes taking backup route.

I think something to do with InterArea and Intra Area


cheers

RR

Jon Marshall Thu, 04/01/2010 - 09:10
User Badges:
  • Super Blue, 32500 points or more
  • Hall of Fame,

    Founding Member

  • Cisco Designated VIP,

    2017 LAN, WAN

Ronald


It's going to be difficult to help without seeing routes. As requested already can you post a route example.


Jon

ronald.ramzy Thu, 04/01/2010 - 10:03
User Badges:

Jon,


From R1 I need to reach 10.10.10.0/23 network on R2



R1#sh ip route 10.10.10.0
Routing entry for 10.10.10.0/23
  Known via "ospf 10", distance 110, metric 2, type intra area
  Redistributing via bgp 7190
  Advertised by bgp 7190
  Last update from 192.168.200.2 on GigabitEthernet0/1, 02:34:26 ago
  Routing Descriptor Blocks:
  * 192.168.200.2, from 192.168.200.1, 02:34:26 ago, via GigabitEthernet0/1
      Route metric is 2, traffic share count is 1



Is this input you needed


cheers

RR

Jon Marshall Thu, 04/01/2010 - 10:09
User Badges:
  • Super Blue, 32500 points or more
  • Hall of Fame,

    Founding Member

  • Cisco Designated VIP,

    2017 LAN, WAN

Ronald


Your original problem was that you wanted to go via MPLS but you were going via R2. So why have you sent me an example of a route you want to go via R2 for ?


Can you choose a destination subnet that is reachable across the MPLS network.


Then on R1 & R2 can you do "sh ip route "  and post results.


Can you also post the bgp/ospf configs from both PE routers indicating which one is connected to which R router.


Finally can you post the ospf config from both R routers.


Jon

ronald.ramzy Thu, 04/01/2010 - 16:23
User Badges:

jon,


its misunderstanding, all traffic for R2 initiating from R1 should take MPLS as primary route and Backup link as secondary route.

R1 and R2 config is attached


cheers

RR

lamav Thu, 04/01/2010 - 20:46
User Badges:
  • Blue, 1500 points or more

Ronald:


Im sorry, but most of what you are saying is not making any sense.


First, your diagram shows OSPF between your CE and PE. But the configs suggest BGP as the peer routing protocol.


Second, the drawing should show that the PE is part of the MPLS cloud, not outside it.


Third, why would you want traffic that is destined for R2 to go from R1 and then through the MPLS cloud when it can take a direct route through the p2p link? It doesnt make sense.


Fourth, OSPF routes that are redistributed into BGP at R2 and then redistributed back into OSPF at R1 will be considered external routes. Whereas the OSPF subnets learned through the direct link will be internal. Internal routes are favored by OSPF regardless of the cost. The order is intra-area, inter-area, external type 1 then external type 2.


Fifth, if you are running mutual redistribution at both routers, you need to use some filtering to prevent routing loops.


HTH


Victor

Giuseppe Larosa Thu, 04/01/2010 - 23:50
User Badges:
  • Super Silver, 17500 points or more
  • Hall of Fame,

    Founding Member

Hello Ronald,

the R1 and R2 routers should be the routers that you have called PE in the network diagram.

I agree that something is not clear, but I think you see the trouble on other devices on the site that prefers the backup link over the MPLS link.


From the point of view of internal routers that you call CE nodes the direct link T1 is preferred path if it provides internal routes (intra-area or inter-area) for the OSPF hierarchy of route types.


The only way to make the external routes coming from R1,R2 preferred is to make the routes coming on the T1 link external routes too.

O E1 routes are preferred over O E2 regarless of metric value.

O E2 is the default type.


so you need a second OSPF process that will be running only on the T1 link and that will redistribute primary OSPF process




router ospf 10
log-adjacency-changes
redistribute bgp 7190 subnets metric-type 1
network 192.168.200.0 0.0.0.3 area 0
network 1.1.1.1 0.0.0.0 area 0
network 11.11.11.11 0.0.0.0 area 0
network 192.168.1.0 0.0.0.255 area 0
network 192.168.2.0 0.0.0.255 area 0
network 192.168.3.0 0.0.0.255 area 0



on CE nodes

router ospf 200

network 192.168.x.y 0.0.0.3 area 0

red  ospf 10 metric 40000 subnets

!


where the network command is related to the T1 link



otherwise if R1 and CE are the same device the problem is the level of specific routes coming on the BGP session:

same prefix length eBGP route is preferred for its lower AD

on other devices the OSPF internal route is preferred for the reasons described above.


Hope to help

Giuseppe


Edit:

corrected syntax of ref bgp in main process

ronald.ramzy Fri, 04/02/2010 - 03:55
User Badges:

Thank you Giuseppe for the reply.

Yes you are correct the diagram labels were incorrect, sorry about this.

I modified the config to make it simple to be more focus on issue, but seems it become unclear


CE is the backbone router  ( For us the backbone and distribution are the same )

PE is the service provider link termination router ( R1 and R2 are PE routers )


When users behind CE wants to reach a subnet behind R2 it preferrs the backup link rather than MPLS Cloud


Can you explain this line "metric 40000"  How do you get this!!

red  ospf 10 metric 40000 subnets

Correct Answer
Giuseppe Larosa Fri, 04/02/2010 - 04:53
User Badges:
  • Super Silver, 17500 points or more
  • Hall of Fame,

    Founding Member

Hello Ronald,


testing on a C6500:


red ospf 200 metric ?
  <0-16777214>  OSPF default metric


red ospf 200 metric 40000
% Only classful networks will be redistributed


so we need to use the subnets keyword


we set a metric in addition to using metric type O E2 (default) the idea is to make external routes coming from eBGP sessions preferred.


this is just an additional security measure if setting metric-type to 1 in redistributing BGP into main OSPF process you should be fine


red ospf 200 ?
  match        Redistribution of OSPF routes
  metric       Metric for redistributed routes
  metric-type  OSPF/IS-IS exterior metric type for redistributed routes
  route-map    Route map reference
  subnets      Consider subnets for redistribution into OSPF
  tag          Set tag for routes redistributed into OSPF
  vrf          VPN Routing/Forwarding Instance


the exact syntax should be

red bgp ASN metric-type 1 subnets


into main OSPF process (OSPF PID 10)


Hope to help

Giuseppe

Actions

This Discussion