Jun 032012
 

An external route could be injected into OSPF domain either as a Type-5 or Type-7. The Type-7 route will be injected by an ASBR from a NSSA area. The Type-5 route will be injected by an ASBR from any normal area.

A Type-7 LSA will be translated to Type-5 by an NSSA ABR and flooded it to the whole OSPF domain. If there are multiple NSSA ABRs, the one with higher RID will do the translation. The forwarding address and the metric-type will remain the same as the Type-7 route. If the forwarding address is non-zero, then metric / cost to the forwarding address is accounted or else the metric / cost is to reach the advertising router (ASBR).

If there are multiple external paths to an identical destination, the NSSA ABR will use the following rules for path selection.

1.       E1 and N1 routes are preferred over E2 or N2
2.       If both are Type-1 or Type-2 routes, the route with the lower metric / cost will be installed in the RIB
3.       If both are Type-1 or Type-2 routes, and both routes have the same metric / cost E1 will be preferred over N1 and E2 will be preferred over N2
4.       If maximum-paths 1 command is configured, the route advertised from highest RID will be considered

The cost of each links in the topology is 1. The 35.35.35.0/24 network is redistributed at R3 and R5. R4 will use receive 2 Type-7 LSAs, one from R3 and other from R5. R4 will install the N2 route via R3. R2 also receives 2 Type-7 LSAs, one from R5 and other from R3 and will install theN2 route via R5 (lowest cost).

1. E1 and N1 routes are preferred over E2 or N2

To demonstrate this we can redistribute at R3 the network 35.35.35.0/24 as a type 1 route and with cost of 100. R5 does the default redistribution, with metric-type of 2 and cost of 20

R6#sh ip route 35.35.35.35
Routing entry for 35.35.35.0/24
  Known via "ospf 1", distance 110, metric 20, type NSSA extern 2, forward metric 2
  Last update from 10.0.46.4 on FastEthernet0/0, 00:00:01 ago
  Routing Descriptor Blocks:
    10.0.46.4, from 33.33.33.33, 00:00:01 ago, via FastEthernet0/0
      Route metric is 20, traffic share count is 1
  * 10.0.26.2, from 55.55.55.55, 00:00:01 ago, via FastEthernet0/1
      Route metric is 20, traffic share count is 1

 

R6 has 2 N2 routes to the destination one from R3 and other from R5. Now we can apply a route-map at R3 to change the metric-type and cost.

R3(config)#route-map NET_35
R3(config-route-map)#match interface f0/0
R3(config-route-map)#set metric 100
R3(config-route-map)#set metric-type type-1
R3(config-route-map)#router ospf 1
R3(config-router)#redistribute connected subnets route-map NET_35
 
R6#sh ip ospf database nssa-external | include Metric|Advertising Router
  Advertising Router: 33.33.33.33
        Metric Type: 1 (Comparable directly to link state metric)
        Metric: 100
  Advertising Router: 55.55.55.55
        Metric Type: 2 (Larger than any link state path)
        Metric: 20
 
R6#sh ip route 35.35.35.0
Routing entry for 35.35.35.0/24
  Known via "ospf 1", distance 110, metric 102, type NSSA extern 1
  Last update from 10.0.46.4 on FastEthernet0/0, 00:00:25 ago
  Routing Descriptor Blocks:
  * 10.0.46.4, from 33.33.33.33, 00:00:25 ago, via FastEthernet0/0
      Route metric is 102, traffic share count is 1

 

The N1 route is preferred over N2.

2. If both are Type-1 or Type-2 routes, the route with the lower metric / cost will be installed in the RIB

To prove this, we can redistribute at R5 with the default metric and metric-type of 1, then at R3 with the metric of 100.

R5(config)#route-map NET_35 permit 10
R5(config-route-map)#set metric-type type-1
 
R6#sh ip ospf database nssa-external | include Metric|Advertising Router
  Advertising Router: 33.33.33.33
        Metric Type: 1 (Comparable directly to link state metric)
        Metric: 100
  Advertising Router: 55.55.55.55
        Metric Type: 1 (Comparable directly to link state metric)
        Metric: 20
 
R6#sh ip route 35.35.35.0                                             
Routing entry for 35.35.35.0/24
  Known via "ospf 1", distance 110, metric 22, type NSSA extern 1
  Last update from 10.0.26.2 on FastEthernet0/1, 00:10:28 ago
  Routing Descriptor Blocks:
  * 10.0.26.2, from 55.55.55.55, 00:14:53 ago, via FastEthernet0/1
      Route metric is 22, traffic share count is 1

The route via R5 is installed because of the lower metric 20.

3. If both are Type-1 or Type-2 routes, and both routes have the same metric / cost E1 will be preferred over N1 and E2 will be preferred over N2

In our configuration until now, both ASBRs advertise the 35.35.35.0/24 network as Type 1 routes. R5 advertises with a cost of 20 and R3 with a cost of 100. Thus R2, R6 and R4 prefer the path over R5 to reach the external network. R4 is the LSA Type-7 to Type-5 translator because of its higher RID (44.44.44.44).

In this case R2 will receive a Type-5 LSA and 2 Type-7 LSAs.

R2#sh ip ospf database nssa-external | include Metric|Advertising Router
  Advertising Router: 33.33.33.33
        Metric Type: 1 (Comparable directly to link state metric)
        Metric: 100
  Advertising Router: 55.55.55.55
        Metric Type: 1 (Comparable directly to link state metric)
        Metric: 20
 
R2#sh ip ospf database external | include Metric|Advertising Router    
  Advertising Router: 44.44.44.44
        Metric Type: 1 (Comparable directly to link state metric)
        Metric: 20
 
R2 receives a Type-5 LSA from R4 with a metric of 20 and a Type-7 LSA with a metric of 20. In this case it will prefer the Type-5 LSA which is generated by R4.
R2#sh ip route 35.35.35.0
Routing entry for 35.35.35.0/24
  Known via "ospf 1", distance 110, metric 21, type extern 1
  Last update from 10.0.25.5 on FastEthernet0/1, 00:14:26 ago
  Routing Descriptor Blocks:
  * 10.0.25.5, from 44.44.44.44, 00:14:26 ago, via FastEthernet0/1
      Route metric is 21, traffic share count is 1
 
R2#sh ip ospf database external | include Advertising Router|Forward Address
  Advertising Router: 44.44.44.44
        Forward Address: 10.0.25.5
We can see that R4 does the translation and notice the metric of 21 is to reach the forwarding address which is 10.0.25.5

R4 in this case does not receive any Type-5 LSA, thus uses the Type-7 LSA to reach the external network. We could change the router-id of R2 to be higher than R4, thus forcing R2 to do the translation. Then R4 must use the Type-5 LSA to reach the external network and the metric must be 23 to the forwarding address of 10.0.25.5.

R2(config)#router ospf 1
R2(config-router)#router-id 222.22.22.22
Reload or use "clear ip ospf process" command, for this to take effect
R2(config-router)#do clear ip ospf process
Reset ALL OSPF processes? [no]: yes
R2(config-router)#
%OSPF-5-ADJCHG: Process 1, Nbr 11.11.11.11 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
%OSPF-5-ADJCHG: Process 1, Nbr 66.66.66.66 on FastEthernet1/0 from FULL to DOWN, Neighbor Down: Interface down or detached
%OSPF-5-ADJCHG: Process 1, Nbr 55.55.55.55 on FastEthernet0/1 from FULL to DOWN, Neighbor Down: Interface down or detached
%OSPF-5-ADJCHG: Process 1, Nbr 66.66.66.66 on FastEthernet1/0 from LOADING to FULL, Loading Done
%OSPF-5-ADJCHG: Process 1, Nbr 55.55.55.55 on FastEthernet0/1 from LOADING to FULL, Loading Done
%OSPF-5-ADJCHG: Process 1, Nbr 11.11.11.11 on FastEthernet0/0 from LOADING to FULL, Loading Done
R2(config-router)#
 
R4#sh ip ospf database external | include Advertising Router|Forward Address
  Advertising Router: 222.22.22.22
        Forward Address: 10.0.25.5
 
R4#sh ip route 35.35.35.0
Routing entry for 35.35.35.0/24
  Known via "ospf 1", distance 110, metric 23, type extern 1
  Last update from 10.0.46.6 on FastEthernet1/0, 00:00:11 ago
  Routing Descriptor Blocks:
  * 10.0.46.6, from 222.22.22.22, 00:00:11 ago, via FastEthernet1/0
      Route metric is 23, traffic share count is 1

As predicted R2 does the translation because of the higher RID and R4 now uses the Type-5 LSA to reach the external network. Before continuing lets revert back the RID of R2.

5. If maximum-paths 1 command is configured, the route advertised from highest RID will be considered

Let us delete the metric of 100 which is being announced by R3, that it announces the default value of 20. Then R6 does load-balancing between R3 and R5.

R3(config-router)#route-map NET_35 permit 10                    
R3(config-route-map)#no set metric 100
 
R6#sh ip route 35.35.35.0
Routing entry for 35.35.35.0/24
  Known via "ospf 1", distance 110, metric 22, type NSSA extern 1
  Last update from 10.0.46.4 on FastEthernet0/0, 00:00:05 ago
  Routing Descriptor Blocks:
    10.0.46.4, from 33.33.33.33, 00:00:05 ago, via FastEthernet0/0
      Route metric is 22, traffic share count is 1
  * 10.0.26.2, from 55.55.55.55, 00:34:25 ago, via FastEthernet0/1
      Route metric is 22, traffic share count is 1

IOS by default load balances over 4 equal cost paths. We could change this under the router ospf process with maximum-paths command.

R6(config)#router ospf 1
R6(config-router)#maximum-paths 1
 
R6#sh ip route 35.35.35.0
Routing entry for 35.35.35.0/24
  Known via "ospf 1", distance 110, metric 22, type NSSA extern 1
  Last update from 10.0.26.2 on FastEthernet0/1, 00:00:38 ago
  Routing Descriptor Blocks:
  * 10.0.26.2, from 55.55.55.55, 00:00:38 ago, via FastEthernet0/1
      Route metric is 22, traffic share count is 1

Now we could see that the path announced from the ASBR with highest RID is chosen. I had to reload the router for the change to take effect 😉

Conclusion: A Type-5 LSA is preferred over a Type-7 LSA. The NSSA border router will do the Type-7 to Type-5 translation. The forwarding address of the Type-5 LSA will remain the same as the one from Type-7 LSA.

Download GNS Config files