cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
12644
Views
1
Helpful
18
Replies

Can I redistribute eBGP routes to OSPF

gensonator
Level 1
Level 1

Please pardon me if my question is dumb as I am just new to BGP routing.

I have our HQ Routers 1 & 2 both running OSPF on area 0 with Partner Routers 1 & 2. ( See attached diagram).  The same HQ Routers 1 & 2 also run eBGP with our branch routers BGP 65050.  On HQ Router2 I am redistributing BGP to OSPF and vise versa.  The routes on BGP 65000 are being redistributed to OSPF but the routes from AS 65050 (eBGP) are not getting redistributed so the Partner network is unable to reach the branch network.

Is is possible to redistribute eBGP routes to OSPF.  If yes, how do I do it?

HQ Router 2:

router ospf 1

redistribute bgp 65000

router bgp 65000

redistribute ospf 1 route-map OSPF-TO-BGP

2 Accepted Solutions

Accepted Solutions

Hello

You can be its not recommended due to the size of the internet routing table.

However saying that you need to tell bgp to redistribute internally along with the other redistribute commands

router bgp xx
bgp redistribute-internal

res
paul


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul

View solution in original post

Hello,

you need do add "subnet" at the end of your redistribute command.

router ospf 1

redistribute bgp 65000 subnet.

If you do not  specify "subnet", only classful subnets will be advertised.

Hope it helps,

Masoud

View solution in original post

18 Replies 18

Hello

You can be its not recommended due to the size of the internet routing table.

However saying that you need to tell bgp to redistribute internally along with the other redistribute commands

router bgp xx
bgp redistribute-internal

res
paul


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul

Hi Paul,

Thanks for the quick response. Our subnets are not advertised to the internet and I do not advertise the internet routes to our to private networks.  I will try your advise.  Tthanks again .

for Ebgp route redistribution , u dont need this command, u need it for ibgp

Hello,

you need do add "subnet" at the end of your redistribute command.

router ospf 1

redistribute bgp 65000 subnet.

If you do not  specify "subnet", only classful subnets will be advertised.

Hope it helps,

Masoud

Thanks Masoud,

That did the trick, together with the bgp redistribute-internal.

Regards,

Gensonator

Glad it helped.

You do not need to add "bgp redistribute-internal". It is for redistributing IBGP to OSPF. It does not have any affact on EBGP.

http://www.cisco.com/c/en/us/td/docs/ios/12_2/iproute/command/reference/fiprrp_r/1rfbgp1.html

To allow the redistribution of iBGP routes into an interior gateway protocol such as IS-IS or OSPF, use the bgp redistribute-internal command in router configuration mode. To remove the bgp redistribute-internal command from the configuration file and restore the system to its default condition where the software does not allow the redistribution of iBGP routes into Interior Gateway Protocols (IGPs), use the no form of this command.

Masoud

I tried it but it does not work without "bgp redistribute-internal".  I have been clearing both routing protocols (in a GNS test environment) to make sure changes take effect.

Tried "bgp redistribute-internal" only  - not redistributing the ebgp routes

Tried "redistribute bgp 65000 subnets" only - not redistributing the ebgp routes

Tried using both -   the ebgp routes have been redistributed.

Could you please share the output of the "show IP route on the router which you are doing redistribution.

I want to see some BGP routes in the routing table.

Let me also try it on GNS and get back to you.

Thanks

This is the routing table of the HQRouter2:

HQRouter2#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 172.16.200.246 to network 0.0.0.0

     192.168.14.0/29 is subnetted, 1 subnets
B       192.168.14.248 [200/0] via 172.16.200.246, 00:00:27
     172.9.0.0/24 is subnetted, 1 subnets
O       172.9.200.0 [110/11] via 172.16.200.246, 00:37:04, FastEthernet0/0
     172.16.0.0/30 is subnetted, 4 subnets
C       172.16.200.16 is directly connected, FastEthernet0/1
C       172.16.200.0 is directly connected, Vlan207
C       172.16.200.244 is directly connected, FastEthernet0/0
O       172.16.200.128 [110/11] via 172.16.200.246, 00:37:06, FastEthernet0/0
     172.20.0.0/16 is variably subnetted, 3 subnets, 2 masks
B       172.20.40.0/24 [200/0] via 172.16.200.17, 00:00:29
B       172.20.16.0/24 [200/0] via 172.16.200.17, 00:00:29
B       172.20.120.0/21 [200/0] via 172.16.200.17, 00:00:29
     163.189.0.0/32 is subnetted, 3 subnets
O       163.189.3.1 [110/12] via 10.92.30.1, 00:37:08, FastEthernet1/1
O       163.189.2.1 [110/12] via 10.92.30.1, 00:37:08, FastEthernet1/1
O       163.189.1.1 [110/12] via 10.92.30.1, 00:37:08, FastEthernet1/1
     10.0.0.0/8 is variably subnetted, 9 subnets, 2 masks
O       10.10.1.0/30 [110/21] via 172.16.200.246, 00:37:08, FastEthernet0/0
O       10.10.2.0/30 [110/21] via 10.92.30.1, 00:37:08, FastEthernet1/1
O       10.10.3.0/30 [110/11] via 10.92.30.1, 00:37:08, FastEthernet1/1
O E2    10.1.3.0/24 [110/20] via 172.16.200.246, 00:37:08, FastEthernet0/0
O E2    10.1.1.0/24 [110/20] via 172.16.200.246, 00:37:08, FastEthernet0/0
B       10.92.0.120/30 [200/0] via 172.16.200.17, 00:00:30
O       10.92.30.8/30 [110/11] via 172.16.200.246, 00:37:08, FastEthernet0/0
C       10.92.30.0/30 is directly connected, FastEthernet1/1
B       10.92.0.4/30 [200/0] via 172.16.200.17, 00:00:30
O*E2 0.0.0.0/0 [110/1] via 172.16.200.246, 00:37:08, FastEthernet0/0
HQRouter2#

The routes for 172.20.16.0/24,  172.20.40.0/24, and 172.20.120/21 are from ebgp (not shown here).  These are learned from an adjacent router that has the ebgp connection.

Here is its ip ospf database

HQRouter2#sh ip ospf database

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

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
10.10.2.1       10.10.2.1       522         0x80000004 0x00D3AF 2
10.92.30.1      10.92.30.1      1479        0x80000005 0x009035 2
10.92.30.9      10.92.30.9      492         0x80000005 0x00C28C 2
163.189.3.1     163.189.3.1     487         0x80000005 0x008DF1 5
172.16.200.17   172.16.200.17   1455        0x80000005 0x008544 1
172.16.200.245  172.16.200.245  531         0x8000000A 0x002217 4
192.168.21.250  192.168.21.250  447         0x80000005 0x001E49 4

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.10.1.1       10.92.30.9      494         0x80000003 0x00D41E
10.10.2.2       163.189.3.1     487         0x80000003 0x00360B
10.10.3.2       163.189.3.1     487         0x80000003 0x00745D
10.92.30.1      10.92.30.1      1479        0x80000002 0x005DD2
10.92.30.10     192.168.21.250  448         0x80000003 0x0060CB
172.16.200.17   172.16.200.17   1456        0x80000002 0x0009F3
172.16.200.246  192.168.21.250  448         0x80000003 0x00242C

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
0.0.0.0         192.168.21.250  450         0x80000003 0x0037F7 1
10.1.1.0        192.168.21.250  450         0x80000003 0x007717 130
10.1.3.0        192.168.21.250  450         0x80000003 0x00612B 130
HQRouter2#


As you can see, OSPF cannot see 172.20.16.0, 172.20.40.0 and 172.20.120.0. 

Without "bgp redistribute-internal", the routes are not redistributed.

HQRouter2#sh run | before  router
router ospf 1
 log-adjacency-changes
 redistribute static subnets route-map STATIC-TO-OSPF
 redistribute bgp 65000 subnets
 network 10.92.30.0 0.0.0.3 area 0
 network 172.9.0.0 0.0.255.255 area 0
 network 172.16.200.16 0.0.0.3 area 0
 network 172.16.200.244 0.0.0.3 area 0
 network 172.16.0.0 0.0.255.255 area 0
 default-information originate route-map DEFAULT-TO-OSPF
!
router bgp 65000
 no synchronization
 bgp router-id 2.2.2.2
 bgp log-neighbor-changes
 network 172.9.0.0
 network 172.16.200.244 mask 255.255.255.252
 redistribute static route-map bgp-Redistribute-STATIC
 redistribute ospf 1 route-map redistribute-OSPF-to-BGP
 neighbor 172.16.200.17 remote-as 65000
 neighbor 172.16.200.17 route-reflector-client
 neighbor 172.16.200.17 next-hop-self
 neighbor 172.16.200.17 soft-reconfiguration inbound
 neighbor 172.16.200.17 route-map bgp-GSAGGR-import in
 neighbor 172.16.200.246 remote-as 65000
 neighbor 172.16.200.246 route-reflector-client
 neighbor 172.16.200.246 next-hop-self
 neighbor 172.16.200.246 soft-reconfiguration inbound
 neighbor 172.16.200.246 route-map bgp-TMC-import in
 no auto-summary

When I added "bgp redistribute-internal",

GS-CORE#sh ip ospf database

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

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
10.10.2.1       10.10.2.1       819         0x80000004 0x00D3AF 2
10.92.30.1      10.92.30.1      1776        0x80000005 0x009035 2
10.92.30.9      10.92.30.9      789         0x80000005 0x00C28C 2
163.189.3.1     163.189.3.1     785         0x80000005 0x008DF1 5
172.16.200.17   172.16.200.17   1752        0x80000005 0x008544 1
172.16.200.245  172.16.200.245  829         0x8000000A 0x002217 4
192.168.21.250  192.168.21.250  744         0x80000005 0x001E49 4

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.10.1.1       10.92.30.9      791         0x80000003 0x00D41E
10.10.2.2       163.189.3.1     785         0x80000003 0x00360B
10.10.3.2       163.189.3.1     785         0x80000003 0x00745D
10.92.30.1      10.92.30.1      1776        0x80000002 0x005DD2
10.92.30.10     192.168.21.250  746         0x80000003 0x0060CB
172.16.200.17   172.16.200.17   1754        0x80000002 0x0009F3
172.16.200.246  192.168.21.250  746         0x80000003 0x00242C

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
0.0.0.0         192.168.21.250  747         0x80000003 0x0037F7 1
10.1.1.0        192.168.21.250  746         0x80000003 0x007717 130
10.1.3.0        192.168.21.250  746         0x80000003 0x00612B 130
10.92.0.4       172.16.200.245  70          0x80000001 0x0091A8 0
10.92.0.120     172.16.200.245  70          0x80000001 0x005AD6 7543
172.20.16.0     172.16.200.245  70          0x80000001 0x0091AA 7543
172.20.40.0     172.16.200.245  70          0x80000001 0x00889B 7543
172.20.120.0    172.16.200.245  70          0x80000001 0x00F1E8 7543
192.168.14.248  172.16.200.245  70          0x80000001 0x00054D 0
GS-CORE#

The routes are now redistributed.

It might have something to do with the other configuration on the router, or because I am not doing it on the router that has the ebgp connection.

Below is the routing table of the Partner Router when I use "bgp redistribute-internal" and "redistribute bgp 65000 subnet" together. 

Partner-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 10.10.3.1 to network 0.0.0.0

     192.168.14.0/29 is subnetted, 1 subnets
O E2    192.168.14.248 [110/1] via 10.10.3.1, 00:08:42, FastEthernet0/1
     172.9.0.0/24 is subnetted, 1 subnets
O       172.9.200.0 [110/31] via 10.10.3.1, 00:53:56, FastEthernet0/1
     172.16.0.0/30 is subnetted, 4 subnets
O       172.16.200.16 [110/30] via 10.10.3.1, 00:53:56, FastEthernet0/1
O       172.16.200.0 [110/21] via 10.10.3.1, 00:53:56, FastEthernet0/1
O       172.16.200.244 [110/30] via 10.10.3.1, 00:53:56, FastEthernet0/1
O       172.16.200.128 [110/31] via 10.10.3.1, 00:53:57, FastEthernet0/1
     172.20.0.0/16 is variably subnetted, 3 subnets, 2 masks
O E2    172.20.40.0/24 [110/1] via 10.10.3.1, 00:08:44, FastEthernet0/1
O E2    172.20.16.0/24 [110/1] via 10.10.3.1, 00:08:44, FastEthernet0/1
O E2    172.20.120.0/21 [110/1] via 10.10.3.1, 00:08:44, FastEthernet0/1
     163.189.0.0/24 is subnetted, 3 subnets
C       163.189.2.0 is directly connected, Loopback2
C       163.189.3.0 is directly connected, Loopback3
C       163.189.1.0 is directly connected, Loopback1
     10.0.0.0/8 is variably subnetted, 9 subnets, 2 masks
O       10.10.1.0/30 [110/20] via 10.10.2.1, 00:54:00, FastEthernet0/0
C       10.10.2.0/30 is directly connected, FastEthernet0/0
C       10.10.3.0/30 is directly connected, FastEthernet0/1
O E2    10.1.3.0/24 [110/20] via 10.10.3.1, 00:54:00, FastEthernet0/1
O E2    10.1.1.0/24 [110/20] via 10.10.3.1, 00:54:00, FastEthernet0/1
O E2    10.92.0.120/30 [110/1] via 10.10.3.1, 00:08:47, FastEthernet0/1
O       10.92.30.8/30 [110/31] via 10.10.3.1, 00:54:00, FastEthernet0/1
O       10.92.30.0/30 [110/20] via 10.10.3.1, 00:54:00, FastEthernet0/1
O E2    10.92.0.4/30 [110/1] via 10.10.3.1, 00:08:47, FastEthernet0/1
O*E2 0.0.0.0/0 [110/1] via 10.10.3.1, 00:54:00, FastEthernet0/1
Partner-R2#

Thanks for sharing.

B      172.20.40.0/24 [200/0] via 172.16.200.17, 00:00:29
B       172.20.16.0/24 [200/0] via 172.16.200.17, 00:00:29
B       172.20.120.0/21 [200/0] via 172.16.200.17, 00:00:29

Actually, these routes are IBGP route. This is the reason it does not work without that command. As you see 200 is administrative distance for IBGP routes. Administrative distance for EBGP routes is 20.

router bgp 65000
 no synchronization
 bgp router-id 2.2.2.2
 bgp log-neighbor-changes
 network 172.9.0.0
 network 172.16.200.244 mask 255.255.255.252
 redistribute static route-map bgp-Redistribute-STATIC
 redistribute ospf 1 route-map redistribute-OSPF-to-BGP
 neighbor 172.16.200.17 remote-as 65000

This is an IBGP connection because your AS is the same as your neighbor AS.

Masoud

Yes, you are proven right.  I put the command on the router below the HQRouter2 that has the ebgp relationship with the branch router and by just using the "redistribute bgp 65000 subnets" command, the ebgp routes have been redistributed to OSPF.

Thank you.

Cheers!

Gensonator

You are most welcome. Happy to help.

Masoud

Could you please try to use redistribute bgp 65000 subnets match external and see if that helps.

Regards

Vinit

Thanks
--Vinit
Review Cisco Networking for a $25 gift card