Previous section   Next section

Recipe 8.4 Creating a Default Route in OSPF

8.4.1 Problem

You want to propagate a default route within an OSPF network.

8.4.2 Solution

To propagate a default route with OSPF, use the default-information originate configuration command:

Router1#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#ip route 0.0.0.0 0.0.0.0 172.25.1.1
Router1(config)#router ospf 55
Router1(config-router)#default-information originate metric 30 metric-type 1
Router1(config-router)#end
Router1#

8.4.3 Discussion

Unlike RIP and EIGRP, you cannot create a default route in OSPF by simply redistributing a static route. Even if there is a default route in the routing table, Cisco's OSPF implementation will not forward it to the rest of the network by default. This is because OSPF uses a link state algorithm that keeps track of links rather than routes. So summary routes are very special elements in OSPF, and it's important to be careful when distributing them. The default route, 0.0.0.0/0, is the ultimate summary of summaries, and it has the potential to cause serious confusion if it isn't handled properly.

Cisco forces you to be sure that you really want to source a default route into OSPF by requiring you to specifically enable it with the default-information originate command. This command also allows you to specify precisely the metric of this default route and, since a default route is implicitly external to the AS, the type of external route. This has the added advantage of giving finer granularity of control over default route propagation.

You can look at the external routes in the OSPF database with the following command:

Router1#show ip ospf database external 
   
            OSPF Router with ID (172.25.25.1) (Process ID 55)
   
                Type-5 AS External Link States
   
  LS age: 163
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 0.0.0.0 (External Network Number )
  Advertising Router: 172.25.25.1
  LS Seq Number: 80000002
  Checksum: 0x18E6
  Length: 36
  Network Mask: /0
        Metric Type: 1 (Comparable directly to link state metric)
        TOS: 0 
        Metric: 30 
        Forward Address: 0.0.0.0
        External Route Tag: 55
   
Router1#

In this example, you can see that the default route is advertised by the 172.25.25.1 router with a metric of 30 and a metric type of 1. The metric type in this case refers to whether this route is considered by OSPF to be a Type 1 or 2 external route. It is a Type 1 route�we configured it this way with the default-information command:

Router1(config-router)#default-information originate metric 30 metric-type 1

As we mentioned in the introduction to this chapter, the cost of a Type 1 external route is the cost shown by the external metric (which is 30 in this case), plus the internal cost to reach the router that advertises the external route.

Then, on another router in the same area, you can see that the default route's cost is 40, because the cost to reach the ASBR is 10. All of the internal routers can see that this is a Type 1 external route, as well as other important attributes such as the administrative distance and the ASBR that originated this route:

Router5#show ip route 0.0.0.0
Routing entry for 0.0.0.0/0, supernet
  Known via "ospf 87", distance 110, metric 40, candidate default path
  Tag 55, type extern 1
  Redistributing via ospf 87
  Last update from 172.25.1.5 on Ethernet0, 00:01:24 ago
  Routing Descriptor Blocks:
  * 172.25.1.5, from 172.25.25.1, 00:01:24 ago, via Ethernet0
      Route metric is 40, traffic share count is 1
   
Router5#

With default routes in particular, you sometimes want to ensure that the original ASBR continues to advertise the external route even if it disappears from its routing table. You can do this by adding the keyword always to the default-information command as follows:

Router1#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#ip route 0.0.0.0 0.0.0.0 172.25.1.1
Router1(config)#router ospf 55
Router1(config-router)#default-information always metric-type 1
Router1(config-router)#end
Router1#

You can also create a default route using a stub area. In this case you can configure your ABR routers to advertise only a simple default route into the area. We discuss stub areas in Recipe 8.10.

8.4.4 See Also

Recipe 8.5; Recipe 8.10


  Previous section   Next section
Top