Technical Tip: Basic OSPF configuration and MTU settings in OSPF
Description
Â
This article describes basic OSPFv2 configuration on FortiGate, the purpose and concepts of OSPF's MTU configuration.
Â
Scope
Â
FortiGate.
Â
Solution
Â
Default OSPF configuration
Â
When configuring OSPF on the FortiGate, there are four core components that must be configured:
OSPF router ID (set router-id)
Area configuration (config area)
Network Configuration (config network)
OSPF Interface Configuration (config ospf-interface)
Â
Notably, the network entries are used to map the associated interface to a given OSPF area, and the OSPF interface entry is used to customize interface specific settings, such as MTU, cost, network type.
Â
config router ospf
set router-id 10.255.255.1
config area
edit 0.0.0.0
next
end
config network
edit 1
set prefix 192.0.2.0 255.255.255.0
set area 0.0.0.0
next
end
config ospf-interface
edit "OSPF-port1"
set interface "port1"
next
end
endÂ
MTU and OSPF adjacency
The IP MTU is the largest IP packet that an interface can transmit without fragmentation. Standard Ethernet commonly uses an IP MTU of 1500 bytes; this excludes the Ethernet header and frame check sequence.
OSPFv2 carries the Interface MTU field in Database Description (DBD/DD) packets. According to RFC 2328, Section 10.6, a router rejects a received DBD packet when the advertised MTU exceeds the receiving interface's capacity to accept the IP datagram without fragmentation.
An MTU mismatch can therefore prevent database synchronization and leave an adjacency in ExStart or Exchange. Matching the relevant MTUs on both neighbors avoids this cause of adjacency failure, although other OSPF parameters must also be compatible.
Â
Default MTU value and CLI option to change it.
OSPF can only establish an adjacency when the MTU values of the two peer routers are matching. By default, the MTU configuration option is available under config router ospf -> config ospf-interface hierarchy, with FortiOS specifying a default MTU value of 1500 on all FortiOS versions.
Â
Distinguish interface MTU from OSPF MTU settings
Interface-level MTU values can be set with set mtu-override enable and set mtu <value> under config system interface (default is 1500 bytes):
config system interface
edit "LAG.Test"
set mtu-override enable
set mtu 9000
next
endThe OSPF configuration can also directly define an MTU value that is advertised in the OSPF DBD packets. This does not increase the underlying interface's MTU but does take precedence over it for OSPF adjacency purposes:
config router ospf
config ospf-interface
edit "OSPF-port1"
set interface "port1"
set mtu 1436
next
end
endAlternatively, the OSPF interface configuration can use set mtu-ignore enable to bypass the MTU check on that OSPF interface. This allows OSPF to potentially establish an adjacency regardless of the link MTU for each router, but larger packets may still encounter fragmentation/drops. It is recommended to match MTUs where possible as best practice.
config router ospf
config ospf-interface
edit "OSPF-port1"
set interface "port1"
set mtu-ignore enable
next
end
endÂ
Examples to manually configure MTU value in OSPF:
Â
The default values of all the parameters can be seen by checking the 'full-configuration'. For example:
Â
FGT (ospf) # show full-configuration
config ospf-interface
   edit "ospf"
       ...
           set mtu 0
       ...
   next
endÂ
The default value of MTU size under the OSPF interface is seen as '0'. This implies that ospf-interface does not change the default MTU value of 1500.
To change this value, modify set mtu for the entry under config ospf-interface. For example:
Â
config ospf-interface
   edit <name>
    set mtu <1436>
next
endÂ
MTU can also be ignored:
Â
config router ospf
  config ospf-interface
       edit int_1
         set mtu-ignore enable
next
  end
endÂ
Note:
This configuration is necessary when jumbo frame is enabled on the neighbor's interface. Since FortiGate does not support Jumbo frames by default (as the default MTU is 1500), it has to be enabled at the interface level by using an MTU size of 9000 for instance on the interface that is participating in the OSPF configuration.
Â
config system interface
   edit port <x>
       set mtu-override enable
       set mtu 9216 <----- MTU Value.
   next
endÂ
Considerations for increasing interface MTU value on parent interface:
Â
When the MTU of a parent interface, such as a LAG, is increased to support jumbo frames, dependent virtual interfaces such as VLAN interfaces inherit the updated value unless an explicit MTU override is configured.
Â
For example, consider a LAG interface with associated VLAN interfaces running OSPF. The parent interface is configured with an MTU of 9216 bytes. When no explicit OSPF MTU override is configured, OSPF uses the effective interface MTU in its DBD packets sent over that VLAN interface to its OSPF neighbor. If this value exceeds the MTU accepted by a neighboring router inside the VLAN, the adjacency fails and remain in the ExStart or Exchange state. Before changing the parent interface MTU, verify MTU compatibility across the affected VLAN interfaces and their OSPF neighbors.
Â
In this example, the LAG.Test interface MTU has been increased to 9216, which has impacted OSPF adjacency for the connected vlan.20 interface due to MTU mismatch:
FortiGate # show system interface LAG.Test
config system interface
edit "LAG.Test"
[...]
set mtu-override enable
set mtu 9216
[...]
next
end
FortiGate # diagnose netlink interface list LAG.Test
if=LAG.Test family=00 type=1 index=32 mtu=9216 link=0 master=0
if=vlan.20 family=00 type=1 index=34 mtu=9216 link=0 master=0
ref=14 state=start present no_carrier fw_flags=0 flags=up broadcast multicast
FortiGate # get router info ospf interface vlan.20
vlan.20 is down, line protocol is down
Internet Address 10.75.47.1/24, Area 0.0.0.75, MTU 9216
[...]Â
To resolve the issue, the MTU advertised by the OSPF interface should be lowered to match the other peers:
config router ospf
config ospf-interface
edit "vlan.20"
set interface "vlan.20"
set mtu 1500
next
end
endÂ
Which, resolves the adjacency issue by separating the OSPF-advertised interface MTU from the real network interface MTU:
FortiGate # get router info ospf interface vlan.20
vlan.20 is up, line protocol is up
Internet Address 10.75.47.1/24, Area 0.0.0.75, MTU 1500
[...]
FortiGate # diagnose netlink interface list vlan.20
if=vlan.20 family=00 type=1 index=34 mtu=9216 link=0 master=0Â
Related articles:
Technical Note: MTU size and Jumbo frames support on FortiGate devicesÂ
Technical Tip: Set up a jumbo frame in the IPsec VPN interfaceÂ
