Why is the route mask of the loopback interface in the OSPF routing table always 32 bits?

Created: Sep 17, 2019 10:57:44Latest reply: Sep 19, 2019 13:19:36 168 3 0 0
  Rewarded Hi-coins: 0 (problem resolved)

I have advertised a loopback interface with a 24-bit mask, but a 32-bit route is displayed on the peer end. Why?

  • x
  • convention:

Featured Answers
Popeye_Wang
Admin Created Sep 17, 2019 11:18:15 Helpful(0) Helpful(0)

Hi Sprout,

The loopback interface is always defined as Stub Network Link. By default, the network type of the loopback is P2P, and the 32-bit mask is used. This is why the route learned by the IP address of the loopback interface is the host route of /32 regardless of how long the mask length is configured.

The implementation is based on RFC2328.

Why is the route mask of the loopback interface in the OSPF routing table always 32 bits?-3061979-1

This article contains more resources

You need to log in to download or view. No account?Register

x
  • x
  • convention:

All Answers
Popeye_Wang
Popeye_Wang Admin Created Sep 17, 2019 11:18:15 Helpful(0) Helpful(0)

Hi Sprout,

The loopback interface is always defined as Stub Network Link. By default, the network type of the loopback is P2P, and the 32-bit mask is used. This is why the route learned by the IP address of the loopback interface is the host route of /32 regardless of how long the mask length is configured.

The implementation is based on RFC2328.

Why is the route mask of the loopback interface in the OSPF routing table always 32 bits?-3061979-1

This article contains more resources

You need to log in to download or view. No account?Register

x
  • x
  • convention:

offshore.kiwi
offshore.kiwi Created Sep 19, 2019 07:44:47 Helpful(0) Helpful(0)

Hi @Sprout

By default OSPF treats the loopback interface as a point-to-point network:

<R2>display ospf interface LoopBack 0 verbose

 

 OSPF Process 1 with Router ID 10.0.2.2

 Interfaces

 

 

 Interface: 10.0.2.2 (LoopBack0)

 Cost: 0       State: P-2-P     Type: P2P       MTU: 1500 

 Timers: Hello 10 , Dead 40 , Poll  120 , Retransmit 5 , Transmit Delay 1

  IO Statistics


OSPF knows that the network segment where Loopback0 resides can have only one IP address, therefore it advertises the subnet mask of the advertised route as 32 bits.

But you can change this if you want (which is especially useful if you're using loopback interfaces in eNSP to simulate other networks) - just configure the network type of the Loopback interface to be broadcast. Then when OSPF advertises network information for this interface, it will use a 24-bit mask & the network type will be broadcast:

[R2]interface LoopBack 0

[R2-LoopBack0]ospf network-type broadcast

 

<R1>display ip routing-table

Route Flags: R - relay, D - download to fib

------------------------------------------------------------------------------

Routing Tables: Public

         Destinations : 12       Routes : 12      

 

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

 

       10.0.1.0/24  Direct  0    0           D   10.0.1.1        LoopBack0

       10.0.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0

     10.0.1.255/32  Direct  0    0           D   127.0.0.1       LoopBack0

       10.0.2.0/24  OSPF    10   10          D   10.0.123.2      GigabitEthernet0/0/0

 

<R2>display ospf interface LoopBack 0 verbose

 

 OSPF Process 1 with Router ID 10.0.2.2

 Interfaces

 

 

 Interface: 10.0.2.2 (LoopBack0)

 Cost: 0       State: DR        Type: Broadcast    MTU: 1500 

 Priority: 1

 Designated Router: 10.0.2.2

 Backup Designated Router: 0.0.0.0

 Timers: Hello 10 , Dead 40 , Poll  120 , Retransmit 5 , Transmit Delay 1

  IO Statistics

             Type        Input     Output


  • x
  • convention:

Sprout
Sprout Created Sep 19, 2019 13:19:36 Helpful(0) Helpful(0)

Thanks.
  • x
  • convention:

Comment

Reply
You need to log in to reply to the post Login | Register

Notice Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " Privacy."
If the attachment button is not available, update the Adobe Flash Player to the latest version!
Login and enjoy all the member benefits

Login and enjoy all the member benefits

Login