From: igo95862@yandex.ru
To: wireguard@lists.zx2c4.com
Subject: Is default MTU correct?
Date: Mon, 12 Oct 2020 13:37:17 +0300 [thread overview]
Message-ID: <5643IQ.GL6UAT2S5L8L@yandex.ru> (raw)
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.
next reply other threads:[~2020-10-16 13:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-12 10:37 igo95862 [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-10-11 14:27 igo95862
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5643IQ.GL6UAT2S5L8L@yandex.ru \
--to=igo95862@yandex.ru \
--cc=wireguard@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).