OSPF Default Route

Anggara
Network Warrior
Published in
4 min readNov 19, 2017

With this simple topology of 2 Cisco routers, we will configure default route in OSPF.

The scenario is interface loopback 0 on R1 (100.100.100.1) will not advertised into OSPF, R2 will reach it through the default route.

First of all, we will configure on R2 :

R2(config)#interface e0/0
R2(config-if)#ip address 10.10.10.2 255.255.255.252
R2(config-if)#no shut
R2(config)#interface loopback 0
R2(config-if)#ip address 2.2.2.2 255.255.255.255
R2(config-if)#no shut
R2(config)#router ospf 1
R2(config-router)#network 10.10.10.0 0.0.0.3 area 0
R2(config-router)#network 2.2.2.2 0.0.0.0 area 0

Now move to R1, we don’t advertise loopback 0 (100.100.100.1) into OSPF because we want to reach it by default route from R2 :

R1(config)#interface e0/0
R1(config-if)#ip address 10.10.10.1 255.255.255.252
R1(config-if)#no shut
R1(config)#interface loopback 0
R1(config-if)#ip address 100.100.100.1 255.255.255.255
R1(config-if)#no shut
R1(config)#interface loopback 1
R1(config-if)#ip address 1.1.1.1 255.255.255.255
R1(config-if)#no shut
R1(config)#router ospf 1
R1(config-router)#network 10.10.10.0 0.0.0.3 area 0
R1(config-router)#network 1.1.1.1 0.0.0.0 area 0

Now let’s check from R2 :

R2#sh ip route
--<output omitted>--
Gateway of last resort is not set1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/11] via 10.10.10.1, 00:01:45, Ethernet0/0
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.10.10.0/30 is directly connected, Ethernet0/0
L 10.10.10.2/32 is directly connected, Ethernet0/0
R2#ping 100.100.100.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.100.100.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

Well, we can’t ping to loopback 0 of R1.

Let’s add configuration on R1 :

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

Now let’s check on R2 :

R2#sh ip route
--<output omitted>--
Gateway of last resort is 10.10.10.1 to network 0.0.0.0O*E2 0.0.0.0/0 [110/1] via 10.10.10.1, 00:00:17, Ethernet0/0
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/11] via 10.10.10.1, 00:03:12, Ethernet0/0
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.10.10.0/30 is directly connected, Ethernet0/0
L 10.10.10.2/32 is directly connected, Ethernet0/0
R2#ping 100.100.100.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.100.100.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms

Well, R2 has default route now and can reach loopback 0 of R1 (100.100.100.1).

Let’s try another way, remove previous configuration on R1 “default-information originate always” and add configuration “default-information originate”.

R1(config)#router ospf 1
R1(config-router)#no default-information originate always
R1(config-router)#default-information originate

Check again on R2 :

R2#sh ip route
--<output omitted>--
Gateway of last resort is not set1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/11] via 10.10.10.1, 00:04:55, Ethernet0/0
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.10.10.0/30 is directly connected, Ethernet0/0
L 10.10.10.2/32 is directly connected, Ethernet0/0
R2#ping 100.100.100.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.100.100.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

Hmmm.. the default route is disappear and R2 can’t reach 100.100.100.1.

Now add configuration on R1 :

R1(config)#ip route 0.0.0.0 0.0.0.0 loopback 0

Now R1 has a default route through interface loopback 0 :

R1#sh ip route
--<output omitted>--
Gateway of last resort is 0.0.0.0 to network 0.0.0.0S* 0.0.0.0/0 is directly connected, Loopback0
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback1
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/11] via 10.10.10.2, 00:06:27, Ethernet0/0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.10.10.0/30 is directly connected, Ethernet0/0
L 10.10.10.1/32 is directly connected, Ethernet0/0
100.0.0.0/32 is subnetted, 1 subnets
C 100.100.100.1 is directly connected, Loopback0

Let’s check again on R2 :

R2#sh ip route
--<output omitted>--
Gateway of last resort is 10.10.10.1 to network 0.0.0.0O*E2 0.0.0.0/0 [110/1] via 10.10.10.1, 00:01:21, Ethernet0/0
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/11] via 10.10.10.1, 00:07:10, Ethernet0/0
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.10.10.0/30 is directly connected, Ethernet0/0
L 10.10.10.2/32 is directly connected, Ethernet0/0
R2#ping 100.100.100.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.100.100.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/9 ms

The default route on R2 comes up again and R2 can reach 100.100.100.1 again.

  • In OSPF, the “default-information originate” command will not advertise to any other routers without a default route in the routing table.
  • When added the “always” keyword , it tells the router to advertise a default route to other routers even if you don’t have a default route in the routing table.

Please hit the ❤ button if you liked this post. You’ll help others find it. Thanks!

--

--

Anggara
Network Warrior

An ordinary person who has extraordinary life | a traveler | a seeker