Cisco – Routing loopback using OSPF

ciscoloopbackospfrouting

enter image description here

Here is a simple network using OSPF. Router2 has got LoopBack0 with IP address 10.0.2.1 255.255.255.0. I add this network to OSPF:

Router(config-router)#net 10.0.2.0 0.0.0.255 area 0

When I dispaly routing table in Router2 – I see there 10.0.2.0/24 directly connected. But in Router3 routing table I see

10.0.0.0/32 is subnetted, 1 subnets

O 10.0.2.1 [110/65] via 10.0.0.2, 00:00:12, Serial0/0/0

Why there is prefix /32 ?

Best Answer

Loopback interfaces are considered as host routes, so they are always advertised with a /32 mask.

If you want to advertise the whole subnet, you have to change the network type to point to point like this:

Interface loopback 0
 ip ospf network point-to-point

then OSPF will advertise the subnet with the configured mask.