Cisco device uses “default-information originate” statement to generate a default route in OSPF. There are two ways to originate default route by using this command:
1) When you configure “default-information originate” under OSPF process without any argument after this statement, OSPF process will first checks , if any default route is already present in routing table. If a default route is already in present in routing table, such as via static or dynamic protocol, OSPF originate default route. If default route does not exist in routing table, OSPF will not originate default route. This behavior is desirable when there are multiple exist point out of OSPF domain to external network.
2)The behavior can be modified by adding "always" argument to the "default-infomation orginate" statement,which essentially skips the checking for a default route already being installed in the table.
Under OSPF process "redistribute static subnets "command is used to redistribute static routes in OSPF, However static default route (ip route 0.0.0.0 0.0.0.0 192.168.1.2) is not injected in to OSPF topology database.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.
To propagate a default route in OSPF, use the default-information originate configuration command:
Example: Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.2 Router(config)#router ospf 100 Router(config-router)#default-information originate metric 10 metric-type 1 Router(config-router)#exit
You can look at the external default route in the OSPF database with the following command:
Router1#sh ip ospf database | in 0.0.0.0
0.0.0.0 192.168.2.1 371 0x80000001 0x0018CA 100
Router1#sh ip ospf database external 0.0.0.0
OSPF Router with ID (10.1.1.2) (Process ID 100)
Type-5 AS External Link States
Routing Bit Set on this LSA LS age: 7 Options: (No TOS-capability, DC) LS Type: AS External Link Link State ID: 0.0.0.0 (External Network Number ) Advertising Router: 192.168.1.1 LS Seq Number: 80000002 Checksum: 0xF366 Length: 36 Network Mask: /0 Metric Type: 1 (Comparable directly to link state metric) TOS: 0 Metric: 10 Forward Address: 0.0.0.0 External Route Tag: 100
In this example, you can see that the default route is advertised by the router 192.168.1.1 with a metric of 10 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. By default OSPF originate Type 2 external route.
You can also originate Conditional default route in OSPF.Conditional default route in OSPF originate by using route-map in default-information command under router OSPF process. The route map configured in the "default-information originates" command check the existing IP prefixes in the IP routing table.
To know more about OSPF condition route advertisement please read this document: