How to configure OSPF Default Route

With OSPF it is no problem to configure a default route. There are a couple of options if you want to do this. Here’s an example:

R1 R2 OSPF Area 0

R1(config)#router ospf 1  
R1(config-router)#default-information originate ?
  always       Always advertise default route
  metric       OSPF default metric
  metric-type  OSPF metric type for default routes
  route-map    Route-map reference

There are a number of things. We can change the metric or metric type but the most important thing most people forget is the always keyword.

If you use the default-information originate you can advertise a default route in OSPF. OSPF won’t advertise a default route if you don’t already have it in your routing table. If you add the always keyword it will advertise the default route even if you don’t have it in the routing table. Once you have advertised the default route it will look like this on other routers:

R2#show ip ospf database | begin Type-5
		Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag      59          0x80000001 0x008D64 1
R2#show ip route ospf 
O*E2 [110/1] via, 00:00:24, FastEthernet0/0

It will show up as a LSA type 5 external route.


Want to take a look for yourself? Here you will find the final configuration of each device.


hostname R1
interface FastEthernet0/1
 ip address
router ospf 1
 default-information originate always


hostname R2
interface FastEthernet0/1
 ip address
router ospf 1

I hope this is helpful to you, if you have any questions just leave a comment.


Forum Replies

  1. What is the use case for this…?


  2. Shawn,
    Yes, you can do this, sort of :slight_smile:

    Remember that a requirement for OSPF is that all members in the same area must have identical databases (and I presume that your DMVPN hub and spokes are in the same area). So the best you are going to be able to do is keep that default route from getting installed in the routing table, even though it will still be present in the OSPF database. I recommend using a prefix-list to do it. Here’s a sample:

    (config)#ip prefix-list PL_NODEFAULT deny
    (config)#ip prefix-list PL_NODEFAULT permit le 32
    ... Continue reading in our forum

  3. I had a question.

    1. with Static default route we configure something like the following:

    ip route

    1. If it was EIGRP and we had the following manually configured default route to advertise in EIGRP we would then use the following:

    R2(config)#router eigrp AS#

    with OSPF I did not see something similar is that because you just did not put in the full configuration or because OSPF just uses that statement:

    default-information originate always

    I would think it would need a manual e

    ... Continue reading in our forum

  4. Hi Brian,

    If you use default-information originate always then OSPF advertises a default route, even if you don’t have a default route in your local routing table. The “problem” with this is that you “attract” traffic to destinations that you don’t have a route for. In reality, you probably use this on some edge router that is connected to the Internet and you have a default route pointing to your ISP.

    If you wonder about something like this, instead of trying to “think it through”…boot up some routers, configure this on OSPF and see what happens when you send

    ... Continue reading in our forum

  5. Hello Mohammed

    Let’s say you have this topology:

    Let’s assume that R1 has a default route in its routing table via the interface connected to the Internet.

    Now if you have the default information originate command in R1, then:

    • R2 will install in its routing table a default route via OSPF with a next hop of when there is a default route in the routing table of R1.
    • If the internet interface of R1 goes down, or if an administrator manually
    ... Continue reading in our forum

31 more replies! Ask a question or join the discussion by visiting our Community Forum