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

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

OSPFand BGP on same router

I'm hoping someone has come across this before and has the solution. I have a scenario with a Cisco 6506 and a 7206. The 6506 is running BGP and peers with our data center router. The 7206 is a stub router off the 6506 and is used as an edge router for customer T1 circuits. I want to use OSPF between the routers to exchange connected and static routes. The problem I have is that static BGP null routes on the 6506 are overriding the OSPF routes being received from the 7206.


The 6506 is advertising a class C network to our data center. The 6506 does not utilize the network. It is only used on the 7206 for customer T1 circuits and is carved up into /29 subnets. So the 6506 has a static route: ip route null 0. Today the routing is accomplished with static routes on the 6506 for the networks on the 7206. Using OSPF the 7206 advertises /29 links back to the 6506, but when I withdraw one of the /29 static routes from the 6506, the /24 null route takes precedence over the more specific /29 routes and the traffic is black-holed on the 6506.

So my question is - how can I get the OSPF routes to look preferable to the /24 null route on the 6506?

Thanks for the help and let me know if my example is not clear.


OSPFand BGP on same router


considering,  you have configured "ip classless" routing (meantime is default) then the routing decision process should look like

- most specific prefix is always preferable

- if there is a kind of "super-net" of those prefixes in a routing table and the most specific prefix is not there, then that super-net rouing entry will be followed

- if a prefix doesn't match any routing table entry then it uses "default" route if it presents or it will be dropped in other case.

You say that your routing table on c6500 prefers a /24 prefix to a /29? It can't be true. Are you sure that the routing entry for that /29 is "active" ?

New Member

OSPFand BGP on same router

Thanks for the reply. I do have the "ip classless" statement in the config. The /29 subnets are active and I can also duplicate this behavior with a loopback interface on the 7206.

Please let me know if I can provide any additional information.

OSPFand BGP on same router

please post the "show ip route" for both /24 and /29 prefixes.

how do you configure the loopback? Do you redistrubute  it to OSPF or do you announce it to OSPF via "network" command?

OSPFand BGP on same router


So, the problem seems to be that when the more specific /29 is not available on the 6500 so the traffic coming from the Data centre is blackholed because you are advertising the via BGP to the Data Center. because the network is always advertised to the Data centre via BGP.

The solution is not to advertise the network( when the /29 is not available on the 6500. Would that help?

If you do not want this to happen and advertise the network to the DC only when it is truly reachable, the config will be as follows

route-map Adv192.168.1.0 deny 10

match interface Null0


route-map Adv192.168.1.0 permit 20


router bgp

network mask route-map Adv192.168.1.0

Give it a try and let us know.



Hall of Fame Super Silver

OSPFand BGP on same router

I am confused about the symptoms and hope that the original poster can provide some clarification. He says:"

but when I withdraw one of the /29 static routes from the 6506, the /24  null route takes precedence over the more specific /29 routes and the  traffic is black-holed on the 6506."

In trying to understand this I am trying to construct an example in my mind. I am assuming that might be one of the routes advertised by the 7206. So if he withdraws the advertisement of is he saying that it impacts other parts of (like maybe it impacts or only that now traffic to is blackholed?



New Member

OSPFand BGP on same router

same problem here, can someone help?

router is running ospf to r2 and r3, and bgp with r4 which is service provider

i made a static route to let's say the 30 network on r2 and r3, and under ospf i do a "redistribute subnets", to get the route in routing table of r1

on r1 i see these routes being learned, but i can not redistribute those learned routes into bgp

i thought the solution was to create a static route for the 30 network on r1, and then issue a "redistribute static" under the bgp process on r1

it does advertise the route to the provider, but it has also overwritten the ospf learned E2 routes

so the provider can send all the packets to r1, because the 30 network is being advertised via bgp, and they will end up on r1

but since there is no routes to the 30 network in my ip routing table (they are still there in the ospf database), how can i make this network available

redistributing ospf under bgp doesn't work, match external 2 doesn't work, route map doesn't work, network command doesn't work to advertise to provider


New Member

OSPFand BGP on same router

issue is solved

turns out bgp network command does work for me, as in my routing table on r1 i am getting ospf e2 routes to the 30 network, and thus i can advertise them into bgp

my prefix list out to the provider was blocking the 30 network, as i had a specific subnet mask allowed (/28) while the actual network was /29 and i had no le 32 option behind my prefix list