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

Question about OSPF to BGP redistribution

I have some static routes on a router where OSPF and BGP are also running. I have redistributed the static routes into OSPF (showing in OSPF database). I also want to have the static routes into the BGP routing table. Understand this can be done by using a prefix list permiting all the static routes, however I was thinking a simpler way just redistributing whatever is in the OSPF routing tabel into BGP (permit le 32).

My question is if OSPF really redistributes those routes. Those routes are shown as "static" in "sh ip route" even though they are also in OSPF database. I have heard that OSPF only redistributes the routes showing as "OSPF routes", not what's in its database.

Thanks for any help.



Re: Question about OSPF to BGP redistribution

Hello Gary,

in general terms redistribution will always check the IP routing table and not OSPF database, BGP table or elsewhere.

So "redistribute static" will redistribute only those routes, which will be found currently in the IP routing table marked with an "S". And also "redistribute ospf 10" will only redistribute those routes into another routing protocol, which the OSPF process 10 has inserted into the IP routing table.

In your case OSPF will announce the network inserted into the IP routing table through static routes as long as they are in there, because of the "redistribute static subnets" you probably have configured.

If you now want to have the static routes in BGP you would configure something like

router bgp 65000

redistribute static route-map static2bgp

route-map static2bgp permit 10

match ip address prefix-list 123

ip prefix-list 123 permit ...

You could leave the route-map away, but in case you have a bgp router connected to the internet I would strongly recommend to use some filters.

"redistribute ospf 10" would look for all internal ospf routes in the IP routing table and therefore NOT grab the static ones.

Hope this helps! Please rate all posts.

Regards, Martin


Re: Question about OSPF to BGP redistribution

Hi Gary,

The thing to understand here is that the use of redistribution does not change anything in the routing table of the router on which you are configuring it.

As you have observed, static routes do not become OSPF routes when you redistribute them into OSPF. This can be generalised to the following: when you redistribute protoclol1 into protocol2, the router will scan the routing table for routes installed by protocol1 and will then do one of the following, depending on the protocol it is being redistributed into:

- if it is a Link state protocol like OSPF, it will originate LSAs appropriate to the route being redistributed. These LSAs will be subsequently flooded to other routers which will install them as routes in their routing table. The only change on the redistributing router is the installation of additional LSAs; the routing table does not change

- if it is a distance vector protocol like IGRP, the router will take the protocol1 routes and advertise them via IGRP update packets every time an update packet is sent. Once again, there is no change on the routing table of the redistributing router.

Note the other important point: when redistributing is carried out, the only routes that are redistributed are those that are in the routing table and installed there by the source protocol, which could be quite different to the contents of link-state databases.

Hope that helps.

Pls remember to rate posts.


Community Member

Re: Question about OSPF to BGP redistribution

Thanks all for the help. That corrected my understanding.

CreatePlease to create content