cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
15459
Views
10
Helpful
6
Replies

why external ospf routes not redistributed into BGP

mokacisco
Level 1
Level 1

Dear all,

hello everybody.

we have here R1, R2 and R3 that are in ospf 1 area 0.

we have ebgp session from R1 to BGP1 and R2 to BGP2.

we have default route in R1 and R2 pointing to FW (172.17.1.4) that are propagated with default-info originate in OSPF and BGP too.

behind the firewall there is a subnet 10.166.245.0/24 and there is a static route: 10.166.245.0 255.255.255.0 172.17.1.4 tag 1000

typically the config from R1 or R2 is:

!

router ospf 1

log-adjacency-changes

redistribute connected subnets route-map CONNECTED-2-OSPF

redistribute static subnets route-map STATIC-2-OSPF

redistribute bgp 65000 subnets route-map BGP-2-OSPF

passive-interface default

no passive-interface FastEthernet0/0

network 2.2.2.0 0.0.0.255 area 0

!

router bgp 65000

no synchronization

bgp log-neighbor-changes

network 0.0.0.0

redistribute ospf 1  route-map OSPF-2-BGP

neighbor 2.2.2.2 remote-as 65000

neighbor 2.2.2.2 soft-reconfiguration inbound

neighbor 10.10.10.1 remote-as 7000

neighbor 10.10.10.1 soft-reconfiguration inbound

default-information originate

no auto-summary

!

ip route 0.0.0.0 0.0.0.0 172.17.1.4

ip route 10.166.245.0 255.255.255.0 172.17.1.4 tag 1000

!

!

route-map STATIC-2-OSPF permit 10

match tag 1000

!

route-map CONNECTED-2-OSPF permit 10

match interface Vlan4

!

route-map BGP-2-OSPF permit 10

set tag 50

!

route-map OSPF-2-BGP deny 10

match tag 50

!

route-map OSPF-2-BGP permit 20

match route-type internal external

!

!

!

everybody knows that by default only internal ospf routes are redistributed into bgp, but here i wanted to redistribute the external ones too with route-map.

lab2.png

but no success. in the bgp table of R1 and R2, there is 10.166.245.0/24 route !!!

i have a doubt: does only the ospf routes that are in the routing table who can be redistributed OR the routes in the OSPF database?

how can i redistribute this static "10.166.245.0 255.255.255.0 172.17.1.4 tag 1000" into OSPF and then automatically to BGP ?

The deal is:

no redistribution of static routes directly to BGP

no "network 10.166.245.0 mask 255.255.255.0" command under bgp.

not change the admin distance of static routes greater thant 110.

thanks in advance for your help.

1 Accepted Solution

Accepted Solutions

milan.kulik
Level 10
Level 10

Hi,

generally, you would need

router bgp 65000

redistribute ospf 1  match internal external 1 external 2 route-map OSPF-2-BGP

command used to redistribute both internal and external OSPF routes to BGP.

See http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a00800943c5.shtml#redistributionofospfinternalandexternalroutesintobgp

for details.

But as you describe, in your case the prefix is configured as a static one on your router.

So no matter if redistributed to OSPF or not, it is still treated as static by your router.

If you want to redistribute it to BGP, you need to redistribute static routes (with a route-map permitting only this single prefix, if necessary).

I think there is a  good reason for this IOS behavior - otherwise routing and redistribution loops could be created easily.

View solution in original post

6 Replies 6

XIE YAO
Level 1
Level 1

"i have a doubt: does only the ospf routes that are in the routing table who can be redistributed OR the routes in the OSPF database?"

Redistrubution is based on the router's current routing table.

Did you try below command?

router bgp XX

redistribute ospf YY match external 2

hi Xie,

yes i've tried it what the result was the same.

bgp always looks for the exact match in IGP routing table so network should be available in routing table not the database table.

izhar

CCIE 37523

CCIE 37523

milan.kulik
Level 10
Level 10

Hi,

generally, you would need

router bgp 65000

redistribute ospf 1  match internal external 1 external 2 route-map OSPF-2-BGP

command used to redistribute both internal and external OSPF routes to BGP.

See http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a00800943c5.shtml#redistributionofospfinternalandexternalroutesintobgp

for details.

But as you describe, in your case the prefix is configured as a static one on your router.

So no matter if redistributed to OSPF or not, it is still treated as static by your router.

If you want to redistribute it to BGP, you need to redistribute static routes (with a route-map permitting only this single prefix, if necessary).

I think there is a  good reason for this IOS behavior - otherwise routing and redistribution loops could be created easily.

Yes. Thanks for the reply. Now I'm sure that there is no "simple" workaround than redistributing static directly into bgp.

Thanks again.

Sent from Cisco Technical Support iPhone App

 

We have redistributed ospf into bgp but we are unable to see that routes into bgp table 

Could you please help us to understand the issue ?

 

PIDIADR01#sh ip route 10.30.0.14
Routing entry for 10.30.0.0/19
Known via "ospf 100", distance 110, metric 20, type extern 2, forward metric 25
Redistributing via bgp 64587
Last update from 10.27.251.245 on Tunnel116, 00:26:00 ago
Routing Descriptor Blocks:
* 10.27.251.245, from 10.27.254.115, 00:26:00 ago, via Tunnel116
Route metric is 20, traffic share count is 1

!

PIDIADR01#sh run | s bgp
redistribute bgp 64587 subnets route-map BGP_to_OSPF
router bgp 64587
bgp router-id 10.27.254.116
bgp log-neighbor-changes
network 10.27.249.244 mask 255.255.255.252
aggregate-address 172.27.0.0 255.255.0.0 attribute-map IAD_PREFER_SUMMARY
aggregate-address 10.31.0.0 255.255.240.0 attribute-map AMS_WDL_BACKUP
aggregate-address 10.31.0.0 255.255.0.0 attribute-map IAD_PREFER_SUMMARY
aggregate-address 10.30.0.0 255.255.0.0 attribute-map IAD_PREFER_SUMMARY
aggregate-address 10.29.0.0 255.255.0.0 attribute-map IAD_PREFER_SUMMARY
aggregate-address 10.28.192.0 255.255.192.0 attribute-map AMS_WDL_BACKUP
aggregate-address 10.28.0.0 255.255.0.0 attribute-map IAD_PREFER_SUMMARY
aggregate-address 10.27.64.0 255.255.192.0 attribute-map AMS_WDL_BACKUP
aggregate-address 10.27.48.0 255.255.240.0 attribute-map AMS_WDL_BACKUP
aggregate-address 10.27.0.0 255.255.0.0 attribute-map IAD_PREFER_SUMMARY
redistribute ospf 100 match internal external 1 external 2 route-map OSPF_INTO_BGP

neighbor 10.27.249.246 remote-as 64587
neighbor 10.27.249.246 transport path-mtu-discovery
neighbor 10.27.249.246 fall-over bfd
neighbor 10.27.249.246 next-hop-self
neighbor 10.27.249.246 send-community both
neighbor 10.27.249.246 soft-reconfiguration inbound
neighbor 10.27.249.254 remote-as 64901
neighbor 10.27.249.254 transport path-mtu-discovery
neighbor 10.27.249.254 update-source GigabitEthernet0/0/0
neighbor 10.27.249.254 fall-over bfd
neighbor 10.27.249.254 send-community
neighbor 10.27.249.254 soft-reconfiguration inbound
neighbor 10.27.249.254 route-map IAD_TO_CORE out
ip bgp-community new-format

!

PIDIADR01#sh ip bgp
PIDIADR01#sh ip bgp | i 10.30

!

PIDIADR01#sh ip bgp neighbors 10.27.249.254 advertised-routes | i 10.30
PIDIADR01#

!

Review Cisco Networking for a $25 gift card