New Batch Starts on 16th Oct.
Module: Network Fundamentals (L2 L3 Protocol Testing)
Timing: 07:00 AM to 08:00 AM IST (Weekdays)
Sign Up Now !

Understanding OSPF Redistribution

Table of Contents

Understanding OSPF Route Redistribution and LSA Types

OSPF (Open Shortest Path First) Redistribution allows different routing protocols or different OSPF instances to share route information effectively. When you introduce routes from one protocol into OSPF, it requires careful handling of Link State Advertisements (LSAs) and route types to ensure seamless communication. This guide walks you through the concept of route redistribution in OSPF, how LSA 4 and LSA 5 are used in the process, and the role of the “Forwarding Address” in LSA 5. Additionally, we’ll explain the differences between OSPF E1 and E2 routes and cover how to configure redistribution in an OSPF environment.


What is Route Redistribution?

Redistribution shares networks from one protocol to another within a router. When you run two or more protocols on different interfaces of a router, you can use redistribution to learn and share networks between these protocols. Redistribution won’t work if one protocol is on one router and another protocol is on a different router. You should configure the protocols on the same router, typically on different interfaces.

In the figure below, OSPF connects R1 and R2, while EIGRP connects R2 and R3. R2 learns about the 30.0.0.0 network from R3 using EIGRP. By default, R2 won’t pass this network to OSPF, so R1 won’t be able to access it. By performing route redistribution on R2 from EIGRP to OSPF, we can share the network with OSPF and pass it on to R1.

A topology showing route redistribution in OSPF
Route Redistribution from EIGRP to OSPF

Redistribution in OSPF

OSPF uses three types of LSAs during redistribution, which are Router LSA (Type 1), ASBR Summary LSA (Type 4), and AS External LSA (Type 5)

These are the different events that will happen once we configure redistribution:

  • The ASBR will use Router LSAs (Type 1) to announce itself as the ASBR when we configure redistribution. The ASBR will set the ‘E’ flag bit in the Router LSA to inform everyone in its area that it is now acting as an ASBR.
  • When the ABR gets the Router LSA with the “E” bit set, it will generate LSA 4 containing the Router ID of the ASBR. This informs everyone outside the area about the new ASBR.
  • Finally, the ASBR will generate LSA 5 containing the redistributed networks.

How LSA 4 is used in Redistribution?

The ABR uses LSA 4 to advertise the presence of the ASBR to routers in other areas. The ABR learns about the ASBR when it receives a Router LSA from the ASBR with the E flag set. This Router LSA informs all routers within the ASBR’s area about its presence. However, the Router LSA does not propagate outside the area. To inform other areas, the ABR generates an LSA 4, which includes the ASBR’s Router ID, and sends it to all other areas​.


How LSA 5 is Used in Redistribution?

LSA 5 contains the redistributed networks that the ASBR learns from other routing protocols. When an ASBR discovers routes from protocols like BGP, it generates an LSA 5 to share these routes with other OSPF routers. This LSA includes the external network’s address, network mask, and the metric type (E1 or E2). It can also have a forwarding address to suggest an alternative route. The scope of LSA 5 extends across the entire OSPF autonomous system, ensuring all routers know how to reach external destinations through the ASBR.


What is “Forwarding Address” in LSA 5?

The “Forwarding address” field in an AS-external-LSA (Type 5 LSA) suggests an interface IP that other routers can use to reach the redistributed network in that LSA. By default, OSPF sets the forwarding address to 0.0.0.0, indicating that routers should send packets directly to the ASBR itself.

The ASBR can specify a different IP address in the forwarding address field if it wants to redirect traffic through another device. This address can be the IP of another router’s interface, which helps when the ASBR is not the best next hop for reaching the external destination. This feature proves particularly useful when an ASBR receives external routes from a non-OSPF routing protocol (e.g., BGP) and needs to direct traffic through a router that isn’t participating in OSPF but is closer to the external destination.

Network topology showing four routers with an OSPF ASBR redistributing routes from BGP, using a Forwarding Address
R3 (ASBR) redistributing using R4’s IP as forwarding address

In the above topology, R1, R2, and R3 are using OSPF, and BGP is running between R3 and R4. Here, R3 (the ASBR) learns BGP routes from R4 (in this example, the route to 40.0.0.0) and redistributes that route into the OSPF domain using a Type 5 LSA.

Although R3 is responsible for sending the redistributed network information to R2, R2 can directly reach R4 (with IP address 2.2.2.4) to forward data packets to the 40.0.0.0 network. In this case, R3 will set the Forwarding Address in the Type 5 LSA to 2.2.2.4, indicating that R2 should use this address as the next hop to reach the redistributed network 40.0.0.0, rather than routing the traffic back through R3.

We can conclude that the Forwarding Address is set under the following conditions:

  1. The ASBR and another non-OSPF router are on the same subnet.
  2. The ASBR learns routes from this non-OSPF router on the subnet.
  3. The non-OSPF router is the actual gateway to the external network, so the ASBR sets the Forwarding Address to this router’s IP

OSPF E1 and E2 Routes

When OSPF advertises a redistributed network, it uses two types of metrics: External Type 1 (E1) and External Type 2 (E2).

When OSPF advertises a redistributed network using the E1 metric type, it includes both the cost to reach the ASBR and the cost advertised by the ASBR for the redistributed network. This means that the total path cost to the external destination is the sum of the internal OSPF cost to reach the ASBR and the external cost provided by the ASBR.

On the other hand, when OSPF uses the E2 metric type, it only considers the cost advertised by the ASBR for the redistributed network. The internal cost to reach the ASBR is not included in the path calculation, making the E2 cost static regardless of the location within the OSPF domain. By default, OSPF uses E2 metric type for all redistributed networks unless explicitly configure otherwise.


Configuring Redistribution:

To configure OSPF on a Cisco router, use the “redistribute” command under the OSPF configuration mode.

For example, in the topology given above, to redistribute networks from EIGRP, enter the following commands on R2:


Next >>> Cisco OSPF Redistribution Commands and Examples

Previous >>> Understanding OSPF DR BDR Election

Further reading: cisco


We’d love to hear your feedback and suggestions about this article. Feel free to reach out to us using the WhatsApp number below.

Sajith Achipra has been a trainer and testing consultant at Zframez Technologies since 2009. With 15+ years of experience, he specializes in networking, Python, development, and testing. He conducts online courses to help students and professionals enhance their skills. You can reach him on WhatsApp at +91 8884 884 844 for your training and testing requirements.