Open In App
Related Articles

Difference between OSPF and BGP

Improve Article
Save Article
Like Article

Open Shortest Path First (OSPF): 
OSPF is type of hierarchical network topology or design. OSPF prefers fastest path rather than shortest path. In Open Shortest Path First, internet protocol is used. It uses link-state-routing (LSR) algorithm for its functionality.

OSPF is an Interior Gateway Protocol (IGP), where routers connect networks using the Internet Protocol (IP). It is a router protocol which is used to find the best path for packets when they are passing through the set of connected networks simultaneously. The main disadvantage of OSPF is that it is difficult than other protocols.


Here, Area 0 is the central area and other two areas are connected to it.

Border Gateway Protocol (BGP): 
BGP is the type of mesh topology or design. Border gateway protocol prefers best path. In border gateway protocol, Transmission control protocol is used. The main difference between OSPF (Open Shortest Path First) and BGP (Border Gateway Protocol) is that, Open Shortest Path First is an intra-domain routing protocol while, Border Gateway Protocol is the inter-domain routing protocol.

For example- If a user in India loads a website with origin servers in Singapore, then this BGP protocol is the one which enables the communication to happen quickly and efficiently. Another example is that if someone submits any data through the internet, then it is the responsibility of BGP protocol to look after all the available path in which data can travel.


Here, all prefixes are accepted into AS5539 which gets tagged with a community value:

  • 5539:500 = customer
  • 5539:100 = peering (decix)
  • 5539:250 = upstream(NTT)

Let’s see the difference between OSPF and BGP:

1.OSPF stands for Open Shortest Path First.BGP stands for Border Gateway Protocol.
2.The implementation of OSPF is easy.While the implementation of BGP is difficult.
3.OSPF is a fast concurrence.While BGP is a slow concurrence.
4.OSPF is type of hierarchical network topology or design.While it is the type of mesh topology or design.
5.It is also called as internal gateway protocol.While it is called as external gateway protocol.
6.In OSPF internet protocol is used.While in this, Transmission control protocol is used.
7.It works in 89 port number.While it works in 179 port number.
8.OSPF is a Link State type.While it is a Vector State type.
9.In OSPF Dijkstra algorithm is used.While in this Best path algorithm is used.
10.OSPF prefers fastest path rather than shortest path.While It prefers best path.
11.It requires device resources- CPU and memory.It relies for the device resources type on the size of routing table, although it scales better.
12.Its metric is determined by bandwidth.Its metric is determined using AS path, IGP-Metric, Next Hop, Weight, etc.
13.It is used mainly for small networks that can be managed centrally.It is for large networks such as Internet.
14.It prefers fastest path over shortest path.It prefers best path.
15.The training cost involved is less.The training cost is comparatively more than OSPF.
Last Updated : 21 Feb, 2023
Like Article
Save Article
Similar Reads