Skip to content

OSPF Loopback Interface

OSPF Loopback interfaces are treated as a stub host and will only have a 32 bit host route on the other devices no matter how the subnet mask is entered under the OSPF network statement.

We will explore how we can disable this default behaviour using a few methods.

ospf-loop

As you can see, R4 is configured with IP address 192.168.1.4 and R5 with 192.168.1.5.

We have loopback interfaces added with /24 subnet masks on R4 and R5

Building configuration...
Current configuration : 61 bytes
!
interface Loopback0
ip address 4.4.4.4 255.255.255.0
end
R4#

R5#sh run int loop 0
Building configuration...
Current configuration : 61 bytes
!
interface Loopback0
ip address 5.5.5.5 255.255.255.0
end
R5#

We are running basic OSPF Configs as follows…

router ospf 1
router-id 4.4.4.4
log-adjacency-changes
network 4.4.4.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255 area 0
R4#

R5#sh run | se router ospf 1
router ospf 1
router-id 5.5.5.5
log-adjacency-changes
network 5.5.5.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255 area 0
R5#

This is what we are seeing on R4 and R5 and we expected this…

4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/11] via 192.168.1.4, 00:12:27, Ethernet0/0
R5#

R4#sh ip ro ospf
5.0.0.0/32 is subnetted, 1 subnets
O       5.5.5.5 [110/11] via 192.168.1.5, 00:12:43, Ethernet0/0
R4#

Now we will try the first method, this is to set the OSPF Network type to point-to-point under the interface configuration mode.

Enter configuration commands, one per line.  End with CNTL/Z.
R4(config)#int loop 0
R4(config-if)#ip ospf network point-to-point
R4(config-if)#

R5#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R5(config)#int loop0
R5(config-if)#ip ospf network point-to-point
R5(config-if)#

As you can see this works, and now we are seeing the whole /24 Range…

5.0.0.0/24 is subnetted, 1 subnets
O       5.5.5.0 [110/11] via 192.168.1.5, 00:00:04, Ethernet0/0
R4#

R5#sh ip ro ospf
4.0.0.0/24 is subnetted, 1 subnets
O       4.4.4.0 [110/11] via 192.168.1.4, 00:00:18, Ethernet0/0
R5#

Second option we got is to redistribute the connected network with the with the redistribute connected subnets under the Router OSPF configuration mode.

When it comes to redistribution, try not to go wild and it is always a good idea to create route-map to point out what you want redistributed.

5.0.0.0/24 is subnetted, 1 subnets
O E2    5.5.5.0 [110/20] via 192.168.1.5, 00:00:00, Ethernet0/0
R4#

R5#sh ip ro ospf
4.0.0.0/24 is subnetted, 1 subnets
O E2    4.4.4.0 [110/20] via 192.168.1.4, 00:00:15, Ethernet0/0
R5#

The third option we have is to use the Area Range command. To accomplish this, we will need to add a few more Loopback interfaces on R4 then we will use the area x range command to summarise it.

Ethernet0/0    192.168.1.4     YES manual up     up
Loopback0      4.4.4.4         YES manual up     up
Loopback10     10.1.1.1        YES manual up     up
Loopback11     11.1.1.1        YES manual up     up
Loopback12     12.1.1.1        YES manual up     up
R4#

When we add the loopback interfaces into OSPF, it is still showing it as a /32 Host route…

10.0.0.0/32 is subnetted, 1 subnets
O IA    10.1.1.1 [110/11] via 192.168.1.4, 00:00:22, Ethernet0/0
11.0.0.0/32 is subnetted, 1 subnets
O IA    11.1.1.1 [110/11] via 192.168.1.4, 00:00:12, Ethernet0/0
12.0.0.0/32 is subnetted, 1 subnets
O IA    12.1.1.1 [110/11] via 192.168.1.4, 00:00:12, Ethernet0/0
R5#

Now, we will use the Area 1 Range command to summarise it on R4. Once it is done, we can now see the end result.

Note: The above Loopback networks have been added into Area 1 under the Router OFPF configuration.

O IA 8.0.0.0/5 [110/11] via 192.168.1.4, 00:00:10, Ethernet0/0
R5#

These are the three method I know of when it comes to disabling the /32 host route on OSPF Loopback Networks… 🙂

comments powered by Disqus