Unlike EIGRP, which supports several different ways of generating and advertising the default route, OSPF uses only the default-information originate [always] [metric <value>] [metric-type <1|2>] [route-map <name>] router configuration command to advertise dynamically the default route.
The default-information originate command used by itself will configure the router to advertise a default route only if a default route is already present in the routing table. However, the [always] keyword can be appended to this command to force the router to generate a default route, even when one does not exist in the routing table. This keyword should be used with caution, as it may result in the black-holing of traffic within the OSPF domain or the forwarding of packets for all unknown destinations to the configured router.
The [metric <value>] keyword is used to specify the route metric for the generated default route. The [metric-type <1|2>] keyword can be used to change the metric type for the default route. Finally, the [route-map <name>] keyword configures the router to generate a default route only if the conditions specified in the named route map are met.
The following configuration example illustrates how to configure an OSPF-enabled router to generate and advertise a default route if one already exists in the routing table. The existing default route can be a static route or even a default route from another routing protocol if multiple routing protocols have been configured on the router. The output below illustrates this configuration based on a configured static default route:
| R4(config)#ip route 0.0.0.0 0.0.0.0 FastEthernet0/0 172.16.4.254R4(config)#router ospf 4R4(config-router)#network 172.16.4.0 0.0.0.255 Area 2
R4(config-router)#default-information originate R4(config-router)#exit |
By default, the default route is advertised as a Type 5 LSA.