Hello everyone,
In this document, I am going to present why the Forward Address is necessary in redistribution of external routes. OSPF always has fun with us. Lets have some fun with OSPF.
Prerequisite: Knowledge of NSSA in OSPF
I am using the following scenario for this presentation. The last octet of the transit IP addresses are the router IDs. For example, the IP address on R2 would be 1.1.1.2. I had to skip some prerequisites since it could be a very long document as it kind of is.
99.99.99.99 has been redistributed in to OSPF. Lets see OSPF database for 99.99.99.99 on R5.
The Forward Address is 172.16.1.1 which is the IP address of R1 loopback interface. OSPF first chooses a loopback interface for Forward Address. If loopback is not present, a physical IP address will be selected. Please refer to Cisco website for more information about Forward Address selection.
ASBR in NSSA area advertises the external routes through LSA 7. ABR translates LSA 7 to LSA 5. It is important to know that only one ABR does the translation. ABR with higher router ID wins the election. ABR replaces its own RID in LSA 5. We see later in this document that some part of metric will be lost because of this translation.
Forward Address is very important. OSPF uses Forward Address to determine the best path and metric. Lets see the routing table of R5.
Metric for 172.16.1.1 is 4. OSPF metric for redistribution is 20 (except from BGP) so the total metric for 99.99.99.99 is 24. Lets prove that OSPF is using Foward Address to calculate metric for external routes. I am going to change the loopback interface cost on R1 to 1000.
Now, you can see the metric for external address is increased to 1023.
I changed the costs to default. Lets see the routing table of R4 for 99.99.99.99 and 172.16.1.1. R4 load balances across R2 and R3 for both when Forward Address is present and Forward Address is a loopback address. (The behavior is different when the Forward Address is not loopback if ASBR has more than one physical interface in OSPF)
There are two equal paths to 99.99.99.99 as there are for 172.16.1.1. Lets suppress Forward Address.
On ABR, you can suppress the Forward Address with the following command.
Lets see OSPF database for external address of 99.99.99.99 on R5. As you see, it changed to all 0.
.
Now, OSPF in area 2 is depending on LSA type 4 to determine the best path path and metric to 99.99.99.99. I am not going to explain how because this document is long enough. I will post another document later. Since ABR is translating LSA type 7 to type 5, metric from ABR to ASBR is lost. It may cause sub optimal routing. Also R2 sends all the packets to the ABR which is translates the LSA 7 to LSA 5.
Lets see the metric after Forward Address suppression. You only see metric from R5 to R3. Metric from R3 to R1 is lost. (metric is 22)
Lets change OSPF costs on all R3 interfaces to 1000
Check the metric again on R5. Metric of loopback interface has been changed but still metric of 99.99.99.99 is 22
Lets check traceroute from R5 to 99.99.99.99. R4 could send the packets to R2 since it is a better path, but still forwards them to R3(6.6.6.3). This is sub-optimal routing because I changed the costs of R3 interfaces to 1000.
Lets have more fun and cause loop. The costs of all the interfaces are 1 now except interface from R3 to R1 has the cost of 1000. It means now the path from R3 to R2 to R1 is better than R3 to R1. But lets see the routing table of R2. R2 points back to R3 for 99.99.99.99
What is the reason? R2 receives type 7 routes from R1 and also type 5 route from R3 after translation. Which one is preferred? Of course, type 5 is preferred.
R3 forwards the packet to R2 and R2 returns them back.
Some points:
Avoids suppressing Forward Address unless you only want one ABR to forward the traffic.
If there are two ABRs, use two interfaces to connect them. ( In later documents, I will explain why)
Use loopback address for Forward Address if ASBR has several interfaces in OSPF domain. Using physical address prevents load balancing and cause sub optimal routing. In my scenario, use 1.1.1.1 on R1 as a Forward Address and see the result based on the metric to see why using loopback is important.
In short, OSPF uses Forward Address to calculate metric and perform optional routing.
Please rate if it is beneficial for you. Wish you the best.
Masoud