cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1718
Views
0
Helpful
7
Replies

OSPF to BGP redistribution

roger perkin
Level 2
Level 2

I am trying to re-create in my lab the basic setup of the work network to test some failover.

The basic setup is two core switches connected to an MPLS cloud with a site to site backup link between the cores.

OSPF is running between all devices and the OSPF gets redistributed into BGP across the MPLS

I have setup a very basic lab to gain a better understanding of this but cannot get the OSPF routes to be redistributed across the cloud between the 2 BPG routers.

The redistribution is not working as sh ip route on the routers does not show any BGP routes, I am sure I am missing a very simple BGP concept here!

Config of R1

interface FastEthernet0/0
ip address 10.251.251.194 255.255.255.240
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 172.16.1.1 255.255.255.0
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 10.251.251.194 0.0.0.0 area 0
!
router bgp 1
no synchronization
bgp log-neighbor-changes
network 172.16.1.0
redistribute ospf 1
neighbor 172.16.1.2 remote-as 1
no auto-summary

Config R2

interface FastEthernet0/0
ip address 10.250.251.194 255.255.255.240
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 172.16.1.2 255.255.255.0
shutdown
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 10.250.251.194 0.0.0.0 area 0
!
router bgp 1
no synchronization
bgp log-neighbor-changes
network 172.16.1.0
redistribute ospf 1
neighbor 172.16.1.1 remote-as 1
no auto-summary

R1#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

     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/3] via 10.251.251.193, 00:01:58, FastEthernet0/0
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/2] via 10.251.251.193, 00:01:58, FastEthernet0/0
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, FastEthernet1/0
     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O       10.10.11.0/24 [110/2] via 10.251.251.193, 00:01:58, FastEthernet0/0
C       10.251.251.192/28 is directly connected, FastEthernet0/0
O       10.250.251.192/28
           [110/3] via 10.251.251.193, 00:01:59, FastEthernet0/0
R1#

R2#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

     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/2] via 10.250.251.193, 00:02:10, FastEthernet0/0
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/3] via 10.250.251.193, 00:02:10, FastEthernet0/0
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, FastEthernet1/0
     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O       10.10.11.0/24 [110/2] via 10.250.251.193, 00:02:10, FastEthernet0/0
O       10.251.251.192/28
           [110/3] via 10.250.251.193, 00:02:11, FastEthernet0/0
C       10.250.251.192/28 is directly connected, FastEthernet0/0
R2#

1 Accepted Solution

Accepted Solutions

Hi,

looking to the outputs you provided, IMHO:

The OSPF redistribution to BGP is working.

But taking the 10.250.251.192/28 as an example, what had happened in the past?

I'm guessing:

Your router R1 had received this prefix originally via OSPF (through your MPLS backbone probably).

It redistributed that to his BGP table.

That's why you can see

R1#sh ip bgp
...
* i10.250.251.192/28 172.16.1.2               0    100      0 ?
*>                  10.251.251.193           3         32768 ?

Then you established the iBGP peering between your R1 and R2 routers.

R1 received the same prefix from R2, so you can see

   R1#sh ip bgp
...
* i10.250.251.192/28 172.16.1.2               0    100      0 ?
*>                  10.251.251.193           3         32768 ?

But as the original BGP prefix had  weight=32768 (created by this router), it remained the best within the BGP table.

I'd recommend:

a) use next-hop-self for iBGP session between your R1 and R2 routers

b) configure a route-map setting weight=0 when redistributing OSPF to BGP on those routers,

c) configure a route-map setting better weight or local preference for BGP prefixes incoming from R2 on R1 and vice versa

d) when a)-c) done, resetting OSPF neighbourship

HTH,

Milan

View solution in original post

7 Replies 7

milan.kulik
Level 10
Level 10

Hi,

is you BGP session Up?

What does

sh ip bgp sum

sh ip bgp

show on your routers?

HTH,

Milan

BGP seems to be up


R1#sh ip bgp sum
BGP router identifier 172.16.1.1, local AS number 1
BGP table version is 14, main routing table version 14
5 network entries using 505 bytes of memory
10 path entries using 480 bytes of memory
6 BGP path attribute entries using 360 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 1345 total bytes of memory
BGP activity 9/4 prefixes, 14/4 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
172.16.1.2      4     1     131     131       14    0    0 02:04:56        5
R1#sh ip bgp
BGP table version is 14, local router ID is 172.16.1.1
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
* i3.3.3.3/32       10.250.251.193           2    100      0 ?
*>                  10.251.251.193           3         32768 ?
* i4.4.4.4/32       10.250.251.193           3    100      0 ?
*>                  10.251.251.193           2         32768 ?
* i10.10.11.0/24    10.250.251.193           2    100      0 ?
*>                  10.251.251.193           2         32768 ?
* i10.250.251.192/28
                    172.16.1.2               0    100      0 ?
*>                  10.251.251.193           3         32768 ?
* i10.251.251.192/28
                    10.250.251.193           3    100      0 ?
*>                  0.0.0.0                  0         32768 ?
R1#

R2#sh ip bgp sum
BGP router identifier 10.250.251.194, local AS number 1
BGP table version is 8, main routing table version 8
5 network entries using 505 bytes of memory
10 path entries using 480 bytes of memory
6 BGP path attribute entries using 360 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 1345 total bytes of memory
BGP activity 6/1 prefixes, 11/1 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
172.16.1.1      4     1     131     131        8    0    0 02:04:51        5
R2#sh ip bgp
BGP table version is 8, local router ID is 10.250.251.194
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
* i3.3.3.3/32       10.251.251.193           3    100      0 ?
*>                  10.250.251.193           2         32768 ?
* i4.4.4.4/32       10.251.251.193           2    100      0 ?
*>                  10.250.251.193           3         32768 ?
* i10.10.11.0/24    10.251.251.193           2    100      0 ?
*>                  10.250.251.193           2         32768 ?
* i10.250.251.192/28
                    10.251.251.193           3    100      0 ?
*>                  0.0.0.0                  0         32768 ?
* i10.251.251.192/28
                    172.16.1.1               0    100      0 ?
*>                  10.250.251.193           3         32768 ?
R2#

I have now idendifited what is probably normal behaviour but need to understand why?

If I shut down int f1/0 on R4 - this breaks the OSPF between R4 & R3

sh ip route on R1 then shows a BGP route to 3.3.3.3 via 10.250.251.193

So it appears to be working and the redistribution is working however when OSPF is running between R4 & R3 that is the preffered route to get to networks between R1 & R2

Thanks

Roger

Please ignore, looks like Milan has provided the answer.

Jon

Hi,

that might be another issue:

OSPF having a better Administrative Distance (110) than iBGP (200).

HTH,

Milan

Hi,

looking to the outputs you provided, IMHO:

The OSPF redistribution to BGP is working.

But taking the 10.250.251.192/28 as an example, what had happened in the past?

I'm guessing:

Your router R1 had received this prefix originally via OSPF (through your MPLS backbone probably).

It redistributed that to his BGP table.

That's why you can see

R1#sh ip bgp
...
* i10.250.251.192/28 172.16.1.2               0    100      0 ?
*>                  10.251.251.193           3         32768 ?

Then you established the iBGP peering between your R1 and R2 routers.

R1 received the same prefix from R2, so you can see

   R1#sh ip bgp
...
* i10.250.251.192/28 172.16.1.2               0    100      0 ?
*>                  10.251.251.193           3         32768 ?

But as the original BGP prefix had  weight=32768 (created by this router), it remained the best within the BGP table.

I'd recommend:

a) use next-hop-self for iBGP session between your R1 and R2 routers

b) configure a route-map setting weight=0 when redistributing OSPF to BGP on those routers,

c) configure a route-map setting better weight or local preference for BGP prefixes incoming from R2 on R1 and vice versa

d) when a)-c) done, resetting OSPF neighbourship

HTH,

Milan

Thanks Milan,

The OSPF was the first thing I brought up. I will try all the things you suggested.

I really need to learn the behaviour of this setup

Roger