Cisco device uses “default-information originate” statement to generate a default route in OSPF domain. 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 check,if any default route is already present in routing table. If a default route is already present in routing table via static or any dynamic protocol, OSPF originate default route. If default route does not exist in routing table, OSPF will not originate default route.
2)This 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.
This document discuss about conditional route origination in OSPF domain. 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.
1) prefix-list or access-list: To originate default route only when necessary prefixes are present in routing table.First you need to match these prefixes by configuring prefix-list or access-list.
In the below topology R1 is connected to two ISP using serial interface. The router R1 and R2 runs OSPF in Area 0, where R1 is advertising default route to R2 only when both serial links are up. Once both link goes down R1 should withdraw default route from OSPF domain.