NetworkSherpa

OSPF – Setting MTU values for Cisco and Juniper

MTU mismatches are the primary reason an OSPF adjacency becomes stuck in the EXSTART state.  After hellos are exchanged and the routers become neighbors, each OSPF speaker advertises the IP MTU of it’s local interface in a Data Base Description (DBD) LSA.  If there is a mismatch you’ll probably just adjust the configuration to be identical on both ends of the link and be done. However, when you try to peer two OSPF routers with different network operating systems, things start to fall apart fairly quickly.

What do you mean by MTU?

One of the biggest issues I have seen with MTU is that it means different things to different vendors and engineers.  From an OSPF perspective the IP MTU is the maximum size of an IP packet including the headers. OSPF exchanges this information in the initial DBD LSAs so that it can effeciently pack LSAs or LSA headers into IP packets, hoping to avoid IP packet fragmentation or likely loss of the packet.   However every vendor OS seems to have a different way to set the IP MTU, and misconfiguration is the root cause of most OSPF issues.  Let’s explore some examples.

MTU on Cisco IOS

If you’re familiar with Cisco IOS on routers, you’ll know that there are two interface level commands available: ‘mtu’ and ‘ip mtu‘.  Ivan Pepelnjak calls this first mtu the ‘hardware mtu’, and I’ll adopt that term here. All MTU’s are measured in bytes.
The aim of the ‘hardware mtu is to ensure that physical interace can handle the full datagram when layer-2 framing overhead is added to the maximum IP packet size.
The ‘ip mtu’ is the maximum sized IP packet that can be transmitted out an interface. The router will need to fragment an IP packet before transmission if it exceeds the ‘ip mtu’.
On Cisco IOS  the ‘mtu’ and ‘ip mtu’ are set to both set to 1500 bytes by default, which really confused me. How can you have an IP MTU of 1500 bytes and then add an 18-byte ethernet header, but still keep your total frame size under the 1500 byte ‘hardware mtu’?
Well it turns out that the interface controller is programmed with a value of the configured ‘hardware mtu’ + 24 bytes.  (well on my test dynamips 7200VXR anyway)

7200-r1#sh interfaces fa1/0 | i MTU
 MTU 1500 bytes, BW 100000 Kbit/sec, DLY 100 usec
7200-r1#sh ip interface f1/0 | i MTU
 MTU is 1500 bytes
7200-r1#show controllers fa1/0 | i mtu
 max_mtu=1524

Note that there are some odd rules for how and when the ‘ip mtu’ and ‘mtu’ will appear in the IOS running config. Best to use the interface commands above and read Ivan’s post to learn more about this. 
It is frustrating that you have to set the hardware MTU indirectly, knowing that IOS will add 24 bytes to the ‘hardware MTU’ you configure.  Life is still simple for ‘ip mtu’,  what you configure (e.g. 1500) will be what OSPF advertises in it’s DBD.  You can verify the IP MTU using the ip-specific show interface command ‘sh ip interface <if_name>’.

NXOS

NXOS has a single MTU command, but it’s meaning is bound to the interface role. For brevity I only consider the Nexus 7000.  The behaviour is different again for Nexus 5000/2000 series switches, which we’ll leave for now.
If you have a layer 2 port (switchport), then you have two choices for the layer-2 frame size. 1500 or 9216 (if system jumbo mtu is enabled).
If you have a default layer 3 port (no switchport), then you can set any value from 576 to 9216 as the advertised ip mtu, still using the ‘mtu’ command.
So for NXOS there is only a single command ‘mtu’.  This keyword signifies ip mtu if it’s a layer-3 interface.  For the layer-2 interface, ‘mtu’ means hardware mtu.  Similar to IOS,  you’re still not configuring the hardware mtu explicitly as there’s a hidden overhead.

IOS-XE

IOS-XE is the OS you’ll see on the lower end ASR routers like the ASR1004.   The MTU configuration on IOS-XE is very similar to IOS. The IOS-XE configuration guide clearly calls out the difference between the configured ‘interface mtu’ and the ‘ip mtu’. This time there’s a 22 byte difference between the configured interface MTU and the actual hardware MTU.  You set the interface mtu using the ‘mtu’ command.  The IOS-XE configuration guide does a good job of breaking out these 22-bytes:
The default interface MTU size accommodates a 1500-byte packet, plus 22 additional bytes to cover  the following additional overhead:

The IP MTU again is actually pretty straightforward.  You can set it explicitly on the interface directly using an ‘ip mtu’ command.

How big is the ethernet frame overhead?

I know it seems like a softball question.  It’s 18 bytes right?  Well, not so fast.   The ether ‘header’, properly defined as the bytes preceding the ethernet payload is 14 bytes long.   There is also a 4 byte CRC trailer.
Again precision in terminology is important. The ethernet header is 14 bytes, the ethernet trailer is 4 bytes and the total ethernet overhead is 18-bytes.

IOS-XR

This header size issue, becomes really important when you deal with IOS-XR, as seen on ASR9000 and XR-series (formerly GSR) routers.  In IOS-XR there are a few changes in the approach to MTU.

RP/0/RP0/CPU0:ios#sh ipv4 int gi0/0/0/2 | i MTU
 MTU is 1514 (1500 is available to IP)

I love the fact that you’re in full control of the MTU here, but the 14-byte difference can throw you for a loop the first time you see it. Also not having direct control over the IP MTU is a little odd.

Junos

Junos also takes the ‘you know what you’re doing’ approach to MTU, but provides you full direct access to configure the IP and hardware MTU directly.

lab@junos-r1> show interfaces xe-0/0/5 detail | match MTU
 Link-level type: Ethernet, MTU: 1514, Speed: 10Gbps,  <--snip-->
 Protocol inet, MTU: 1500, Generation: 161, Route table: 0

What about Vlan tags?

All the examples above have considered default ethernet frame sizes without VLAN tagging.

 

Sherpa Summary

OSPF is only concerned with the ‘IP MTU’ of an interface. In general configuring IP MTU is much simpler than configuring the interface or hardware MTU. However it can be hard to determine which MTU is configured on an interface and what value it takes.

[amazon_link asins=’0201634724,B008K9ADRI,1587144239,0596002750,B00RN14G7W’ template=’ProductCarousel’ store=’seamlnetwo-20′ marketplace=’US’ link_id=’c3a556d7-f3f1-11e7-aa67-1d78eab3d1da’]