Course menu

Course 9: OSPFLesson 4.2 (9 of 20 in this course)78 of 118 in the CCNA series

Advertising a default route into OSPF

default-information originate, the always keyword, E1 and E2 metrics, and how the other routers see the route.

Intermediate · 10 min read

What you will learn

After this lesson, you can advertise a default route from the internet edge router into OSPF, decide whether to use the always keyword, and read O*E2 and O*E1 routes on the other routers.

  • default-information originate
  • ASBR
  • O*E2

default-information originate is the OSPF router command that makes a router advertise a default route (0.0.0.0/0) to every other OSPF router, as an external type 5 LSA. By default it does so only while the router has a default route of its own in its routing table.

In simple terms: The router that has the way out to the internet tells all the other routers: "anything you don't know, send it to me".

A real-life situation

OSPF is running in the lab and every LAN can reach every other LAN. Then a user on LAN 3 opens a website and gets nothing. R1 has a static default route to the ISP, so R1 itself can reach the internet. But R2 and R3 only know the routes OSPF told them about, and OSPF has never heard of the internet. Their routing tables have no match for a web server's address, so they drop the packets. The fix is one command on R1.

What a default route in OSPF is

A default route (0.0.0.0/0) matches every destination, so a router uses it when nothing more specific matches. In most networks only the edge router, here R1, connects to the internet. Typing a static default route on every other router works, but each one would point at a fixed next hop and wouldn't react if the path changed.

Instead, R1 advertises its default route into OSPF. Every other router learns it, with the correct next hop worked out by SPF, and loses it automatically if R1 stops advertising it.

Gi0/2Gi0/1 .1.2 Gi0/010.0.12.0/30Gi0/1 .1.2 Gi0/010.0.23.0/30Gi0/0Gi0/2Gi0/1ISP203.0.113.1R1RID 1.1.1.1R2RID 2.2.2.2R3RID 3.3.3.3LAN 1192.168.1.0/24LAN 2192.168.2.0/24LAN 3192.168.3.0/24
  1. 1. R1 has a static default route ip route 0.0.0.0 0.0.0.0 203.0.113.1 points at the ISP. Gi0/2 is not in OSPF.
  2. 2. R1 advertises 0.0.0.0/0 into OSPF With default-information originate, R1 floods an external (type 5) LSA for the default. R1 is now an ASBR.
  3. 3. Internet traffic follows it R3 has no specific route for the web server, so it uses O*E2 0.0.0.0/0 towards R2, which forwards to R1, which sends it to the ISP.

Why it works this way

OSPF treats anything that didn't start inside OSPF as external. A static route is external, so R1 advertises it in a type 5 LSA (AS external LSA), which is flooded to every router in the OSPF domain. A router that injects external routes is called an ASBR (autonomous system boundary router).

The condition ("only while R1 has a default route itself") is a safety feature. If the ISP link goes down, R1's static route leaves its routing table, R1 withdraws the LSA, and the other routers stop sending internet traffic into a dead end. If there were a second exit elsewhere, they would switch to it.

E2 and E1: two ways to count the cost

Metric typeMetric on R3When to use it
E2 (default)The value R1 set, 1 by default, on every routerOne exit, or when you only care which exit, not the path to it
E1R1's value + the OSPF cost from R3 to R1Several exits, when each router should use the nearest one

With two exits advertising E2 routes of the same metric, a router still prefers the one it can reach with the lower internal cost. E1 simply builds that distance into the metric you see.

How to configure it on Cisco IOS

ip route 0.0.0.0 0.0.0.0 203.0.113.1 ! router ospf 1 default-information originate

On R1. The static route gives R1 its own way out; default-information originate shares it through OSPF. Nothing is configured on R2 or R3.

router ospf 1 default-information originate always

Advertises the default route even when R1 has none of its own. Use it only when another mechanism guarantees the exit, for example a router whose default comes from somewhere OSPF doesn't see.

router ospf 1 default-information originate metric 10 metric-type 1

Sets the starting metric (10) and makes the route E1, so each router adds its own cost to reach R1.

How to verify it

Example output · based on Cisco documentation; exact format varies by platform and software version
R3#show ip route
Gateway of last resort is 10.0.23.1 to network 0.0.0.0

O*E2  0.0.0.0/0 [110/1] via 10.0.23.1, 00:04:02, GigabitEthernet0/0
      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O        10.0.12.0/30 [110/2] via 10.0.23.1, 00:04:12, GigabitEthernet0/0
C        10.0.23.0/30 is directly connected, GigabitEthernet0/0
L        10.0.23.2/32 is directly connected, GigabitEthernet0/0
O     192.168.1.0/24 [110/3] via 10.0.23.1, 00:04:12, GigabitEthernet0/0
O     192.168.2.0/24 [110/2] via 10.0.23.1, 00:04:12, GigabitEthernet0/0
      192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.3.0/24 is directly connected, GigabitEthernet0/1
L        192.168.3.1/32 is directly connected, GigabitEthernet0/1
O*E2: learned by OSPF, a candidate default (*), external type 2. The metric is 1 although R1 is two routers away, because E2 doesn't add internal cost. Gateway of last resort now points towards R2. (Costs use the default reference bandwidth.)
Example output · based on Cisco documentation; exact format varies by platform and software version
R3#show ip ospf database external
            OSPF Router with ID (3.3.3.3) (Process ID 1)

                Type-5 AS External Link States

  LS age: 412
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 0.0.0.0 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000001
  Checksum: 0x5E7B
  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
The type 5 LSA itself: created by 1.1.1.1 (R1), for 0.0.0.0/0, metric type 2, metric 1. Every router in the OSPF domain holds the same copy.
Example output · based on Cisco documentation; exact format varies by platform and software version
R1#show ip ospf | include boundary
 It is an autonomous system boundary router
R1 confirms it is now an ASBR.

With metric 10 metric-type 1 instead, R3 would show O*E1 0.0.0.0/0 [110/12]: the 10 set on R1 plus R3's cost of 2 to reach R1.

What goes wrong and how to troubleshoot it

  • No default route on the other routers. R1 has the command but no default route of its own: the static route is missing, or its next hop is unreachable because the ISP interface is down. Check show ip route 0.0.0.0 on R1.
  • Internet traffic is black-holed during an ISP outage. Someone added always, so R1 keeps advertising a default it can no longer use.
  • The default route is on the wrong router. default-information originate was typed on a router with no internet link. It does nothing there unless always is used, and then it attracts traffic it can't forward.

Common mistakes

  • Trying to advertise the default with network 0.0.0.0 255.255.255.255 area 0. That enables OSPF on every interface; it doesn't advertise a default route.
  • Expecting the E2 metric to grow with distance. It stays at 1 unless you choose E1.
  • Adding always by habit, which breaks failover.
  • Configuring static default routes on R2 and R3 as well, which then override the OSPF route (static AD 1 beats OSPF 110).

💡 Exam tip: recognise O*E2 0.0.0.0/0 [110/1] in a routing table and know it comes from default-information originate on an ASBR. Know that the command needs a default route on that router unless always is added, and that E2 is the default metric type.

Key takeaways

✅ Key takeaways
  • default-information originate on the edge router advertises 0.0.0.0/0 to every OSPF router.
  • Without always it only works while the router has a default route of its own, which gives failover.
  • The route is external (type 5 LSA); the router becomes an ASBR.
  • Other routers see O*E2 with metric 1; E1 would add the internal cost.

Check yourself

Predict · scenario 1

R1 has default-information originate but no default route of its own. What do R2 and R3 see?

Predict · scenario 2

R3 shows O*E2 0.0.0.0/0 [110/1]. R1 is two routers away. Why is the metric 1?

Predict · scenario 3

The ISP link on R1 fails. R1 has default-information originate always. What happens to traffic from LAN 3 to the internet?

Predict · scenario 4

Which router becomes an ASBR in this lesson?

FAQ

Why can't OSPF just advertise the static default route with a network statement?
A network statement only enables OSPF on interfaces whose addresses match. A static route isn't an interface, so no network statement can pick it up. default-information originate is the command written for this job.
Should I use the always keyword?
Usually not on a single internet edge. Without always, the default route disappears from OSPF when the edge router loses its own default, so traffic can move to another exit. With always, the other routers keep sending internet traffic to a router that can no longer forward it.
Why does the default route show cost 1 on every router?
It is an E2 route. E2 routes keep the metric the ASBR gave them (1 by default) and don't add the internal cost. The router still knows the internal cost to the ASBR and uses it to break ties between two E2 routes with the same metric.