Wednesday, June 12, 2013

OSPF Forwarding Address



OSPF forwarding address was introduced to overcome sub-optimal routing that can happen in certain scenarios when the ASBR redistributes external routes and flood it into an area. One of these cases can be illustrated in the following topology




Let us assume the following scenario where R2 and ASBR are connected to both the RIP domain and OSPF domain, but only ASBR is doing mutual redistribution between OSPF and RIP. the ASBR will start flooding external routes inside Area 0 announcing itself as the forwarding address to reach these external networks.

ASBRs announces the forwarding address in two modes:

Zero forwarding address 0.0.0.0 and Non-Zero forwarding address

Zero Forwarding address tells the rest of the routers in the OSPF domain that the ASBR itself is your gateway to get to the external routes, in our case here R2 and R4 can R1 loopback0 1.1.1.1 route as follow:

R2#show ip route 1.1.1.1
Routing entry for 1.1.1.1/32
  Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 10
  Last update from 10.2.3.3 on FastEthernet0/1, 01:01:13 ago
  Routing Descriptor Blocks:
  * 10.2.3.3, from 3.3.3.3, 01:01:13 ago, via FastEthernet0/1
      Route metric is 20, traffic share count is 1
  R2#show ip ospf database external 1.1.1.1            OSPF Router with ID (2.2.2.2) (Process ID 1)                Type-5 AS External Link States
  Routing Bit Set on this LSA
  LS age: 1789
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 1.1.1.1 (External Network Number )
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000002
  Checksum: 0x5D32
  Length: 36
  Network Mask: /32
        Metric Type: 2 (Larger than any link state path)
        TOS: 0
        Metric: 20
        Forward Address: 0.0.0.0
        External Route Tag: 0



R4# show ip route 1.1.1.1
Routing entry for 1.1.1.1/32
  Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 11
  Last update from 10.2.4.2 on FastEthernet0/0, 01:03:44 ago
  Routing Descriptor Blocks:
  * 10.2.4.2, from 3.3.3.3, 01:03:44 ago, via FastEthernet0/0
      Route metric is 20, traffic share count is 1

R4#show ip ospf database external 1.1.1.1
            OSPF Router with ID (4.4.4.4) (Process ID 1)
                Type-5 AS External Link States
  Routing Bit Set on this LSA
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 1.1.1.1 (External Network Number )
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000002
  Checksum: 0x5D32
  Length: 36
  Network Mask: /32
        Metric Type: 2 (Larger than any link state path)
        TOS: 0
        Metric: 20
        Forward Address: 0.0.0.0
        External Route Tag: 0
  LS age: 1910

Looking at the above outputs, it's easily seen that any traffic sourcing from R4 heading to R1 will take the path R4 - R2 - ASBR - R1, which is considered sub-optimal routing since it takes an extra hop compared to the path R4 - R2 - R1. Even for R2 the way to get to R1 is through the ASBR.

A traceroute to verify the traffic path.


R2#traceroute 1.1.1.1
Type escape sequence to abort.
Tracing the route to 1.1.1.1
  1 10.2.3.3 28 msec 28 msec 4 msec
  2 20.1.123.1 36 msec 36 msec 16 msec
R4#traceroute 1.1.1.1
Type escape sequence to abort.
Tracing the route to 1.1.1.1
  1 10.2.4.2 20 msec 32 msec 12 msec
  2 10.2.3.3 28 msec 20 msec 16 msec
  3 20.1.123.1 56 msec 40 msec 24 msec


Now to overcome this behavior OSPF forwarding address can be set no a Non-Zero by meeting some of these conditions:

  • OSPF is enabled on the ASBR's next hop interface AND
  • ASBR's next hop interface is non-passive under OSPF AND
  • ASBR's next hop interface is not point-to-point AND
  • ASBR's next hop interface is not point-to-multipoint AND
  • ASBR's next hop interface address falls under the network range specified in the router ospf command.
  • Any other conditions besides these set the forwarding address to 0.0.0.0
Now let's enable OSPF on int F0/0 attached to ASBR, and since it's an Ethernet; it defaults to be a network type Broadcast OSPF interface and since it's the same subnet with router R2 in the RIP domain, we've got all the above conditions covered.


ASBR(config)#int f0/0
ASBR(config-if)#ip ospf 1 a 0
Of course there will be NO neighborship formed on this interface with any of the other routers on the same segment, but the idea is OSPF external routes can't use external routes as next-hops, so the ASBR presents it self as the forwarding address to that external route, and by advertising network 20.1.123.0/24 into the OSPF area as type-1 LSA, that overcomes that problem.

When the packet sourced from R4 reaches R2 on it's way to R1 loopback, the forwarding address is then directly connected to R2, that's when R2 decided it should route the packet through it's F0/0 interface eliminating that extra hop through the ASBR, which tells why the ASBR and R2 interfaces should be an OSPF broadcast type and in the same subnet.

let's see what R2 and R4 routing table and OSPF database now

R2#show ip route 1.1.1.1
Routing entry for 1.1.1.1/32
  Known via "rip", distance 120, metric 1
  Redistributing via rip
  Last update from 20.1.123.1 on FastEthernet0/0, 00:00:06 ago
  Routing Descriptor Blocks:
  * 20.1.123.1, from 20.1.123.1, 00:00:06 ago, via FastEthernet0/0
      Route metric is 1, traffic share count is 1
R2#show ip ospf database external 1.1.1.1
            OSPF Router with ID (2.2.2.2) (Process ID 1)
                Type-5 AS External Link States
  LS age: 882
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 1.1.1.1 (External Network Number )
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000005
  Checksum: 0x9367
  Length: 36
  Network Mask: /32
        Metric Type: 2 (Larger than any link state path)
        TOS: 0
        Metric: 20
        Forward Address: 20.1.123.1
        External Route Tag: 0

R4#show ip route 1.1.1.1
Routing entry for 1.1.1.1/32
  Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 21
  Last update from 10.2.4.2 on FastEthernet0/0, 02:07:15 ago
  Routing Descriptor Blocks:
  * 10.2.4.2, from 3.3.3.3, 02:07:15 ago, via FastEthernet0/0
      Route metric is 20, traffic share count is 1

R4#show ip ospf database external 1.1.1.1
            OSPF Router with ID (4.4.4.4) (Process ID 1)
                Type-5 AS External Link States
  Routing Bit Set on this LSA
  LS age: 1007
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 1.1.1.1 (External Network Number )
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000005
  Checksum: 0x9367
  Length: 36
  Network Mask: /32
        Metric Type: 2 (Larger than any link state path)
        TOS: 0
        Metric: 20
        Forward Address: 20.1.123.1
        External Route Tag: 0


Now you notice that for R2 and R4, the forwarding address is 20.1.123.1 which is the interface F0/0 connected to R1. Now for R2 to reach 1.1.1.1 it needs to forward the traffic to 20.1.123.1 which is directly connected to it's interface, so no need to send the traffic to the ASBR anymore since it will prefer the directly connected interface.

Now for R4, the advertising router is still 3.3.3.3 which is R3, but the forwarding address is changed to 20.1.123.1, and since packet destined from R4 to R1 must path through R2, R2 will forward the traffic with the same manner mentioned before also eliminating the need to go through that extra hop via the ASBR.

let's do a traceroute to finally see it in action

R2#traceroute 1.1.1.1
Type escape sequence to abort.
Tracing the route to 1.1.1.1
  1 20.1.123.1 32 msec 40 msec 28 msec


R4#traceroute 1.1.1.1
Type escape sequence to abort.
Tracing the route to 1.1.1.1
  1 10.2.4.2 32 msec 36 msec 12 msec
  2 20.1.123.1 28 msec 16 msec 40 msec


OSPF address forwarding can be very useful in  similar cases since it lessens the the traffic forwarding that the ASBR has to do between different routing domains, which makes the traffic flows through the optimal path ( which is totally relative to your design) and avoids congesting your ASBR inter-domain links.


1 comment: