Learn
Dynamic Routing Protocols

EIGRP vs. OSPF

Routing protocols are used to automatically and dynamically exchange routing information between routers.  There are several routing protocols to choose from, each with its own pros and cons, as each routing protocol is designed to be well suited to a particular network implementation scenario.  Two of the most popular routing protocols used today are Enhanced Interior Gateway Routing Protocol (EIGRP) and Open Shortest Path First (OSPF). In this article, we will be reviewing these two protocols, including the differences between them and the configuration of networks using these protocols.

EIGRP

EIGRP is an enhanced version of IGRP (as the name says) and was, until recently, a Cisco proprietary routing protocol. EIGRP provides unequal-cost load balancing and rapid convergence. Its “secret sauce” is the diffusing update algorithm (DUAL), which identifies network paths and provides fast reconvergence using loop-free backup paths.

A router can run multiple EIGRP processes. Every process operates in the Autonomous System (AS) context. Each AS represents a common routing domain.

Each EIGRP-speaking router calculating network paths uses several metrics. The routers exchange routing information only using the same metric calculation formula.

It is important to remember that “autonomous system” in an EIGRP context is slightly different from the BGP use of that term.  An autonomous system in EIGRP is a collection of EIGRP routers that fall under a single administrative authority.  Practically, that means that only EIGRP routers in the same autonomous system will exchange EIGRP information.  You must configure the autonomous number of the EIGRP instance running on each EIGRP router, and it must be the same in order for the routers to become neighbors.  If you have multiple EIGRP autonomous systems, the only way to share information between those systems is using redistribution.

BGP on the other hand is able to exchange information within the same AS using iBGP, and between ASes using eBGP.  The idea of an AS is the same, but the implementation used by each protocol is different.

OSPF

OSPF is a link-state routing protocol that uses link-state advertisements for network destinations. The route calculation performed on the link-state information uses the shortest path first (SPF) algorithm. Each router running OSPF floods link-state information about its attached interfaces and metrics to inform other routers.

As with EIGRP, OSPF is confined to an autonomous system, which is a single routing domain. The OSPF AS can be a single area or divided into multiple areas. The routers from an area have identical link-state databases. They also have summarized information about the other areas.

The external routing information is kept separate from the OSPF link-state data. It can be passed transparently throughout the AS.

Summary of Differences Between EIGRP and OSPF

Table 1 shows a summary of some of the differences between EIGRP and OSPF.

EIGRP
OSPF
Routing domain
Intradomain Intradomain
Size of the network
Suitable in mid-sized to large networks with up to several hundred routers Suitable in mid-sized to large networks with up to several hundred routers
Protocol Type
Distance-vector Link-state
Implementation
Easy for basic configuration Easy for basic configuration
Network topology
Flat Hierarchical
Convergence
Fast Fast
Resource requirements
Lower CPU and memory needs Memory - and CPU-intensive
Metric
Combination of bandwidth, reliability, load, and delay Based on bandwidth/cost
Load balancing
Supports unequal path load balancing Equal path load balancing
Filtering and summarization
Possible on any interface of any router Only on ABR or ASBR

Discussion of Differences Between EIGRP and OSPF

There are a few similarities between the two protocols. Both are interior gateway protocols, so they are confined to a single routing domain. They can operate in extensive networks consisting of hundreds of routers. 

The difficulty configuring basic features is low for each: Turn on the protocol and advertise the direct networks. However, keep in mind that both can get very complicated  if a complex routing design is required.

To scale better, OSPF requires the network to be partitioned into areas. EIGRP does not have this partitioning requirement.

Both protocols converge faster than other interior gateway protocols or BGP. However, EIGRP is faster than OSPF due to an internal mechanism that we will cover later in this article.

In terms of resource requirements, EIGRP does not pose the same burden on the routers for a given scale of the network. OSPF uses as a metric the interface bandwidth, whereas EIGRP uses a combination of parameters to calculate the metric.

One significant difference between EIGRP and OSPF is that the former supports unequal path load balancing. This means it allows better usage of the links at different speeds to forward traffic simultaneously. Another significant difference is that summarization is possible with EIGRP on any router on any interface. When the routing protocol is OSPF, there are strict router types where the summarization can happen.

The inner workings of EIGRP and OSPF

This section describes the two protocols in more detail, focusing on the most common options that we will see configured in the article’s next section.

EIGRP

EIGRP has four major components:

  • Neighbor Discovery: Used by routers to learn about the other routers on their directly attached networks. The routers can determine if neighbors are unreachable through Hello packets. Following this assessment, the neighboring routers can exchange routing information.
  • Reliable Transport Protocol (RTP): Protocol in charge of the guaranteed and ordered delivery of EIGRP packets. RTP supports unicast and multicast delivery of the packets. When the packets do not need to be acknowledged (e.g., Hello packets), the destination IP address of the packets is 224.0.0.10.
  • DUAL Finite State Machine (FSM): Responsible for tracking all the routes and for selecting loop-free paths and inserting them into a routing table.
  • Protocol Dependent Modules (PDM): Responsible for multiple network protocol support, like IP and IPv6.

EIGRP uses five types of packets:

  • Hello - Used for neighbor discovery. They are sent as multicast and do not require acknowledgment.
  • Update - Contain route information. When a new route is discovered, the packets are sent as multicast. The router sends the packet unicast for synchronization (when a new EIGRP router comes up). They require acknowledgment.
  • Query - When a route computation happens, and there is no feasible successor, a query is sent to its neighbors. Most of the time, they are multicast and require acknowledgment. In some specific cases, the packets are sent unicast.
  • Reply - Sent in response to a query packet. They are unicast and sent reliably.
  • ACK - Used to acknowledge updates, queries, and replies. They do not require acknowledgement.

When an EIGRP router calculates the route metric, it can use up to five variables. By default, only two are used: bandwidth and delay. The other three variables are reliability, load, and MTU. Each variable can influence the metric calculation based on weight values that are present in the Hello packets. For a neighborship to be established, the weight values of the variables must match.

Before discussing EIGRP terminology, let’s consider the topology in Figure 1. The values in parentheses represent the metric for each segment.

Figure 1: EIGRP Topology.

Given the above topology, we can identify the following:

  • Successor route: The route with the lowest metric to reach the destination. In this case, the successor route for R1 to reach 10.0.0.0/24 is R1 - R2 - R3.
  • Successor: The next-hop router for the successor route. In this case, R3 is the successor.
  • Feasible Distance (FD): The lowest metric to reach a destination. In this case, on R1, FD will be 250 + 250 + 1000 = 1500.
  • Reported Distance (RD): The metric reported by a router to reach a destination. R2 advertises the 10.0.0.0/24 prefix to R1 with an RD of 1250. At the same time, the RD that R2 is advertising is its own FD.
  • Feasibility Condition: The RD received for a route must be less than the FD the router calculates to consider the route as a backup.
  • Feasible Successor: A backup route that satisfies the feasibility condition. In this case, it is the R1 - R3 path, because the RD advertised by R3, 1000, is less than R1 FD, 1500.

The complete topology is shown in Figure 2.

Figure 2: EIGRP Topology with explanations.

Two other important EIGRP terms:

  • Neighbor Table: When a router discovers a new neighbor, it includes the IP address and the interface to reach the neighbor in the neighbor table. The neighbor table is similar to the adjacency database found in link-state protocols.
  • Topology Table: This table contains all the destinations received from neighbor routers.

OSPF

Before two OSPF routers exchange link-state information — thereby becoming adjacent — they must become neighbors. The neighborship is established through Hello packets. While some of the information from the Hello packets is not necessary to match across the routers, some of it must match. 

The following information must be the same in the Hello packets sent by the routers:

  • Area
  • Router ID
  • Subnet 
  • Hello and dead timer
  • Stub flag
  • Authentication 

The OSPF Hello protocol will elect a Designated Router (DR) and a Backup DR (BDR) to reduce link-state information exchange. The DR and BDR elections happen only on a multi-access segment. This means all the routers from the segment will become adjacent just with the DR and the BDR. All the routers in a multi-access segment, except DR and BDR, assume the role of DROther. In the case where there are only two routers in the multi-access segment, there will be just a DR and a BDR.

The DROther routers will send the link-state information just to the DR and BDR (by sending the updates to 224.0.0.6), which will, in turn, will relay the information to all the other DROther routers from the segment (by sending the updates to 224.0.0.5).

There are two rules to elect the BDR and the DR:

  • Priority: The highest priority is preferred.
  • Router ID: The highest ID is preferred, which can be set manually or derived from a router interface (the loopback interface’s IP address takes precedence over physical interfaces).

Considering that all the OSPF parameters are using default values, the link-state exchange will happen on a broadcast segment, as shown in Figure 3.

Figure 3: DR, BDR, and DROther. 

Based on the type of LSAs that can be present in an area, the following are the OSPF areas.

Area Types
LSA 1
LSA 2
LSA 3
LSA 4
LSA 5
LSA 7
Backbone Area
Yes Yes Yes Yes Yes No
Non-backbone Area
Yes Yes Yes Yes Yes No
Stub Area
Yes Yes Yes No No No
Totally Stubby Area
Yes Yes No No No No
Not-So-Stubby Area
Yes Yes Yes No No Yes

It is worthwhile taking some time to touch on LSA types:

  • LSA Type 1 - Router LSA: Generated by every router and describes links.
  • LSA Type 2 - Network LSA: Generated by the DR and describes the routers connected to the segment.
  • LSA Type 3 - Network Summary LSA: Generated by the Area Border Router and sent to another area to represent the destinations outside that area.
  • LSA Type 4 - ASBR Summary: Used to describe the router that advertises external routes.
  • LSA Type 5 - AS External LSA: Represents the routes external to the AS.
  • LSA Type 7 - NSSA External: Represents the external routes from an NSSA area converted to a Type 5 LSA.

{{banner-8="/design/banners"}}

Configuration

This section shows how to configure basic EIGRP and OSPF on Cisco routers.

EIGRP

For EIGRP, we will use the diagram in Figure 4.

Figure 4: Single AS EIGRP.

As mentioned before, the EIGRP configuration requires an Autonomous System. In this case, we will use AS 1.

Following the interface configuration, below is the EIGRP configuration on R1.

router eigrp 1
 network 1.1.1.1 0.0.0.0
 network 12.12.12.1 0.0.0.0
 network 13.13.13.1 0.0.0.0

R2 and R3 have very similar configurations. For example, below you can see R2.

router eigrp 1
 network 1.1.1.2 0.0.0.0
 network 12.12.12.2 0.0.0.0
 network 23.23.23.2 0.0.0.0

If the EIGRP configuration is correct on all the routers, they should become EIGRP neighbors. Although the example below is for R1, this works similarly on R2 and R3.

R1#show ip eigrp neighbors
EIGRP-IPv4 Neighbors for AS(1)
H   Address                 Interface              Hold Uptime   SRTT   RTO  Q  Seq
                                                   (sec)         (ms)       Cnt Num
1   12.12.12.2              Et0/0                    14 01:09:10    7   100  0  9
0   13.13.13.3              Et0/1                    11 01:10:22    5   100  0  10
R1#

Below is the R2 routing table with the EIGRP routes.

R2#show ip route eigrp

      1.0.0.0/32 is subnetted, 3 subnets
D        1.1.1.1 [90/409600] via 12.12.12.1, 01:11:59, Ethernet0/0
D        1.1.1.3 [90/409600] via 23.23.23.3, 01:11:59, Ethernet0/2
      13.0.0.0/24 is subnetted, 1 subnets
D        13.13.13.0 [90/307200] via 23.23.23.3, 01:11:59, Ethernet0/2
                    [90/307200] via 12.12.12.1, 01:11:59, Ethernet0/0
R2#

R2 has two next hops to reach the subnet between R1 and R2.

The next step is to redistribute the static routes on R1, so the EIGRP speaking routers will have external information. The command below enablesthe redistribution of static routes.

router eigrp 1
 network 1.1.1.1 0.0.0.0
 network 12.12.12.1 0.0.0.0
 network 13.13.13.1 0.0.0.0
 redistribute static

Right after this change, the external routes are present in the routing table as EIGRP external routes.

R2#show ip route eigrp

      1.0.0.0/32 is subnetted, 3 subnets
D        1.1.1.1 [90/409600] via 12.12.12.1, 01:13:18, Ethernet0/0
D        1.1.1.3 [90/409600] via 23.23.23.3, 01:13:18, Ethernet0/2
      13.0.0.0/24 is subnetted, 1 subnets
D        13.13.13.0 [90/307200] via 23.23.23.3, 01:13:18, Ethernet0/2
                    [90/307200] via 12.12.12.1, 01:13:18, Ethernet0/0
      100.0.0.0/32 is subnetted, 2 subnets
D EX     100.100.100.1 [170/307200] via 12.12.12.1, 00:00:10, Ethernet0/0
D EX     100.100.100.2 [170/307200] via 12.12.12.1, 00:00:10, Ethernet0/0
R2#

The above scenario and configuration are basic and can be enough for most deployments. A default route injection can be configured and redistributed from another routing protocol into EIGRP.

OSPF

For OSPF, we will use the following diagram of a multi-area OSPF network. In this scenario, R3 is the ABR, because it has interfaces in both area 0 and area 1. Area 1 is a non-backbone area (not a stub, stubby, or NSSA). R1 is the Autonomous System Boundary Router (ASBR) because it redistributes external routes (static routes) into OSPF.

Figure 5: Multi-area OSPF.

Following interface configuration, below is what is required on R1 to be configured as a router in the backbone area.

router ospf 1
 network 1.1.1.1 0.0.0.0 area 0
 network 10.10.10.1 0.0.0.0 area 0

Because R3 is the ABR, the configuration is as follows (see below).

router ospf 1
 network 1.1.1.3 0.0.0.0 area 0
 network 10.10.10.3 0.0.0.0 area 0
 network 20.20.20.3 0.0.0.0 area 1

R4 is an internal router of Area 1, so its configuration is similar to that of R1.

router ospf 1
 network 1.1.1.4 0.0.0.0 area 1
 network 20.20.20.4 0.0.0.0 area 1

Before we move on and redistribute some external routes into OSPF, let’s see the status of OSPF adjacencies and the routing table. The link between R1 and R3 is broadcast. Therefore, a DR and a BDR are elected. In this case, R1 is the BDR and R3 is the DR.

R1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.3           1   FULL/DR         00:00:37    10.10.10.3      Ethernet0/0
R1#

On R4, the output will be similar, just a single OSPF neighbor, R3. You can see below how the routing table of R4 will look (all the routes will show up as OSPF inter-area, OIA, routes).

R4#show ip route ospf

      1.0.0.0/32 is subnetted, 3 subnets
O IA     1.1.1.1 [110/21] via 20.20.20.3, 2w0d, Ethernet0/0
O IA     1.1.1.3 [110/11] via 20.20.20.3, 2w0d, Ethernet0/0
      10.0.0.0/24 is subnetted, 1 subnets
O IA     10.10.10.0 [110/20] via 20.20.20.3, 2w0d, Ethernet0/0
R4#

Now going further, this is how static routes are redistributed in OSPF.

router ospf 1
 redistribute static subnets

Before checking the routing table, the external routing information must show up as external LSAs in the OSPF database.

R1#sh ip ospf  database | begin Type-5
                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
100.100.100.1   1.1.1.1         212         0x80000001 0x00A1CC 0
100.100.100.2   1.1.1.1         212         0x80000001 0x0097D5 0
R1#

In the routing table of R4, these routes should appear as external type 2 (E2) because this is the default metric type when external routing information is redistributed in OSPF.

R4#show ip route ospf | i E2
O E2     100.100.100.1 [110/20] via 20.20.20.3, 00:04:21, Ethernet0/0
O E2     100.100.100.2 [110/20] via 20.20.20.3, 00:04:21, Ethernet0/0
R4#

Conclusion

EIGRP and OSPF are arguably the most popular IGPs being used today.  Both can be found extensively in many enterprise networks, and both are very mature and robust in their implementation and operation.  Which one is actually used often depends upon factors other than “which is better” because there is no consensus across the board to answer that question.

The choice depends more upon the vendor being used (OSPF is generally available on more vendor devices than OSPF), the experience of the implementor (network administrators will typically implement what they are more familiar with), and the routing protocols being used by ISPs and WAN providers at the network edge.