Table of Contents
OSPF Advertising Loopback Interface
Unlike RIP/EIGRP, OSPF has a special way to advertise loopback interfaces. In OSPF, the route information of the loopback interface is advertised as the host route with subnet mask /32.
For example, configure IP address 10.0.0.2/24 for Loopback0 on R2 in the following figure, and advertise it with OSPF. Then, the host route 10.0.0.2/32 will be advertised instead of 10.0.0.0/24.
No other hosts will be connected to the end of the loopback interface. Therefore, when you configure an IP address for the loopback interface, you may often use a subnet mask of /32. However, there will be times when you want to advertise the route of the loopback interface with the configured subnet mask, such as when verifying the operation of OSPF. There are three ways to do this.
- Configure the network type as POINT_TO_POINT
- Summarize the routes of the loopback interface
- Redistribute the route of the loopback interface to OSPF
The simplest and most straightforward way is to configure the network type as POINT_TO_POINT. Please understand that other methods can also be used in this way.
In the following sections, we will use Cisco routers to specifically explain how to advertise a loopback interface in OSPF.
Related article
See the following article about host routes.
Network diagram
Consider the following simple network diagram to advertise a loopback interface in OSPF.
Let’s start with R1 and R2 with OSPF enabled on Fa0/0 as Area 0 interfaces and as neighbors.
Lo0:10.0.0.2/24
Lo1:10.1.1.2/24
Lo2:10.2.2.2/24
Lo3:10.3.3.2/24
Treat the route of Lo0 as a host route with /32. Then, make sure to advertise the routes of Lo1 to Lo3 with subnet mask /24.
Advertising the Lo0 route
Enable OSPF on Lo0 and advertise the Lo0 route with OSPF.
R2
router ospf 1 network 10.0.0.0 0.0.0.255 area 0
No special configuration is done, so the Lo0 route will be advertised as the /32 host route “10.0.0.2/32”. If you look at show ip ospf interface loopback0 on R2, you will see that the network type is “LOOPBACK”.
R2
R2#show ip ospf interface loopback 0 Loopback0 is up, line protocol is up Internet Address 10.0.0.2/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network Type LOOPBACK, Cost: 1 Loopback interface is treated as a stub Host
And the routing table on R1 is as follows.
R1
R1#show ip route ospf 10.0.0.0/32 is subnetted, 1 subnets O 10.0.0.2 [110/11] via 192.168.12.2, 00:33:56, FastEthernet0/0
Advertising the Lo1 route
Next, advertise the route of Lo1 with the configured subnet mask of 10.1.1.0/24 instead of the host route. To do so, change the network type to POINT_TO_POINT in Lo1.
R2
interface Loopback1 ip ospf network point-to-point ! router ospf 1 network 10.1.1.0 0.0.0.255 area 0
By changing the network type to POINT_TO_POINT, the route 10.1.1.0/24 will be advertised from R2. R1のルーティングテーブルは以下の通りです。
R1
R1#show ip route ospf 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks O 10.0.0.2/32 [110/11] via 192.168.12.2, 00:43:58, FastEthernet0/0 O 10.1.1.0/24 [110/11] via 192.168.12.2, 00:01:06, FastEthernet0/0
As you can see, changing the network type of the loopback interface to POINT_TO_POINT is the simplest way to advertise it as a route with a configured subnet mask.
Related article
For more information about OSPF network types, see the following article.
Advertising the Lo2 route
Lo2 routes will also be advertised on /24. Summarize the /32 subnet mask to /24. To summarize route with OSPF, it must be ABR; making the area of Lo2 as 1, make R2 ABR and generate summary route on R2.
R2
router ospf 1 network 10.2.2.0 0.0.0.255 area 1 area 1 range 10.2.2.0 255.255.255.0
Then, the routing table on R1 will look like the following.
R1
R1#show ip route ospf 10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks O 10.0.0.2/32 [110/11] via 192.168.12.2, 00:52:51, FastEthernet0/0 O IA 10.2.2.0/24 [110/11] via 192.168.12.2, 00:00:10, FastEthernet0/0 O 10.1.1.0/24 [110/11] via 192.168.12.2, 00:09:59, FastEthernet0/0
Since Lo2 is configured as Area 1 for summarization, it will be registered in the routing table with the code “O IA”.
Related article
Please see the following article about route summary in OSPF.
Advertising the Lo3 route
Finally, the Lo3 route is also advertised in /24. Instead of enabling OSPF on the loopback interface, redistribute Connected to OSPF and it will be treated as a route with the configured subnet mask. Redistribute Lo3’s Connected routes to OSPF with the following configuration on R2.
R2
router ospf 1 redistribute connected subnets route-map Lo3 ! route-map Lo3 permit 10 match interface Loopback3
In the routing table on R1, 10.3.3.0/24 looks like the following
R1
R1#show ip route ospf 10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks O 10.0.0.2/32 [110/11] via 192.168.12.2, 01:02:09, FastEthernet0/0 O E2 10.3.3.0/24 [110/20] via 192.168.12.2, 00:01:16, FastEthernet0/0 O IA 10.2.2.0/24 [110/11] via 192.168.12.2, 00:09:28, FastEthernet0/0 O 10.1.1.0/24 [110/11] via 192.168.12.2, 00:19:17, FastEthernet0/0
Since it is redistributed, 10.3.3.0/24 is registered in the routing table with the code “O E2”.
Related article
Please see the following article about redistribution.
Summary
Point
- In OSPF, the route of the loopback interface is advertised as the /32 host route.
- To advertise the route of a loopback interface with the configured subnet mask, you can use the following method.
- Configure the network type as POINT_TO_POINT
- Summarize the routes of the loopback interface
- Redistribute the route of the loopback interface to OSPF
How the OSPF works
- OSPF Overview
- OSPF process flow
- OSPF Router ID : Identify OSPF routers
- What if the router ID of the OSPF router is duplicated?
- OSPF Neighbor and Adjacency
- OSPF DR/BDR
- How show ip ospf neighbor looks on Ethernet
- OSPF Network Type : Classification of OSPF-enabled interfaces
- Synchronization process of OSPF LSDB
- Problems with large-scale OSPF network
- OSPF Area – Inside the area, in detail; outside the area, just a summary
- OSPF Router Type
- OSPF LSA Type
- OSPF Area Type
- OSPF Basic Configuration and Verification Commands
- Details of enabling OSPF on the interface
- OSPF Advertising Loopback Interface
- Configuring and Verifying OSPF Hello/Dead interval
- OSPF Cost Configuration and Verification
- Configuring and Verifying OSPF Router Priority
- Configuring OSPF Neighbor Authentication
- Neighbor Authentication over Virtual-link
- OSPF Configuring and Verifying Stub area [Cisco]
- OSPF Stub Area Configuration Example [Cisco]
- OSPF default route generation : default-information originate command
- Configuration Example of OSPF default route generation : stub area
- OSPF Virtual-Link : Virtual area 0 point-to-point link
- Configuring and Verifying OSPF Virtual-link [Cisco]
- OSPF Virtual-link Configuration Example [Cisco]
- OSPF Virtual-link for discontinuous backbone configuration example
- OSPF Route Summary and Configuration
- Cisco OSPF Route Summary Configuration Example
- OSPF Route Type Preference
- Why the OSPF neighbor state gets stuck in Exstart?
- OSPF packet type and header format
- OSPF Hello Packet
- OSPF DD(Database Description) Packet
- OSPF LSR(Link State Request) Packet
- OSPF LSU(Link State Update) Packet
- OSPF LSAck(Link State Acknowledgement) Packet
- Limitation of OSPF redistribution routes – redistribute maximum-prefix command
- Overview of LSA Filters for OSPF – Filter LSA Type 3/Type 5
- Configuration example of LSA type 3 filter
- Configuration example of LSA type 5 filter
- OSPFv3 Configuration Example [Cisco]
- Configuration Example of OSPFv3 Route Summary [Cisco]