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
  <cr>

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
0.0.0.0         172.16.3.1      59          0x80000001 0x008D64 1
R2#show ip route ospf 
O*E2 0.0.0.0/0 [110/1] via 192.168.12.1, 00:00:24, FastEthernet0/0

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

Configurations

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

R1

hostname R1
!
interface FastEthernet0/1
 ip address 192.168.12.1 255.255.255.0
!
router ospf 1
 network 192.168.12.0
 default-information originate always
!
end

R2

hostname R2
!
interface FastEthernet0/1
 ip address 192.168.12.2 255.255.255.0
!
router ospf 1
 network 192.168.12.0
!
end


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

Tags:


Forum Replies

  1. 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 0.0.0.0/0
    (config)#ip prefix-list PL_NODEFAULT permit 0.0.0.0/0 le 32
    (config)
    ... Continue reading in our forum

  2. Suppose If you are using bgp and ospf in a network what is the need of using default route in ospf ? .BGP will take care of default route to isp.

  3. Hi Pavan,

    It depends on the devices behind your BGP router. If you use iBGP everywhere then you won’t need OSPF. If you run OSPF on your internal routers and only BGP on the edge, then a default route in OSPF helps your devices to get to your BGP router.

    Rene

  4. I had a question.

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

    ip route 0.0.0.0 0.0.0.0 xxx.DestinationAddress.xxx.xxx

    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#
    R2(config-router)#network 0.0.0.0

    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

  5. 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

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