Open Shortest Path First allows network engineers to inject the OSPF default route (route 0.0.0.0/0) into the routing domain in different ways, either implicitly or explicitly. The default route gets advertised by ABR implicitly into stubby areas, while it can be injected into normal only if the router has been configured manually to do so. Routers use the OSPF gateway of last resort whenever there is no matching entry in the routing table for a destination.
In this post, you learn how a router originates and injects the default route into the OSPF autonomous system, and how to configure the OSPF default route on Cisco IOS and Cisco IOS-XE.
What is OSPF Default Route?
The OSPF default route is the 0.0.0.0/0 route that is originated by OSPF nodes and advertised into normal OSPF areas; routers use it to forward a packet with a destination address that doesn’t have a matching entry in the routing table. Injecting an OSPF default route into stub, totally stubby, NSSA, and totally NSSA areas is done by ABRs automatically, and you do not need to configure the route manually. However, the default route cannot get propagated to normal areas, including the backbone area.
OSPF Default Route Injection
On Cisco IOS, advertising the default route into an OSPF normal area can be accomplished manually using a particular command, and you cannot rely on redistributing a 0.0.0.0 route that is already installed in the routing table. Moreover, the route will get propagated to all areas in the OSPF autonomous system, except stub, totally stubby, NSSA, and totally NSSA areas.
Note that throughout this post, I will be using the following network topology to demonstrate aspects related to how the OSPF default route works.


Figure 1 – Network diagram consisting of two routing domains
Here are the links to download the initial configurations applied to the routers according to the network diagram in Figure 1.
| Router R1 | Router R2 | Router R3 | Router R4 |
| Router R5 | Router R6 | Router R7 | Router R8 |
How Does the OSPF Default Route Get Originated?
In the rest of this tutorial, we focus on the OSFP default route injected into normal areas.
You can configure OSPF to advertise the 0.0.0.0/0 route using the default-information originate command only. In this case, the router creates an LSA Type 5 for the route (Example 1), and thus it becomes ASBR (Autonomous System Boundary Router) whether it is connected to area 0 or not.
The router must have a non-OSPF default route in the routing table for the command to work. Otherwise, there is a turnaround to instruct the router to flood the 0.0.0.0/0 route. Besides, the router should be at least connected to one normal OSPF area in order to be able to generate the default route.
R4# show ip ospf database external
OSPF Router with ID (4.4.4.4) (Process ID 1)
Type-5 AS External Link States
LS age: 62
Options: (No TOS-capability, DC, Upward)
LS Type: AS External Link
Link State ID: 0.0.0.0 (External Network Number )
Advertising Router: 4.4.4.4
LS Seq Number: 80000001
Checksum: 0xC2DF
Length: 36
Network Mask: /0
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 1
Forward Address: 0.0.0.0
External Route Tag: 1
Example 1 – LSA Type 5 for the OSPF default route injected by router R4
By default, the OSPF default route is advertised and flooded to OSPF nodes with metric type 2 and a cost of 1 (Example 2).
R8# show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
Gateway of last resort is 10.0.28.2 to network 0.0.0.0
O*E2 0.0.0.0/0 [110/1] via 10.0.28.2, 00:12:26, GigabitEthernet0/2
10.0.0.0/8 is variably subnetted, 10 subnets, 2 masks
O IA 10.0.12.0/24 [110/2] via 10.0.28.2, 00:12:26, GigabitEthernet0/2
O IA 10.0.14.0/24 [110/3] via 10.0.28.2, 00:12:26, GigabitEthernet0/2
O IA 10.0.15.0/24 [110/3] via 10.0.28.2, 00:12:26, GigabitEthernet0/2
O IA 10.0.16.0/24 [110/3] via 10.0.28.2, 00:12:26, GigabitEthernet0/2
O IA 10.0.23.0/24 [110/2] via 10.0.28.2, 00:12:26, GigabitEthernet0/2
C 10.0.28.0/24 is directly connected, GigabitEthernet0/2
L 10.0.28.8/32 is directly connected, GigabitEthernet0/2
D 10.0.67.0/24 [90/3072] via 10.0.78.7, 00:18:45, GigabitEthernet0/7
C 10.0.78.0/24 is directly connected, GigabitEthernet0/7
L 10.0.78.8/32 is directly connected, GigabitEthernet0/7
Example 2 – Displaying R8’s routing table
OSPF Default Route Advertisement and Flooding
When you instruct an OSPF-enabled router to inject the default route into the current OSPF autonomous system, the router creates an LSA Type 5 for the 0.0.0.0/0 IP prefix, and floods to all neighbors, except those in areas that don’t allow LSAs Type 5.
When the default route reaches an ABR, it gets advertised in all normal areas containing the ABR. In our network topology, all areas are connected to area 0. In this way, no matter the router we instruct to advertise the default route, the route gets flooded between all normal areas via the ABR routers.
At this point, let’s remove area 0 by placing the link between routers R1 and R2 in area 12 (Examples 3 and 4).
Router R1
R1(config)# router ospf 1 R1(config-router)# no network 10.0.12.1 0.0.0.0 area 0 R1(config-router)# network 10.0.12.1 0.0.0.0 area 12
Example 3 – Removing R1’s G0/2 interface from OSPF area 0 and placing it in area 12
Router R2
R2(config)# router ospf 1 R2(config-router)# no network 10.0.12.2 0.0.0.0 area 0 R2(config-router)# network 10.0.12.2 0.0.0.0 area 12
Example 4 – Removing R2’s G0/1 interface from OSPF area 0 and placing it in area 12
Since router R1 is no longer in the backbone area, it won’t flood the LSA Type 5, describing the default route generated by router R4, into areas 12, 15, and 16. Thus, the default route won’t get flooded to routers R2, R3, R5, R6, and R8. In other words, even LSAs Type 5 do not get associated with a specific area, they get flooded between areas via ABRs only.
Finally, when the default route reaches an internal router within a normal OSPF area, the route gets flooded to the router’s neighbors.
The 0.0.0.0/0 Prefix Cannot Be Redistributed to Inject The Default Route Into OSPF
As mentioned before, you cannot advertise the default route in OSPF by redistributing the 0.0.0.0/0 prefix added through static or dynamic routing. To illustrate this, we create a static default route on router R7 and inject it into EIGRP (Example 5).
R7(config)# ip route 0.0.0.0 0.0.0.0 null 0 R7(config)# router eigrp 100 R7(config-router)# redistribute static metric 1 1 1 1 1
Example 5 – Advertising a static default route into EIGRP
As you can see in examples 6 and 7, the 0.0.0.0/0 route has been successfully installed in routers R6 and R8’s routing tables.
R6# show ip route eigrp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
Gateway of last resort is 10.0.67.7 to network 0.0.0.0
D*EX 0.0.0.0/0 [170/2560000512] via 10.0.67.7, 00:22:12, GigabitEthernet0/7
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
D 10.0.78.0/24 [90/3072] via 10.0.67.7, 02:08:57, GigabitEthernet0/7
Example 6 – Displaying EIGRP routes on router R6
R8# show ip route eigrp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
Gateway of last resort is 10.0.78.7 to network 0.0.0.0
D*EX 0.0.0.0/0 [170/2560000512] via 10.0.78.7, 00:22:26, GigabitEthernet0/7
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
D 10.0.67.0/24 [90/3072] via 10.0.78.7, 02:08:51, GigabitEthernet0/7
Example 7 – Displaying EIGRP routes on router R8
Next, we redistribute EIGRP routes into OSPF on router R8 using the following commands.
R8(config)# router ospf 1 R8(config-router)# redistribute eigrp 100 subnets
However, the configuration did not work. Router R8 does not generate a type 5 LSA for prefix 0.0.0.0/0 and does not advertise this prefix to router R2 (example 8).
R2# show ip route ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
O E2 10.0.67.0/24 [110/20] via 10.0.28.8, 00:26:48, GigabitEthernet0/8
O E2 10.0.78.0/24 [110/20] via 10.0.28.8, 00:26:48, GigabitEthernet0/8
Example 8 – Displaying OSPF routes on router R2
OSPF Default Route Configuration on Cisco IOS and IOS-XE
On Cisco IOS, you cannot advertise a default route by redistributing the 0.0.0.0/0 route configured using the ip route command or learned via a dynamic routing protocol. However, Cisco IOS and IOS-XE supply the default-information originate command, which is the only command you can use to advertise an OSPF default route.
OSPF default-information originate Command
The default-information originate command requires the router to include a default route in the routing table. Otherwise, you should use the always keyword. Moreover, the command allows you to set the metric type and cost of the default route.
Here is the full syntax of the command:
default-information originate [always] [metric metric-value] [metric-type type-value] [route-map map-name]
First of all, always, metric, metric-type, and route-map keywords are optional parameters.
When the always keyword is used, the router advertises the default route despite the fact that the OSPF node doesn’t have a default route.
R4(config)# router ospf 1
R4(config-router)# default-information originate always
The metric keyword allows you to set the cost of the default route. If you do not specify a value, the router uses the value configured with the default-metric router configuration command; otherwise, the router sets the metric of the default route to 10.
R4(config)# router ospf 1
R4(config-router)# default-information originate metric 100
The metric-type keyword allows you to set the metric type of the default route. You have two options to choose from: Type 1 external route, and Type 2 external route.
R4(config)# router ospf 1
R4(config-router)# default-information originate metric-type 1
Finally, the route-map keyword instructs the router to originate the default route if a route map’s conditions are valid.
Conditional OSPF Default Route Configuration Using The Cisco default-information originate route-map Command
The default-information originate route-map rm_name command advertises a default route if the conditions in route map rm_name are met.
In Example 9, we can figure router R8 to inject the default route in OSPF as long as the 10.0.67.0/24 prefix is in its routing table.
R8(config)# access-list 1 permit 10.0.67.0 0.0.0.255
R8(config)#
R8(config)# route-map default_route_condition permit 10
R8(config-route-map)# match ip address 1
R8(config-route-map)# exit
R8(config)#
R8(config)# router ospf 1
R8(config-router)# default-information originate route-map default_route_condition
Example 9 – Configuring conditional OSPF default routing on router R8
Finally, note that when the always keyword is applied, the router ignores any route map used with the default-information originate command.
OSPF Default Route Troubleshooting
The Cisco default-information originate Command is not Working or The OSPF Default Route is not Advertised
The default-information originate command requires the routing table to include an entry for the 0.0.0.0 route. Otherwise, it won’t work unless you use the always keyword. To check whether the OSPF node uses a gateway of last resort, use the show ip route command in enable mode. Additionally, if the router are connected to stub/NSSA areas only, it cannot advertise a default route.
OSPF Default Route not in The Routing Table
The default-information originate command creates an LSA Type 5 for the 0.0.0.0 prefix, which gets flooded through the OSPF routing domain. Moreover, this Cisco OSPF command does not create a default route and place it in the routing table. However, when a router receives an LSAs adverting the 0.0.0.0 IP address, it may install the OSPF default route in the routing table.
If you found that the OSPF default route is not the routing table, this may be the result of one of the following:
- You checked the default route on the router that is originating it.
- The routing table has a default route with a better administrative distance.
- The default route stops getting propagated at a particular node.
Related Articles
- Open Shortest Path First (OSPF) Explained: The Ultimate Guide for CCNA
- OSPF Router ID: Format, Selection Process, Purpose & Configuration
- OSPF Null Authentication: Configuration & Verification
- OSPF Clear/Plain Text Authentication: Definition and Configuration Example
- Basic OSPF Configuration Lab for CCNA
- OSPF Configuration: from Basic Stuff to Advanced One
- OSPF Passive Interface: How to Set it Up on Cisco and Juniper
- OSPF Virtual Link Explained + Configuration Example on Cisco IOS
- OSPF Stub Area: Definition, Operation and Configuration
- OSPF LSA Types Tutorial: 6 Types Explained with Examples
- OSPF Graceful Restart: Operation & Configuration on Cisco IOS
- OSPF Totally Stubby Area: Operation and Configuration
- OSPF Reference Bandwidth: Definition and Configuration
- OSPF Cost: How OSPF Cost is Calculated and Configured?
- OSPF DR/BDR Election: Process, Configuration, and Tuning
- OSPF Hello and Dead Interval: Operation and Configuration on Cisco IOS
- OSPF Metric: Calculation and Tuning on Cisco IOS
- OSPF MD5 Authentication Explained + Configuration on Cisco IOS
- OSPF HMAC-SHA Cryptographic Authentication: Operation and Configuration
- OSPF Multi-Area Topology + a Configuration Lab in Cisco Packet Tracer
- OSPF TTL Security Check Explained: Operation, Example, and Configuration
- OSPF Graceful Shutdown: Operation and Configuration on Cisco IOS
- Route Redistribution Between OSPF and RIP
- OSPF Network Types Explained with Examples on Cisco IOS
- OSPF Totally NSSA (Not-So-Stubby Area) Area Explained with Examples on Cisco IOS
- OSPF NSSA (Not-So-Stubby Area) Area Explained + Configuration on Cisco IOS
- OSPF Summarization Explained + Configuration in Cisco IOS
- OSPF Route Filtering with Distribute Lists Explained + Configuration on Cisco IOS
- OSPF Type 5 LSA Filtering: Suppress LSA Type 5 and 7 Data on Cisco IOS Easily
- OSPF ABR Type 3 LSA Filtering Explained + Configuration on Cisco IOS
- OSPF Prefix Suppression Explained + Configuration on Cisco and Juniper Routers
- OSPF Path Selection: Criteria, Rules & Tiebreaker Explained on Cisco IOS
- OSPF LSA Throttling: Tuning LSA Origination on Cisco IOS
- OSPF SPF Throttling: Scheduling SPF Runs Efficiently
- OSPF Incremental SPF (iSPF) Algorithm: Rebuilding The SPT Tree Fast
- OSPF Non-Broadcast Network Type: Used on Frame-Relay & NBMA Networks
- OSPF Point-to-Point Network Type is for PPP & Frame-Relay Point-to-Point Links
- OSPF Broadcast Network Type: Used on Ethernet and also Frame-Relay
- OSPF Point-to-Multipoint Network Type is for Frame Relay and NBMA Links
- OSPF vs RIP: What Differences Between OSPF and RIP?
- OSPF LSA Group Pacing Explained + Timer Configuration on Cisco IOS
- OSPF LSA Flood Pacing Explained + Timer Configuration on Cisco IOS
- OSPF LSA Retransmission Pacing Explained + Timer Configuration on Cisco IOS
- Troubleshooting OSPF Neighbor Adjacency Problems on Cisco IOS
- Troubleshooting OSPF Route Installation Explained on Cisco IOS
- Troubleshooting OSPF Route Advertisement Explained on Cisco IOS
- OSPF Stub Router: Advertisement + Configuration + Examples



