How to Advertise a Default Route in OSPF

The default-information originate command injects 0.0.0.0/0 as a Type 5 LSA and turns the router into an ASBR. Here is the syntax, the always option, and verification.

How to Advertise a Default Route in OSPF - PingLabz OSPF article title card

The default-information originate Command

Format:

(This article is part of the PingLabz OSPF series - the full OSPF guide maps the whole cluster in reading order.)

Router(config-router)# default-information originate [always] [metric value] [metric-type {1 | 2}]

What it does:

  • Advertises 0.0.0.0/0 into OSPF as a Type 5 External LSA
  • Marks the router as an ASBR (Autonomous System Boundary Router)

Basic Configuration

Scenario:

Edge router (R1) has Internet connectivity via 0.0.0.0/0 static route. Advertise it to internal routers.

R1 Configuration:

interface gi0/0
 description Internet link
 ip address dhcp

ip route 0.0.0.0 0.0.0.0 gi0/0

router ospf 1
 default-information originate

Result:

  • R1 advertises 0.0.0.0/0 into OSPF
  • Other OSPF routers install the default route pointing to R1

Verification

Check Default Route on Internal Routers

R2 (internal router):

R2# show ip route
Gateway of last resort is 10.1.1.1 to network 0.0.0.0

O*E2  0.0.0.0/0 [110/1] via 10.1.1.1, 00:05:23, GigabitEthernet0/0

Key indicators:

  • O* - OSPF default route
  • E2 - External Type 2 (default metric type)
  • via 10.1.1.1 - Points to R1

Check OSPF Database

R2:

R2# show ip ospf database external

            OSPF Router with ID (2.2.2.2) (Process ID 1)

                Type-5 AS External Link States

  LS age: 123
  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: 0xABCD
  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: 0

Key fields:

  • Link State ID: 0.0.0.0 - Default route
  • Advertising Router: 1.1.1.1 - R1 is advertising it
  • Metric Type: 2 - E2 route

The always Keyword

Problem:
By default, default-information originate only works if the router already has a default route in its routing table.

Scenario:
R1's Internet link goes down. Static default route is removed from routing table. OSPF stops advertising 0.0.0.0/0.

Result:
Internal routers lose their default route and can't reach the Internet.

Solution: Use always

Router(config-router)# default-information originate always

What always does:

  • Advertises 0.0.0.0/0 into OSPF even if the router doesn't have a default route
  • Useful when:
    • You want to force a default route for traffic engineering
    • You're using route tracking (advanced)

⚠️ Warning: Use carefully. If R1 advertises 0.0.0.0/0 but has no Internet connectivity, traffic black-holes.

Setting the Metric

Default metric: 1

To change it:

Router(config-router)# default-information originate metric 100

Use case:
You have two edge routers. One is primary (metric 10), one is backup (metric 100). Routers prefer the primary.

Example:

R1 (primary):

router ospf 1
 default-information originate metric 10

R2 (backup):

router ospf 1
 default-information originate metric 100

Result:
Internal routers prefer R1 (lower cost). If R1 fails, they fail over to R2.

Metric Type: E1 vs E2

OSPF external routes can be Type 1 (E1) or Type 2 (E2).

E2 (Default)

  • Cost calculation: Fixed external cost (doesn't add internal OSPF cost)
  • Example: If external metric is 10, cost is 10 everywhere

E1

  • Cost calculation: External cost + internal OSPF cost
  • Example: If external metric is 10 and internal cost to ASBR is 5, total cost is 15

Configuration:

Router(config-router)# default-information originate metric-type 1

When to use E1:

  • Multiple exit points
  • You want routers to pick the closest exit point

When to use E2 (default):

  • Single exit point
  • Simpler metric calculation

Dual Default Route (Redundancy)

Scenario:

Two edge routers for redundancy.

R1 (primary):

router ospf 1
 default-information originate metric 10

R2 (backup):

router ospf 1
 default-information originate metric 100

Internal router view:

R3# show ip route
O*E2  0.0.0.0/0 [110/10] via 10.1.1.1, GigabitEthernet0/0
               [110/100] via 10.1.2.1, GigabitEthernet0/1

Result:

  • Primary path via R1 (cost 10)
  • Backup path via R2 (cost 100)
  • If R1 fails, R3 uses R2

Conditional Default Route Advertisement (Advanced)

Scenario:
Only advertise default route if Internet is reachable.

Uses IP SLA tracking:

Step 1: Create IP SLA probe

ip sla 1
 icmp-echo 8.8.8.8 source-interface gi0/0
 frequency 30
ip sla schedule 1 life forever start-time now

Step 2: Track the probe

track 1 ip sla 1 reachability

Step 3: Conditional default route

ip route 0.0.0.0 0.0.0.0 gi0/0 track 1

router ospf 1
 default-information originate

Result:

  • If 8.8.8.8 is reachable, static default route exists
  • OSPF advertises it
  • If 8.8.8.8 is unreachable, static route removed, OSPF stops advertising

Common Mistakes

Mistake 1: Using always Without Understanding

Problem:

router ospf 1
 default-information originate always

(Router has no Internet connectivity)

Impact:
Router advertises 0.0.0.0/0, but traffic black-holes.

Fix:
Only use always if you understand the implications. Otherwise, rely on static default route existence.

Mistake 2: Multiple ASBRs with Same Metric

Problem:
Both R1 and R2 advertise default route with metric 1.

Impact:
ECMP load-balancing. If one path is slower, traffic suffers.

Fix:
Set different metrics to prefer one router.

Mistake 3: Advertising Default into Stub Areas

Problem:
You manually configure default-information originate on an ABR in a stub area.

Impact:
Stub areas already get a default route automatically from the ABR. Manual config is redundant.

Fix:
Let stub area ABR auto-generate the default route.

Best Practices

1. Use Conditional Advertisement (IP SLA)

Prevent black-holing by only advertising when Internet is up.

2. Set Metrics for Redundancy

Primary: low metric
Backup: high metric

3. Document in Config

router ospf 1
 ! Advertise default route for Internet access
 default-information originate metric 10

4. Monitor Default Route

Set up alerts if default route disappears from internal routers.

Summary

Now you know:

Why default routes matter - Internet connectivity for internal routers
default-information originate - Injects 0.0.0.0/0 into OSPF
always keyword - Advertises even without default route in table
Metric control - Prefer primary over backup
E1 vs E2 - Metric calculation differences
Conditional advertisement - IP SLA tracking for reliability

Next Step:
You've mastered single-area OSPF and default routes. Ready to scale? Learn How to Configure Multi-Area OSPF next.

Internal Links:

Read next