cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
17171
Views
10
Helpful
13
Replies

Redistributing BGP into OSPF

hanwucisco
Level 1
Level 1

hi, thanks first,

R2---OSPF----R1---BGP---R3
It is a simple topology. R1 is the border router for both BGP and OSPF. It redistributes both into each other.
R3 can show R2's loop interface, which indicates everything is fine with redistributing OSPF into BGP.
But R2 cannot see any loop interface on R3. When i do show ip ospf database on the R1, it doesnt have any routes to R3 in the database.
By the way, R1 can reach R3's loop interfaces from BGP. any idea?
Here is the configs,

=====R1=====

interface Loopback0
ip address 172.16.101.1 255.255.255.0
!
interface Serial0/0
ip address 10.1.12.2 255.255.255.0
serial restart-delay 0
!
interface Serial0/1
ip address 10.1.13.1 255.255.255.0
serial restart-delay 0
!

!
router ospf 1
log-adjacency-changes
redistribute bgp 100 subnets
network 10.1.12.2 0.0.0.0 area 0
network 172.16.101.1 0.0.0.0 area 0
no summary
!
router bgp 100
no synchronization
bgp log-neighbor-changes
network 10.1.13.0 mask 255.255.255.0
redistribute ospf 1
neighbor 10.1.13.3 remote-as 100
no auto-summary
!
=========

======R2======
interface Loopback0
ip address 172.16.102.2 255.255.255.0
!
interface Serial0/0
ip address 10.1.12.1 255.255.255.0
serial restart-delay 0
!
!
router ospf 1
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0
!
=======
=====R3========


interface Loopback0
ip address 172.16.103.3 255.255.255.0
!
interface Loopback1
ip address 3.3.3.3 255.255.255.255
!
interface Serial0/0
ip address 10.1.13.3 255.255.255.0
serial restart-delay 0
!

router bgp 100
no synchronization
bgp log-neighbor-changes
network 3.3.3.3 mask 255.255.255.255
network 10.1.13.0 mask 255.255.255.0
network 172.16.103.0 mask 255.255.255.0
neighbor 10.1.13.1 remote-as 100
no auto-summary

=======================

=======Show ip ospf database from R1====

R1#sh ip os da

            OSPF Router with ID (172.16.101.1) (Process ID 1)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
172.16.101.1    172.16.101.1    5           0x8000000F 0x0023E1 3
172.16.102.2    172.16.102.2    1508        0x80000004 0x00F3DA 3

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
10.1.13.0       172.16.101.1    5           0x80000002 0x00AACC 0
R1#


==========show ip route from R2=========

R2#
*Mar  1 01:15:15.587: %OSPF-5-ADJCHG: Process 1, Nbr 172.16.101.1 on Serial0/0 from LOADING to FULL, Loading Done
R2#sh ip route


     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
O       172.16.101.1/32 [110/65] via 10.1.12.2, 00:00:50, Serial0/0
C       172.16.102.0/24 is directly connected, Loopback0
     10.0.0.0/24 is subnetted, 2 subnets
O E2    10.1.13.0 [110/1] via 10.1.12.2, 00:00:50, Serial0/0
C       10.1.12.0 is directly connected, Serial0/0
R2#

1 Accepted Solution

Accepted Solutions

Han,

    Good question! 5-Point for you. R3 is advertising routes via iBGP. If you enabled a synchronization on R1, those routes won't be installed in RIB on R1. You can check "sh ip bgp and sh ip route". Because those routes have not been in IGP(it's a rule). In short if those routes have not been installed on the routing table the router can't redistribute them as well. That's why you didn't see anything on R2.

HTH,

Toshi

View solution in original post

13 Replies 13

Reza Sharifi
Hall of Fame
Hall of Fame

Hi,

Since you are running IBGP between r1 and r3, you need to use the loopback interface of each router as neighbors.  But before you do that, you need to have reachability between the 2 loopbacks interfaces..

so try this "sh ip bg sum"

do you see the peering between r1 and r3 established?

from r1 can you ping the loopback address of r3 router?

from r3 can you ping the loopback address of r1 router?

reza,

Why is it that it needs the loop interface for the neighbors?

I also managed to make it can ping the loop interfaces between R1 and R3. However, the BGP always stuck in Active mode.

any idea?

thanks,

Han

Reza Sharifi
Hall of Fame
Hall of Fame

Usually when using IBGP, you use the loopback adress.  The reason for it is that the loopback address is a logical interface and it never goes down.  If you use a physical interface in a redundant environment and if that interface goes down you loose you BGP peering but with loopback you will not

If you can ping from r1 to r3 loopback and r3 to r1 loopback try below config

=====R1=====

interface Loopback0
ip address 172.16.101.1 255.255.255.0

router bgp 100

neighbor 172.16.103.3 remote-as 100

neighbor 172.16.103.3 update-source Loopback0

no auto-summary

=====R3========


interface Loopback0
ip address 172.16.103.3 255.255.255.0

router bgp 100
neighbor 172.16.101.1 remote-as 100

neighbor 172.16.101.1 update-source Loopback0
no auto-summary

yes, i did change as to use the loopback interface. The R2 still has no route from R3.

Hi,

   Your original configuration looks good to me. Keep in mind, by default iBGP redistribution into IGP is disabled. If you want to do,just add a "bgp redistribute-internal" command on R1. You will finally see what you want. It's disabled because it can cause routing loop within AS.

HTH,

Toshi

thot,

I tried with the command address-family ipv4 and bgp redistribute-internal. But it is still the same. No routes from R3 found in R2's OSPF database.

R2#sh ip os da

            OSPF Router with ID (172.16.102.2) (Process ID 1)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
172.16.101.1    172.16.101.1    95          0x8000000A 0x004287 3
172.16.102.2    172.16.102.2    1785        0x80000008 0x00EBDE 3

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
10.1.13.0       172.16.101.1    94          0x80000003 0x00A8CD 0
R2#

Hi,

   I didn't see "address-family ipv4" in your original post. Do you need to use it?

R1:

!

router bgp 100
bgp redistribute-internal
!

HTH,

Toshi

I used it after saw you post, here is config from R1 and show output fromR2.

R1(config)#do sh run | b r o
router ospf 1
log-adjacency-changes
redistribute bgp 100 subnets
network 10.1.12.2 0.0.0.0 area 0
network 172.16.101.1 0.0.0.0 area 0
!
router bgp 100
bgp router-id 172.16.101.1
bgp log-neighbor-changes
neighbor 172.16.103.3 remote-as 100
neighbor 172.16.103.3 update-source Loopback0
!
address-family ipv4
redistribute ospf 1
neighbor 172.16.103.3 activate
no auto-summary
no synchronization
bgp redistribute-internal
network 10.1.13.0 mask 255.255.255.0
exit-address-family
!

R2#sh ip os da

            OSPF Router with ID (172.16.102.2) (Process ID 1)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
172.16.101.1    172.16.101.1    251         0x8000000B 0x004088 3
172.16.102.2    172.16.102.2    1998        0x80000009 0x00E9DF 3

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
10.1.13.0       172.16.101.1    251         0x80000004 0x00A6CE 0
R2#

Hi Guys,

   Your original configuration is fine to me. Just add a command I told you. In your new configuration you need to do more things. If you want to use a loopback as a source of iBGP you have to know how to route it to the destination.  Please post the output of "show ip bgp sum & sh ip bgp" on R1.

HTH,

Toshi

now, i use the serial interfaces in the neighbor command. It is still the same in R2. show config and others from R1 is pasted, thanks,

R1(config-router-af)#do sh run | b r b
router bgp 100
bgp router-id 172.16.101.1
bgp log-neighbor-changes
neighbor 10.1.13.3 remote-as 100
!
address-family ipv4
redistribute ospf 1
neighbor 10.1.13.3 activate
no auto-summary
synchronization
bgp redistribute-internal
network 10.1.13.0 mask 255.255.255.0
exit-address-family
!
no ip http server
no ip http secure-server
ip classless
ip route 172.16.103.3 255.255.255.255 10.1.13.3
!
=========

R1(config-router-af)#do sh ip bg summ
BGP router identifier 172.16.101.1, local AS number 100
BGP table version is 47, main routing table version 47
6 network entries using 606 bytes of memory
7 path entries using 336 bytes of memory
4 BGP path attribute entries using 240 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 1182 total bytes of memory
BGP activity 15/9 prefixes, 27/20 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.1.13.3       4   100       7      11       47    0    0 00:02:49        3
R1(config-router-af)#
======

R1(config-router-af)#do sh ip bg
BGP table version is 47, local router ID is 172.16.101.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.1.13.3                0    100      0 i
*> 10.1.12.0/24     0.0.0.0                  0         32768 ?
* i10.1.13.0/24     10.1.13.3                0    100      0 i
*>                  0.0.0.0                  0         32768 i
*> 172.16.101.0/24  0.0.0.0                  0         32768 ?
*> 172.16.102.2/32  10.1.12.1               65         32768 ?
* i172.16.103.0/24  10.1.13.3                0    100      0 i
R1(config-router-af)#
====

R1(config-router-af)#do sh ip os da

            OSPF Router with ID (172.16.101.1) (Process ID 1)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
172.16.101.1    172.16.101.1    151         0x8000000C 0x003E89 3
172.16.102.2    172.16.102.2    977         0x8000000A 0x00E7E0 3

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
10.1.13.0       172.16.101.1    151         0x80000005 0x00A4CF 0
R1(config-router-af)#

Hi,

  Okay lets do the following commands. We are going to use address-family on R1 for a bit more advanced configuration.

#####################

R1:

!

router ospf 1

log-adjacency-changes

redistribute bgp 100 subnets

network 10.1.12.2 0.0.0.0 area 0

network 172.16.101.1 0.0.0.0 area 0

!

router bgp 100

bgp router-id 172.16.101.1

bgp log-neighbor-changes

neighbor 10.1.13.3 remote-as 100

!

address-family ipv4

  redistribute ospf 1

  neighbor 10.1.13.3 activate

no auto-summary

  no synchronization

  bgp redistribute-internal

  network 10.1.13.0 mask 255.255.255.0

exit-address-family

!

no ip route 172.16.103.3 255.255.255.255 10.1.13.3

!

#####################

R3:

router bgp 100

no synchronization

bgp log-neighbor-changes

network 3.3.3.3 mask 255.255.255.255

network 10.1.13.0 mask 255.255.255.0

network 172.16.103.0 mask 255.255.255.0

neighbor 10.1.13.1 remote-as 100

no auto-summary

!

no ip route 172.16.101.1 255.255.255.255 10.1.13.1
#####################
R2:
!
router ospf 1
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0
!
#####################
    Keep in mind,we sometime need to use a "clear ip bgp *" command(be careful) to let the router re-calculate things.
HTH,
Toshi

Toshi,

it works now. The last culprit appeared to be the "synchronization" command in there. I thought it wasnt related in this scaniro, but it apperantly is. I wonder wny is that?

thanks,

Han

Han,

    Good question! 5-Point for you. R3 is advertising routes via iBGP. If you enabled a synchronization on R1, those routes won't be installed in RIB on R1. You can check "sh ip bgp and sh ip route". Because those routes have not been in IGP(it's a rule). In short if those routes have not been installed on the routing table the router can't redistribute them as well. That's why you didn't see anything on R2.

HTH,

Toshi

Review Cisco Networking for a $25 gift card