Based on the same statements in all the books and articles , OSPF is IGP (Interior Gateway Protocol) , i.e, we can use it between 2 routers that are in the same Autonomous system .

Can we use OSPF for EGP Communication?

  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can post and accept your own answer.
    – Ron Maupin
    Jan 5, 2021 at 2:24

3 Answers 3


This question is akin to asking, "Why can't I use a screwdriver to hammer nails?"

You could use OSPF in certain inter-AS situations if you REALLY, REALLY wanted to/needed to. There would be many "gotchas" and caveats to keep in mind when utilizing OSPF as an EGP.

Just like you could hammer nails with a screwdriver. However, you would risk breaking the screwdriver, harming yourself, etc.

You could do it, but why would you? There is a perfectly usable/heavily implemented routing protocol created for inter-AS communication, BGP. Why attempt to utilize OSPF for an undesigned purpose?

  • I had a business partner that would not run bgp, so my question was "I ONLY have a screwdriver can I use it to hammer nails"
    – fredpbaker
    Nov 11, 2013 at 12:24

Nothing prevents you from using OSPF to connect two separate networks. When companies merge this happens quite often. Is it a good idea? Probably not. Why?

  1. Scalability: OSPF needs a lot more resources (by design) than BGP. Every router needs a full OSPF database (ignoring features like stubby areas) and the SPF calculations need lots of CPU time.
  2. Filtering: You will get every route from your neighbour if you want to or not. You can't filter (again by design) because OSPF needs a full database on every router to make routing decisions. This is why you don't want to speak OSPF with your customers as well. If they send you more specifics for your networks you're screwed. If they send you 100k routes, you're screwed.
  3. Traffic engineering: With BGP you have much more possibilities to influence where your traffic is going. In OSPF you're rather limited to path costs and route types for external routes.

So in summary, there are situations where it is necessary to speak OSPF to an external entity but most of the time it's better to use a protocol designed to connect different autonomous entities, like BGP.


If your problem is that you have two sites/business parters etc that have separate Internet ASes you can connect them together NOT through the Internet but over a VPN or private link. You have a couple of things to watch for if the address spaces are also advertised via the internet relate to administrative distance and prefix matching. BGP is preferred for many reasons, and you have to use it to talk over the internet. A little more on your use case assuming it is not entirely theoretical would help. At the end of the day there is no law that prevents you from using an IGP. But remember that any network vendor is in the business of selling you rope, what you do with the rope...

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.