Creating a Default Route in OSPF

Problem

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

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)#exit
Router1(config)#end
Router1#

 

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, by default Cisco's OSPF implementation will not forward it to the rest of the network. 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.

So 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 router 172.25.25.1 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 Type 2 external route. It is a Type 1 route because we configured it this way in 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 (the ASBR).

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 that 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)#exit
Router1(config)#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 will discuss stub areas in Recipe 8.10.

See Also

Recipe 8.5; Recipe 8.10

Router Configuration and File Management

Router Management

User Access and Privilege Levels

TACACS+

IP Routing

RIP

EIGRP

OSPF

BGP

Frame Relay

Handling Queuing and Congestion

Tunnels and VPNs

Dial Backup

NTP and Time

DLSw

Router Interfaces and Media

Simple Network Management Protocol

Logging

Access-Lists

DHCP

NAT

First Hop Redundancy Protocols

IP Multicast

IP Mobility

IPv6

MPLS

Security

Appendix 1. External Software Packages

Appendix 2. IP Precedence, TOS, and DSCP Classifications

Index



Cisco IOS Cookbook
Cisco IOS Cookbook (Cookbooks (OReilly))
ISBN: 0596527225
EAN: 2147483647
Year: 2004
Pages: 505

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net