Routing – Prioritize redistributed BGP routes over OSPF intra-area

bgpospfrouting

I have a few routers, each controlling a /16, connected together with VPN tunnels. These routers are all in the same OSPF area. Now, I'm also doing BGP with some other routers that I don't control, such that they may advertise routes to the other /16s, that I already get from the VPN tunnels.

Most of the time, the BGP routes are better than the OSPF ones, so I'd like far away routers to know about them. So I thought I'd redistribute the BGP routes into OSPF.

However, I then end up with externals in the OSPF database, which are never chosen over the intra-area OSPF routes.

Is there a way to have this work? Other than doing BGP between all the routers?

NOTE to anyone who replies: I can copy and paste Cisco documentation, too. Please consider writing an useful answer. Thanks.

Best Answer

Regardless of a route’s metric or administrative distance, OSPF will choose routes in the following order:

  1. Intra-Area (O)
  2. Inter-Area (O IA)
  3. External Type 1 (E1)
  4. External Type 2 (E2)
  5. NSSA Type 1 (N1)
  6. NSSA Type 2 (N2)

You simply cannot get OSPF to prefer an external route over an internal route.

Related Topic