OSPF Default-Information Originate and the Default Route

The default route or the Gateway of Last Resort is used to forward packets if our destination IP address does not have a match in our routing table. In IPv4, the CIDR notation is 0.0.0.0/0, whereas, in IPv6, it is ::/0. And because the prefix length is 0, it is also the shortest possible match. Using the ‘default-information originate’ command enables our default routes to be injected in our routing protocol, such as OSPF, and be propagated in our network.

 

What is a Default Route?

In networks where learning all of the more specific routes is not desirable, such as stub networks, default routes are beneficial. A default route is very useful when a router is connected to the Internet because, without it, the router must have all the routing entries of the Internet’s networks, which can reach hundreds of thousands. Consider the massive CPU load; if the router is unable to handle it, it will degrade or crash.

With a static default route, the router only needs to know the destinations within the internal organization and will use the default route to forward IP packets for any other address to the Internet.

 

OSPF Default-Information Originate Command

Any OSPF router can originate default routes injected into a normal area. The OSPF router does not create a default route into the OSPF domain by default. The ‘default-information originate’ command is required for OSPF to generate a default route.

default-information originate

In our example above, router R1 is directly connected to the Internet. It’s a common enterprise setup where all Internet traffic breaks out from a single site. In R1, we have a static route configured pointing to the ISP/Internet next hop device.

S* 0.0.0.0/0 [1/0] via 1.1.1.2

 

We are running the OSPF routing protocol, and R1 is peering with both R2 and R3.

R1#sh ip ospf neighbor 


Neighbor ID     Pri   State           Dead Time   Address         Interface
10.30.30.33       1   FULL/DR         00:00:30    10.30.30.33     GigabitEthernet0/2
10.20.20.22       1   FULL/DR         00:00:30    10.20.20.22     GigabitEthernet0/1

 

Before we proceed, let’s check the routing tables of R2 and R3.

R2#sh 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, E - EGP
       i - IS-IS, 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

Gateway of last resort is not set

     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C       10.20.20.20/30 is directly connected, GigabitEthernet0/1
L       10.20.20.22/32 is directly connected, GigabitEthernet0/1
O       10.30.30.32/30 [110/2] via 10.20.20.21, 00:05:10, GigabitEthernet0/1
R3#sh 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, E - EGP
       i - IS-IS, 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

Gateway of last resort is not set

     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O       10.20.20.20/30 [110/2] via 10.30.30.34, 00:05:20, GigabitEthernet0/1
C       10.30.30.32/30 is directly connected, GigabitEthernet0/1
L       10.30.30.33/32 is directly connected, GigabitEthernet0/1

 

As we can see, we’re only learning internal routes (directly connected networks in this case). Now, let’s inject the default route into the OSPF domain.

R1#conf t
R1(config)#router ospf 1
R1(config-router)#default-information originate

 

As simple as that, default route exists in R2 and R3 as well.

R2#sh 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, E - EGP
       i - IS-IS, 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

Gateway of last resort is 10.20.20.21 to network 0.0.0.0

     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C       10.20.20.20/30 is directly connected, GigabitEthernet0/1
L       10.20.20.22/32 is directly connected, GigabitEthernet0/1
O       10.30.30.32/30 [110/2] via 10.20.20.21, 00:16:22, GigabitEthernet0/1
O*E2 0.0.0.0/0 [110/1] via 10.20.20.21, 00:00:28, GigabitEthernet0/1
R3#sh 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, E - EGP
       i - IS-IS, 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

Gateway of last resort is 10.30.30.34 to network 0.0.0.0

     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O       10.20.20.20/30 [110/2] via 10.30.30.34, 00:16:39, GigabitEthernet0/1
C       10.30.30.32/30 is directly connected, GigabitEthernet0/1
L       10.30.30.33/32 is directly connected, GigabitEthernet0/1
O*E2 0.0.0.0/0 [110/1] via 10.30.30.34, 00:00:45, GigabitEthernet0/1

Download our Free CCNA Study Guide PDF for complete notes on all the CCNA 200-301 exam topics in one book.

We recommend the Cisco CCNA Gold Bootcamp as your main CCNA training course. It’s the highest rated Cisco course online with an average rating of 4.8 from over 30,000 public reviews and is the gold standard in CCNA training: