Is default MTU correct?

igo95862 at yandex.ru igo95862 at yandex.ru
Sun Oct 11 16:27:18 CEST 2020


Was thinking why my wireguards connection had MTU of 1420.

The default MTU is calculated here:
https://github.com/torvalds/linux/blob/master/drivers/net/wireguard/device.c#L255

Which results in MTU of 1420 for wg-quick and systemd-networkd.

The first issue at glance is that it does not account for extension 
headers. (as well as if client is behind MTU lower than 1500)

However, I decided to test what happends if I increase or decrease MTU 
and see what happends to packets with Wireshark. Wireshark can display 
the payload length of Wireguard.

These are the maximum packet (the outer IP packet) and payload (the IP 
packet inside Wireguard) sizes I saw. My endpoint MTU is 1500. (end 
point is not under my administration)

Default MTU of 1420:
  Incoming packet: length 1494, datalen 1420
  Outgoing packet: length 1494, datalen 1420

  As you can see there are 6 bytes missing from maximum MTU.


MTU of 3000:
  Incoming packet: length 1494, datalen 1420
  Outgoing packet: length 1498, datalen 1424

  I thought the connection would break or start fragmenting but it 
seems like there was
  somekind of Path MTU Discovery which determined the MTU to be 1498, 
much closer to the
  actual MTU of 1500. I guess the missing two bytes are because of some 
allignment.

MTU of 1350:
  Incoming packet: length 1434, datalen 1360 (two packets of 1494/1420)
  Outgoing packet: length 1424, datalen 1350

  The outgoing packet had the exact datalen of 1350, howver, the 
incoming packets added
  extra 10 bytes somehow.


As you can see there is a Path MTU Discovery that seems to be working.
The question is should the default even be set 1420?
If the kernel can determine the correct MTU of 1424 (not sure why 2 
bytes are missing)
why not set MTU to something really high and make kernel find the 
actual MTU?

Idealy kernel should find the MTU during initialization of Wireguard 
device.





More information about the WireGuard mailing list