BGP vs. OSPF vs. EIGRP: 3 Key Comparisons

Border Gateway Protocol (BGP) transmits routing data between autonomous systems, while OSPF and EIGRP are used within autonomous systems.

July 14, 2023

Global network connection concept signifying BGP vs. OSPF vs. EIGRP
  • Border Gateway Protocol (BGP) is defined as a networking protocol to exchange routing data among autonomous systems.
  • Open Shortest Path First (OSPF) is defined as a link-state routing protocol to find the optimum path between the source router and the destination router.
  • Enhanced Interior Gateway Routing Protocol (EIGRP) is defined as a distance-vector protocol to automate routing configuration and decisions on a network.
  • This article covers the critical comparisons between the three protocols.

What Is Border Gateway Protocol (BGP)?

Border Gateway Protocol (BGP) enables data routing, a vital function for the internet to work. For instance, a user in India wishes to load a website with its origin servers in the US. BGP would allow communication between the server and the user to happen efficiently and swiftly.

In simple terms, BGP is the equivalent of the internet’s postal service. As we know, the postal service is responsible for picking up the mail dropped at the post office or in mailboxes, processing it, and allocating a swift and efficient route for its delivery. Similarly, BGP is responsible for checking all the routes available to deliver data submitted via the internet and picking the most efficient one. Typically, these routes pass between autonomous systems.

Before we dive deeper into the concept of BGP, we should understand what an autonomous system is. If the internet is described as a ‘network of networks,’ autonomous systems are the thousands of networks the internet can be broken down into. Each autonomous system is a large network of routers operated by a single entity.

Continuing the analogy of BGP as the internet’s postal service, autonomous systems are like regional mail sorting centers. Any city or town will likely have several local post offices and hundreds (if not thousands) of mailboxes; however, all the mail must go to the nearest sorting center before it can be routed to its destination.

The network routers existing within an autonomous system can then be considered local post offices. Outbound transmissions from these routes are forwarded to the autonomous system, which then leverages BGP routing to transmit them to their destinations.

Simplified Overview of Border Gateway Protocol (BGP)

Simplified Overview of Border Gateway Protocol (BGP)

Source: CloudflareOpens a new window

The diagram above assumes only six autonomous systems exist on the internet. If AS1 must route data to AS3, it has two options: hopping to AS2 and then to AS3 or taking the longer route and hopping from AS6 to AS5, to AS4, and then to AS3.

In a simplified overview like this, the decision-making process is obvious as the AS2 route needs fewer hops than the AS6 route and is, therefore, the swiftest and most efficient route (plus, all the autonomous systems are homogeneous). However, the decision-making process is significantly more complicated in reality because hundreds of thousands of autonomous systems exist on the internet. Additionally, the complex BGP routing algorithm accounts for many more factors than just hop count since autonomous systems are not homogeneous in real life.

In fact, it can be said that BGP is required because the very structure of the internet is uncertain, with constant changes in system availability and the rapid introduction of new systems. This also means that every autonomous system has to be constantly updated with data on new and obsolete routes. This feat is achieved through peering sessions, with every autonomous system connecting to neighboring autonomous systems over a TCP/IP connection to share routing data. Each autonomous system uses this data to correctly and efficiently route outbound data transmissions.

However, unlike the sorting centers and post offices in a postal network, autonomous systems and routers are not part of the same organization and might even belong to competing enterprises that levy fees on each other for network throughput. As such, BGP routing must often account for these fees and other business considerations.

Autonomous systems are typically owned and operated by large entities such as tech companies, internet service providers (ISPs), universities, scientific institutions, and government agencies. Autonomous systems wishing to exchange routing data must be registered and have an autonomous system number (ASN). These ASNs are assigned by the Internet Assigned Numbers Authority (IANA) to Regional Internet Registries (RIRs), from where they are assigned to ISPs and networks.

ASNs are formatted as 16-bit numbers between 1 and 65534 and 32-bit numbers between 131072 and 4294967294. As of 2021, the number of ASNs in use worldwide exceeds 100,000. These ASNs are only needed for external BGP.

See More: What Is Software-Defined Networking (SDN)? Definition, Architecture, and Applications

What Is Open Shortest Path First (OSPF)?

Open Shortest Path First (OSPF) is an IP routing protocol that serves as an Interior Gateway Protocol (IGP) for the internet. OSPF is used to distribute IP routing data throughout a single autonomous system within an IP network.

OSPF is classified as a link-state routing protocol, wherein the routers exchange topology information with their closest neighbors. The topology data is flooded across the autonomous system, which means that every router within the autonomous system has a comprehensive picture of the system topology. This picture is leveraged to calculate end-to-end paths across the autonomous system. Generally, a variant of the Dijkstra algorithm is used for this purpose. Thus, in a link-state routing protocol, the next hop address for forwarding data is determined by selecting the best end-to-end path to the final destination.

A key advantage of OSPF and similar link-state routing protocols is that routers can use comprehensive topology data to compute routes that fulfill specific criteria. This can be ideal for traffic engineering applications where routes can be constrained to meet the specific quality of service standards.

However, a critical limitation of link-state routing protocols is that they do not scale efficiently since more routers are connected to the routing domain. More routers amount to an increase in the frequency and size of topology updates and the length of time taken to compute end-to-end routes. This limitation of scalability makes link-state routing protocols unsuitable for routing over the greater internet, thus limiting their applicability to routing traffic within autonomous systems.

OSPF routers use Link State Advertisement (LSA) messaging to disseminate data about their local state to other routers. This data includes information on the router’s usable interfaces, the cost of using each interface, and reachable neighbors. All routers within the autonomous system use these received messages to create an identical database for describing the system topology. Each router then uses this database to calculate its own routing table using the Dijkstra or Shortest Path First (SPF) algorithm. Routing tables have information on all the destinations the routing protocol is aware of. Each destination is associated with an outgoing interface and next-hop IP address.

Routes are recalculated by the protocol as per the changes in network topology using the Dijkstra algorithm. The protocol aims to minimize the routing protocol traffic generated. Multiple paths of equal cost are supported.

‘Area routing’ is another key feature, wherein a multi-level hierarchy (two levels in the case of OSPF) is provided. This enables the topology information within a defined area of the autonomous system to be hidden from routers outside this area, leading to additional routing protection and reduced routing protocol traffic.

Finally, authentication of all protocol exchanges allows for only trusted routers to join in the routing exchanges for the autonomous system.

See More: What Is a Network Switch? Meaning, Working, Types, and Uses

What Is Enhanced Interior Gateway Routing Protocol (EIGRP)?

Enhanced Interior Gateway Routing Protocol (EIGRP) is a solution that automates routing configuration and decisions on networks. Cisco developed this protocol as a proprietary solution exclusively for Cisco routers.

In 2013, Cisco allowed other vendors to implement a limited EIGRP version with associated features such as High Availability (HA) while limiting access to other features such as EIGRP stub, which enables DMVPN and large-scale campus deployment. Implementation information was published in 2016 with informational status as RFC 7868. This did not qualify as an Internet Standards Track specification, enabling Cisco to retain EIGRP protocol control.

EIGRP is used to share routes with other routers within a single autonomous system. It only transmits incremental updates, making it ideal for decreasing router workload and data transmission. EIGRP was deployed as a replacement for the Interior Gateway Routing Protocol (IGRP) in 1993 due to the latter’s lack of support for classless IPv4 addresses.

EIGRP is a dynamic routing protocol allowing routers to share route data automatically. This helps reduce the workload on network administrators. Along with a routing table similar to OSPF, EIGRP uses a topology table and a neighbor table for information storage. The topology table is used for route storage as learned from neighbor routing tables. On the other hand, the neighbor table tracks the IP addresses of routers with a direct physical connection to the specific router.

Unlike many other distance-vector routing protocols, EIGRP does not transmit the entire information in the router’s routing table whenever a change is made. Rather, only the changes since the last update to the routing table are transmitted. Additionally, the EIGRP routing table is not transmitted periodically but only when an actual change occurs.

EIGRP is generally considered a hybrid protocol since it transmits link state updates upon change. When two routers running EIGRP are connected to each other, the data exchange relationship formed is known as adjacency.

See More: What Is DHCP (Dynamic Host Configuration Protocol)? Meaning, Working, and Features

BGP vs. OSPF vs. EIGRP: 3 Differences

BGP is a networking protocol to exchange routing data among autonomous systems. OSPF is a link-state routing protocol to find the optimum path between the source and the destination router. EIGRP is a distance-vector protocol for automating routing configuration and decisions on a network.

BGP vs. OSPF vs. EIGRP: An Overview

BGP vs. OSPF vs. EIGRP: An Overview

Source: JavaTpointOpens a new window

Let’s have a look at the key differences between BGP, OSPF, and EIGRP.

1. Types

BGP OSPF EIGRP
The three main types of BGP are:
  • External BGP

External BGP or EBGP exchanges routing data between autonomous systems. It is also used to link autonomous systems to make the IP range visible online. Additionally, this protocol is used in conjunction with private ASNs.

  • Internal BGP

Internal BGP or IBGP is suitable for cases where multiple paths egress EGBP. IBGP enables edge routers to share routing attributes and other data. Simply put, IBGP allows for establishing redundant connections. Additionally, it enables routing policies to compute the ideal destination path.

  • MP-BGP

Multiprotocol BGP is a type of IBGP that allows for the distribution of address families, including multicast, IPv6, and layer 2 and layer 3 virtual private networks (VPNs). MP-BGP is primarily used to route private IPs via a service provider backbone.

Additionally, there are four BGP message types:

1) OPEN message, sent to establish the session after the connection is successfully made by the autonomous system, containing all autonomous system data such as BGP version, hold time, identifier, and ASN.

2) UPDATE message, sent after successful session establishment, used to share routing information, containing data on router access feasibility and path attributes.

3) KEEPALIVE, sent to ensure that neighbor routers are up, generally transmitted before an update message, causes the neighbor to reset hold time.

4) NOTIFICATION, sent in case an error occurs, contains error code, specific sub code, and reason.

The four main types of links in OSPF are:
  • Transient link

Here, multiple routers are connected to a network. It has two implementation variations:

a) Unrealistic topology, wherein all routers are interconnected.

b) Realistic topology, when a designated router exists in the network and is connected to all other routers. In this implementation, all the packets transmitted by the routers pass through the designated router.

  • Stub link

Here, the network is linked to a single router. Data enters and exits the network via the same router.

  • Point-to-point link

Here, two routers are connected to each other without any other router or host in between them.

  • Virtual link

Here, a logical connection links two parts of a single OSPF area physically separated by a non-OSPF network. Virtual links are generally used to extend an OSPF backbone area. They need to be used sparingly since they can introduce instability in a network.

When two EIGRP routers are connected, they will use five different types of packets:
  • Hello

This is a multicast message used to find a neighboring router. It has a 0 acknowledgment number and features a timer set at 5 seconds and a hold timer of 15 seconds. It is transmitted regularly.

  • Update

This message transmits the converged routes on a specific router. In cases where either a new route is identified or convergence is complete and the route goes passive, this message is transmitted as multicast.

However, it is transmitted as unicast when syncing topology tables with neighbors during startup. This message is sent between neighbors to build the topology and routing tables. The opcode of this message is 1, and it also has an Autonomous Number. It uses Reliable Transport Protocol to ensure packet reliability.

  • Query

Diffusing Update Algorithm (DUAL) is an EIGRP algorithm used to select and maintain the most optimum route in all networks. In cases where DUAL recalculates a route and the router lacks a viable successor, neighbors will be queried for a possible successor.

Query packet delivery occurs in case of successor route failure and the lack of a viable successor in the EIGRP topology database. The router with the lost route transmits this message to neighbors to check whether their topology table contains the missing route. This message is always unicast when a serial link is in use and multicast when an ethernet link is in use. It has an opcode of 3 and allows users to set a maximum delay period.

  • Reply

Reply packets are issued in response to query packets. The query originator receives reply packets in unicast. This message features an opcode of 4 and uses Reliable Transport Protocol.

  • Ack

Finally, acknowledgment (ack) packets are empty hello packets used to ensure the reliable delivery of EIGRP packets. Ack messages are always transmitted to unicast addresses and not to the multicast group address (sender’s source address). This message will always feature a non-zero acknowledgment number and an opcode of 5.

 

2. Key Features

BGP OSPF EIGRP
BGP uses the path vector protocol method and the best path algorithm. It is an exterior gateway protocol, unlike OSPF and EIGRP.

BGP routers feature a HOP count of 1.

This protocol has a slow convergence speed but can handle very large network sizes.

BGP uses the TCP 179 port number.

For its global routing table entry, the letter ‘B’ represents BGP.

BGP route computation requires each router to have a large link-state database.

The administrative distance (AD) of EBGP is 20 and IBGP is 200.

Finally, the resource consumption of BGP is directly proportional to the size of the routing table.

OSPF uses the link state routing method and the Dijkstra algorithm. Like EIGRP, OSPF is an interior gateway protocol.

OSPF routers feature no limits on HOP count.

This protocol has a fast convergence speed and can handle reasonably large network sizes.

OSPF uses the Multicast IPs 224.0.0.5 and 224.0.0.6 along with port number 89.

For its global routing table entry, the letter ‘O’ represents OSPF.

OSPF route computation leverages link-state technology and calculates the shortest path with the help of the SPF algorithm.

The administrative distance of OSPF is 110.

In terms of resource consumption, OSPF demands high memory and processing power.

EIGRP uses the distance vector protocol method and Diffusing Update Algorithm (DUAL). It is an interior gateway protocol like OSPF.

EIGRP features a maximum HOP count of 224 and a default maximum hop count of 100.

This protocol has a very fast convergence speed and can be used in large networks, similar to OSPF.

EIGRP uses the Multicast IP 224.0.0.10 and the port number 88.

For its global routing table entry, the letter ‘D’ represents EIGRP.

Regarding route computation, EIGRP saves every route instead of only the optimal one to achieve swift convergence.

The administrative distance of EIGRP is 90 (internal route) and 170 (external route).

EIGRP is lighter than OSPF and demands comparatively lower memory and processing power.

 

3. Advantages

BGP OSPF EIGRP
BGP gives users a high degree of control over their own and as well as their neighbor’s route selection.

It is a vital protocol for exchanging reachability and routing data among autonomous systems.

BGP is one of the most widely-used exterior gateway protocols and is more scalable and flexible than OSPF and EIGRP.

Its emphasis lies in computing the best path and enhancing network stability.

Finally, BGP is secure. For instance, it comes with automatic responses to help thwart DDoS attacks.

OSPF is based on an open standard and is compatible with most routers.

It supports networks of all sizes and leverages the SPF algorithm to give users access to a loop-free topology.

Both trigger and incremental updates are used to provide quick convergence.

Variable length subnet mask (VLSM) and route summarization are supported to achieve a hierarchical design.

Both versions of the IP protocol are supported. While OSPFv2 supports IPv4, IPv6 is supported by OSPFv3.

Load balancing with equal-cost routes for a single destination is supported.

EIGRP has an advanced manual route summarization feature, which enhances stability and decreases routing table size.

This protocol is designed to be easy to configure.

It is capable of unequal cost load balancing and uses links more effectively through the equal cost multi-path (ECMP) feature.

Both IPv4 and IPv6 networks are supported.

It provides encryption for enhanced security and can also be used along with IBGP for wide area network (WAN) routing.

It leverages ‘need-based’ updates to reduce network traffic and can route multiple-layer protocols with protocol-dependent modules.

If the destination contains multiple links, EIGRP will identify the variance between them.

See More: What Is NFC (Near Field Communication)? Definition, Working, and Examples

Takeaway

BGP, OSPF, and EIGRP are routing protocols with unique features and benefits. BGP is more suited for interdomain routing, while OSPF and EIGRP are better for intra-domain routing. While BGP enables data routing on the internet at large, OSPF and EIGRP are used more by large organizations.

Did the article help you understand the key differences between BGP, OSPF, and EIGRP? Let us know on FacebookOpens a new window , TwitterOpens a new window , or LinkedInOpens a new window ! We’d love to hear from you.

Image Source: Shutterstock

MORE ON NETWORKING

Hossein Ashtari
Interested in cutting-edge tech from a young age, Hossein is passionate about staying up to date on the latest technologies in the market and writes about them regularly. He has worked with leaders in the cloud and IT domains, including Amazon—creating and analyzing content, and even helping set up and run tech content properties from scratch. When he’s not working, you’re likely to find him reading or gaming!
Take me to Community
Do you still have questions? Head over to the Spiceworks Community to find answers.