Skip to main content
akristof
Staff
Staff
September 6, 2022

Technical Tip: OSPF and prefix-length usage

  • September 6, 2022
  • 0 replies
  • 2111 views

Description

 

This article describes how to adjust interface’s subnet mask in OSPF setup where interfaces involved in negotiation have different subnet masks.

 

Solution

 

Interface subnet mask must be the same on both interfaces that are negotiating OSPF adjacency. Subnet mask is exchanged in Hello packets and in case that the subnet mask does not match, adjacency will not be formed.

Problem with different subnet mask can be seen usually if OSPF is running over site-to-site IPSec tunnel.

Simply said, if one wants to force OSPF to use different subnet mask, follow below config:

 

# config router ospf

  config ospf-interface

    edit "port2"

        set interface "port2"

        set prefix-length 21

    next

  end

 

It will not change the subnet mask in output of 'get router info ospf interface'

 

akristof_0-1662453998532.png

 

But in Hello packet, subnet mask will be changed to /21.

Change the prefix-length on the device with wider subnet mask so the prefix-length will match with the device that has narrower mask.