Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Community Member

Question around OSPF and BGP routes.

I come across with two scenario during my lab preparation and I could not understand. Can someone please help me to elobrate?

Scenario 1:

WAN1-- LAN1 -- LAN2 -- WAN2

WAN1 <BGP> LAN1 - WAN AS number 1234

LAN1<OSPF>LAN2

LAN2<BGP>WAN2 - WAN AS number 5678

routes 10.1.1.0/24 advertise from WAN1 and WAN2.

LAN1 and LAN2 perform mutual redistirbution.

10.1.1.0/24 rotues in WAN1 to LAN1. I can see that routes into LAN2 without any issue. However,WAN2 is also advertising same routes which I can't see in received routes or in BGP table of LAN2.

Any reason for that?

When I disconnect the link between LAN1 and WAN1, same routes from WAN2 appears fine without any configuration change. so my second link starts working.

Now when my primary link restore which is WAN1. I can't see WAN1 routes now not eve LAN1's BGP table. I have to manually reset LAN2 and WAN2 get WAN1 routes back in the network any reason????? any fix ????

Scenario 2:

LAN - WAN (BGP)

LAN is running OSPF with mutual redistribution.

LAN is learning route 10.71.0.0/16 from BGP neighbour.

LAN has also a summery route comfigure in OSPF

summary-address 10.71.0.0 255.255.0.0 tag 70

I have configured route map on redistirbution to deny TAG 70 from redistributing into BGP.

I can see routes learnin from WAN router with proper next hope and same routes in routing table and life is good.

Now when I remove WAN link, routing table is showing summary rotue with null0 as expected which was configured in OSPF.

When WAN link restore back, I can't see any routes learning from BGP 10.71.0.0/16 any more and still everything is pointing to null 0 as it was in routing table.

I have to remove summary route from OSPF. Which helps router to learn BGP routes fine.

Once that done life is back.

Any reason for this behaviour. I am confused.

Please let me know if you need more information.

Everyone's tags (5)
2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Member

Re: Question around OSPF and BGP routes.

OK. Thanks for schemes.

SCENARIO 1:

First, we must to check whether router WAN 2 advertises mentioned routes to router LAN 2 in situation when all links connected.

Can you provide me outputs of some commands at router LAN 2 (when all links connected). They are:

1. show ip route

2. show ip bgp

3. show ip route bgp

4. show ip bgp neighbors 203.152.200.1 received-routes

In order to get a output from last commands, you must configure next command in BGP configuration mode: neighbor 203152.200.1 soft-reconfiguration inbound and restet a BGP session on LAN 2 (clear ip bgp * in).

Best Regards,
Ognjen

Best Regards, Ognjen
Community Member

Re: Question around OSPF and BGP routes.

1) Yes you are right that LAN 2 is learning 10.1.1.0/24 but at the  same time I am also advertising 20.20.20.0/24 as Loop back of WAN1 via  BGP. and LAN2 is not learning that route. It only learns that route once  OSPF will stop redistributing to BGP on LAN 2.

As I can see from your command output, the prefix 20.20.20.0/24 there is into the BGP table and routing table of LAN 2 router. It is redistributed by OSPF and next hop for it is 192.168.1.2

O E2    20.20.20.0 [110/1] via 192.168.1.2, 00:06:54, Ethernet0/0

   Network          Next Hop            Metric LocPrf Weight Path

*> 20.20.20.0/24    192.168.1.2              1         32768 ?

Now, why that route is not advertised from BGP neigbor WAN 2?

Can you provide me command outputs from WAN2:

-show ip bgp

-show ip route

-show ip bgp neighbor x.x.x.x received-routes where x.x.x.x is IP address of BGP neighbor (in cloude at the your scheme)

2)  I am redistributing BGP routes in OSPF on LAN1 as E2 while BGP routes  in OSFP on LAN2 as E1. As per my understanding E2 take precedence over  E1. If LAN1 restores connectivity to WAN1 and start learning routes it  should redistribute into OSPF as E2 and it took presecedence. Or it will  not beacuse it is not best route as per weight and BGP only  redistribute best routes ?

In situation when there are two sources of routes (two routing  protocols), routing protocols that has better Administrative Distance  has precedence. In your case, BGP has AD 20 but OSPF has 110, so routes  from BGP have precedence.

OSPF routes (regardless if they E1 or E2) was redistributed in BGP table also. They are and routes from BGP because they are into BGP table.

It does not matter whether these routes E1 or E2 if they are redistributed into the BGP table.

When WAN 1 link is down, in routing table of LAN 2 there are on ly routes advertised from WAN 2 and they are the best routes. When WAN 1 restore back link, in routing table of LAN 2 there are both BGP routes advertised from WAN 2 and redistributed by OSPF. Routes redistributed by OSPF have higher WEIGHT parameter and they are the best routes.

Otherwise, BGP selects routes based on their parameters in order of importance. On this link you can find more details about it

http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094431.shtml

3)  If the decesion is taking place due to higher weight and weight is the  first parameter for the BGP to find out the best route then can you  please advise me what is the best way to get automatic changes in best  route when LAN1 restores connectivity back?

In situation when WAN 1 link is down, in BGP table of LAN 2 the best prefixes and only are prefixes redistributed by WAN 2.

When LAN 1 restores connectivity back, LAN 2 learns prefixes from him (redistributed by OSPF). Routes redistributed by OSPF have higher WEIGHT parameter and they are the best routes

4)  if I do not match external 1 and external 2 of OSPF redistribution on  LAN2 then the behaviour is different. LAN2 BGP routes alwayse takes  precedence over LAN1. If LAN2 loose connectivity to WAN2 then LAN1 BGP  routes redistributes fine but when WAN2 comes in the action it  automatically take precedence without any changes of configuration. Is  there any reson for this behaviour? What can I do to achive same kind of  behaviour with LAN1 and match exteranl 1 and exteranl 2 on both the  routers?

It is easy for understand. In command redistribute ospf 1 match internal external 1 external 2, if you don't match external 1 and external 2, that command is redistribute ospf 1 match internal.

In this situation only internal OSPF routes redistributed to BGP on LAN 2 (with no those routes which redistributed in LAN 1 by WAN 1). Then, in BGP table of LAN 2 there are ony prefixes redistributed from WAN 2 so they are only routes for those prefixes.

Best Regards,
Ognjen

Best Regards, Ognjen
12 REPLIES
Community Member

Question around OSPF and BGP routes.

It is difficult to understand this without graphical display. Can you upload both scenario 1 and scenario 2 (with IP address plans) as graphic shema?

BR,

Ognjen

Best Regards, Ognjen
Community Member

Question around OSPF and BGP routes.

Above is the scenario 1 .. I hope you can read it fine.

Avove is the scenario -2 I hope you can read it fine.

Please let me know if you need more info as this is just lab so I am fine with informatio.

Community Member

Re: Question around OSPF and BGP routes.

OK. Thanks for schemes.

SCENARIO 1:

First, we must to check whether router WAN 2 advertises mentioned routes to router LAN 2 in situation when all links connected.

Can you provide me outputs of some commands at router LAN 2 (when all links connected). They are:

1. show ip route

2. show ip bgp

3. show ip route bgp

4. show ip bgp neighbors 203.152.200.1 received-routes

In order to get a output from last commands, you must configure next command in BGP configuration mode: neighbor 203152.200.1 soft-reconfiguration inbound and restet a BGP session on LAN 2 (clear ip bgp * in).

Best Regards,
Ognjen

Best Regards, Ognjen
Community Member

Re: Question around OSPF and BGP routes.

Show IP route

LAN2#sh ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C    203.152.200.0/24 is directly connected, Ethernet0/2

     20.0.0.0/24 is subnetted, 1 subnets

O E2    20.20.20.0 [110/1] via 192.168.1.2, 00:06:54, Ethernet0/0

     10.0.0.0/24 is subnetted, 1 subnets

O E2    10.1.1.0 [110/1] via 192.168.1.2, 00:06:55, Ethernet0/0

C    192.168.1.0/24 is directly connected, Ethernet0/0

O    192.168.2.0/24 [110/20] via 192.168.1.2, 00:56:45, Ethernet0/0

Sh ip bgp

LAN2#sh ip bgp

BGP table version is 24, local router ID is 203.152.200.2

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path

*  10.1.1.0/24      203.152.200.1                          0 4072 7213 i

*>                  192.168.1.2              1         32768 ?

*> 20.20.20.0/24    192.168.1.2              1         32768 ?

*> 192.168.1.0      0.0.0.0                  0         32768 ?

*> 192.168.2.0      192.168.1.2             20         32768 ?

LAN2#sh ip route bgp

LAN2#

LAN2#sh ip bgp neig 203.152.200.1 received-routes

BGP table version is 24, local router ID is 203.152.200.2

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path

*  10.1.1.0/24      203.152.200.1                          0 4072 7213 i

Total number of prefixes 1

LAN2#

______________________-----------------------------------------

- Pleae note all the output is from LAN 2..

- I have changed BGP AS number .. sorry for that.

- There is someother  configuration you may be interested so I have past that in the below output

- I have added another looop back which is 20.20.20.0/24 on WAN1 which is implecating  an issue.. as 10.1.1.0/24 has the same number of hopes so it is learning fine but 20.20.20.0/24 originated from WAN1 so it is not learning.

____________________________________

-------------------------------------------------------------- LAN 1 -----------------------------------------------------------------

LAN1#sh run | sec ospf

router ospf 1

log-adjacency-changes

redistribute bgp 7980 metric 1 subnets

network 192.168.2.0 0.0.0.255 area 0

redistribute ospf 1 match internal external 1 external 2

LAN1#sh run | sec bgp

redistribute bgp 7980 metric 1 subnets

router bgp 7980

no synchronization

bgp log-neighbor-changes

redistribute ospf 1 match internal external 1 external 2

neighbor 202.152.150.1 remote-as 4621

neighbor 202.152.150.1 soft-reconfiguration inbound

no auto-summary

LAN1#

-------------------------------------------------------    LAN 2   ---------------------------------------------------------------------

LAN2#sh run | sec ospf

router ospf 1

log-adjacency-changes

redistribute bgp 5172 metric 20 metric-type 1 subnets

network 192.168.1.0 0.0.0.255 area 0

redistribute ospf 1 match internal external 1 external 2

LAN2#sh run | sec bgp

redistribute bgp 5172 metric 20 metric-type 1 subnets

router bgp 5172

no synchronization

bgp log-neighbor-changes

redistribute ospf 1 match internal external 1 external 2

neighbor 203.152.200.1 remote-as 4072

neighbor 203.152.200.1 soft-reconfiguration inbound

no auto-summary

LAN2#

_____________________________

Redistribution is External type 1 from LAN 2 and external type 2 from LAN 1

During My exersies I come across with another behaviour which I can't understand.. but I will get explanation for this one first and then I will ask for second behaviour..

Thanks a lot for helping me to understand the basics of the redistribution.. Much more appreciated..

Purple

Re: Question around OSPF and BGP routes.

Hi,

1) 10.1.1.0/24 rotues in WAN1 to LAN1. I can see that routes into LAN2 without any issue. However,WAN2 is also advertising same routes which I can't see in received routes or in BGP table of LAN2.

From following outputs they are both there in BGP table, so what is the problem  ?

LAN2#sh ip bgp

BGP table version is 24, local router ID is 203.152.200.2

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path

*  10.1.1.0/24      203.152.200.1                          0 4072 7213 i  from WAN2

*>                  192.168.1.2              1         32768 ?   redistributed route that came from WAN1

*> 20.20.20.0/24    192.168.1.2              1         32768 ?

*> 192.168.1.0      0.0.0.0                  0         32768 ?

*> 192.168.2.0      192.168.1.2             20         32768 ?

2)

When I disconnect the link between LAN1 and WAN1, same routes from WAN2  appears fine without any configuration change. so my second link starts  working.

this is normal behaviour as now LAN1 can't learn this prefix from WAN1 anymore so it is not redistributed into OSPF anymore and so not redistributed into BGP on LAN2 anymore but it is learned via eBGP from WAN 2 and installed as so into LAN2 which redistributes into OSPF to LAN1 which redistributes to WAN1.

3)

Now when my primary link restore which is WAN1. I can't see WAN1 routes  now not eve LAN1's BGP table. I have to manually reset LAN2 and WAN2 get  WAN1 routes back in the network any reason????? any fix ????

WAN1 won't readvertise this route back to LAN1  but if LAN2 is reset then LAN1 can't redistribute this prefix to WAN1 anymore as it is not in the OSPF

database anymore so WAN1 can advertise it via eBGP.

Regards.

Alain

Don't forget to rate helpful posts.

Don't forget to rate helpful posts.
Community Member

Re: Question around OSPF and BGP routes.

As you can see, into BGP table LAN2 router's there are two prefixes for subnet 10.1.1.0/24. One prefix that advertised by WAN2 router and another prefix that redistributed into BGP by OSPF.

The best prefix from BGP table installed in routing table. It's a prefix that redistributed by OSPF because it has highest Cisco WEIGHT parameter.

When link between WAN1 and LAN1 break, LAN1 can not redistribute in OSPF prefixes from WAN1, so prefix from WAN2 becomes the best in BGP table of LAN2 and traffic to 10.1.1.0 routes to WAN2.

As you can see, selection the best route performed based on BGP parameters. If you want to change such behavior, you can it by changing BGP parameters (WEIGHT, LOCAL_PREF, MED and etc). It can be done using tools as route maps.

Hope that I helped you.

In next day, I'll take a look and Scenario 2.

Best Regards,
Ognjen

Best Regards, Ognjen
Purple

Question around OSPF and BGP routes.

Hi,

The best prefix from BGP table installed in routing table. It's a prefix  that redistributed by OSPF because it has highest LOCAL_PREF parameter.

It is chosen because of highest weight(32768) not highest LOCAL_PREF.

Regards.

Alain

Don't forget to rate helpful posts.

Don't forget to rate helpful posts.
Community Member

Question around OSPF and BGP routes.

Yes, you're right. That's my fault. This is a WEIGHT parameter.

Thanks for the correction.

Best Regards,
Ognjen

Best Regards, Ognjen
Community Member

Re: Question around OSPF and BGP routes.

As I said previously, I took a look Scenario 2 ....

SCENARIO 2:

Before detailed troubleshooting, first you need simple do following:

-BGP router needs a few minutes to  converge. After you restore back WAN link, can you wait a few minutes to BGP finishes convergence?

-After a few minutes check BGP table again and then provide me an output from commands:

1. show ip route

2. show ip bgp

3. show ip bgp neighbors x.x.x.x received-routes, where x.x.x.x is IP address of BGP neighbor

Remember, to perform last command, you need previously configure command ip bgp neighbor x.x.x.x soft-reconfiguration inbound where x.x.x.x is IP address of BGP neighbor.

Best Regards,
Ognjen

Best Regards, Ognjen
Community Member

Re: Question around OSPF and BGP routes.

Thank you very much for your explanations. I still have some questions and love to understand that first before we will move to Scenario 2.

1) Yes you are right that LAN 2 is learning 10.1.1.0/24 but at the same time I am also advertising 20.20.20.0/24 as Loop back of WAN1 via BGP. and LAN2 is not learning that route. It only learns that route once OSPF will stop redistributing to BGP on LAN 2.

2) I am redistributing BGP routes in OSPF on LAN1 as E2 while BGP routes in OSFP on LAN2 as E1. As per my understanding E2 take precedence over E1. If LAN1 restores connectivity to WAN1 and start learning routes it should redistribute into OSPF as E2 and it took presecedence. Or it will not beacuse it is not best route as per weight and BGP only redistribute best routes ?

3) If the decesion is taking place due to higher weight and weight is the first parameter for the BGP to find out the best route then can you please advise me what is the best way to get automatic changes in best route when LAN1 restores connectivity back?

4) if I do not match external 1 and external 2 of OSPF redistribution on LAN2 then the behaviour is different. LAN2 BGP routes alwayse takes precedence over LAN1. If LAN2 loose connectivity to WAN2 then LAN1 BGP routes redistributes fine but when WAN2 comes in the action it automatically take precedence without any changes of configuration. Is there any reson for this behaviour? What can I do to achive same kind of behaviour with LAN1 and match exteranl 1 and exteranl 2 on both the routers?

Many thanks for helping me. I just want to get better understanding of this redistribution of OSPF and BGP..

Community Member

Re: Question around OSPF and BGP routes.

1) Yes you are right that LAN 2 is learning 10.1.1.0/24 but at the  same time I am also advertising 20.20.20.0/24 as Loop back of WAN1 via  BGP. and LAN2 is not learning that route. It only learns that route once  OSPF will stop redistributing to BGP on LAN 2.

As I can see from your command output, the prefix 20.20.20.0/24 there is into the BGP table and routing table of LAN 2 router. It is redistributed by OSPF and next hop for it is 192.168.1.2

O E2    20.20.20.0 [110/1] via 192.168.1.2, 00:06:54, Ethernet0/0

   Network          Next Hop            Metric LocPrf Weight Path

*> 20.20.20.0/24    192.168.1.2              1         32768 ?

Now, why that route is not advertised from BGP neigbor WAN 2?

Can you provide me command outputs from WAN2:

-show ip bgp

-show ip route

-show ip bgp neighbor x.x.x.x received-routes where x.x.x.x is IP address of BGP neighbor (in cloude at the your scheme)

2)  I am redistributing BGP routes in OSPF on LAN1 as E2 while BGP routes  in OSFP on LAN2 as E1. As per my understanding E2 take precedence over  E1. If LAN1 restores connectivity to WAN1 and start learning routes it  should redistribute into OSPF as E2 and it took presecedence. Or it will  not beacuse it is not best route as per weight and BGP only  redistribute best routes ?

In situation when there are two sources of routes (two routing  protocols), routing protocols that has better Administrative Distance  has precedence. In your case, BGP has AD 20 but OSPF has 110, so routes  from BGP have precedence.

OSPF routes (regardless if they E1 or E2) was redistributed in BGP table also. They are and routes from BGP because they are into BGP table.

It does not matter whether these routes E1 or E2 if they are redistributed into the BGP table.

When WAN 1 link is down, in routing table of LAN 2 there are on ly routes advertised from WAN 2 and they are the best routes. When WAN 1 restore back link, in routing table of LAN 2 there are both BGP routes advertised from WAN 2 and redistributed by OSPF. Routes redistributed by OSPF have higher WEIGHT parameter and they are the best routes.

Otherwise, BGP selects routes based on their parameters in order of importance. On this link you can find more details about it

http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094431.shtml

3)  If the decesion is taking place due to higher weight and weight is the  first parameter for the BGP to find out the best route then can you  please advise me what is the best way to get automatic changes in best  route when LAN1 restores connectivity back?

In situation when WAN 1 link is down, in BGP table of LAN 2 the best prefixes and only are prefixes redistributed by WAN 2.

When LAN 1 restores connectivity back, LAN 2 learns prefixes from him (redistributed by OSPF). Routes redistributed by OSPF have higher WEIGHT parameter and they are the best routes

4)  if I do not match external 1 and external 2 of OSPF redistribution on  LAN2 then the behaviour is different. LAN2 BGP routes alwayse takes  precedence over LAN1. If LAN2 loose connectivity to WAN2 then LAN1 BGP  routes redistributes fine but when WAN2 comes in the action it  automatically take precedence without any changes of configuration. Is  there any reson for this behaviour? What can I do to achive same kind of  behaviour with LAN1 and match exteranl 1 and exteranl 2 on both the  routers?

It is easy for understand. In command redistribute ospf 1 match internal external 1 external 2, if you don't match external 1 and external 2, that command is redistribute ospf 1 match internal.

In this situation only internal OSPF routes redistributed to BGP on LAN 2 (with no those routes which redistributed in LAN 1 by WAN 1). Then, in BGP table of LAN 2 there are ony prefixes redistributed from WAN 2 so they are only routes for those prefixes.

Best Regards,
Ognjen

Best Regards, Ognjen
Community Member

Question around OSPF and BGP routes.

Sorry I did not receive email alert for this update. I will get back to you with command results.. I am still having some difficulties to understand but I will go throug your reference link and your explanations with my lab.

Can some one please help me with second scenario ?????  Please let me know what requires..

I am having this issue in live network as well... so now I need to find out the way to reduce admin overhead..

thanks you gusy.. all your posts are really help ful.. I do not know how to rate.. so let me know an I will rate all of them..

2721
Views
11
Helpful
12
Replies
CreatePlease to create content