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?
Network Engineering Stack Exchange is a question and answer site for network engineers. It only takes a minute to sign up.
Sign up to join this communityBased 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?
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?
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?
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...