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.

  • I did write a useful answer, and I did not copy any Cisco documentation. If I had, I would have linked to the source and used a quote box for the text. As I wrote in my answer, "You simply cannot get OSPF to prefer an external route over an internal route." That is really all there is to it. It doesn't matter that you don't like it, that is the way it is.
    – Ron Maupin
    Commented Feb 25, 2017 at 21:38
  • @RonMaupin fair enough. I already knew that it was not possible. I've seen your list before. I was hoping somebody more experienced might comment on the options I have or how they solved this or a similar problem.
    – foobarbaz
    Commented Feb 25, 2017 at 21:41
  • It boils down to what the RFC says about OSPF route selection. Anything else would not meet the OSPF requirements. If you did use BGP, on Cisco devices the AD for eBGP is 20, while it is 200 for iBGP. any routes learned from eBGP would be preferred over OSPF or iBGP, although you could use a route map to change the AD of certain routes.
    – Ron Maupin
    Commented Feb 25, 2017 at 21:49
  • @RonMaupin yeah I guess my only option is to do BGP between the routers. Oh well. Thanks though.
    – foobarbaz
    Commented Feb 26, 2017 at 0:16

1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.