OpenVPN / openvpn

OpenVPN is an open source VPN daemon
http://openvpn.net
Other
10.75k stars 2.99k forks source link

Please change default mssfix mtu to accommodate PPPoE links #571

Closed nnathan closed 3 months ago

nnathan commented 3 months ago

I've run into a regression switching from openvpn 2.5.9 (latest on Ubuntu 22.04 LTS) to openvpn 2.6.9 (latest on Ubuntu 224.04 lTS).

The MSSFIX_DEFAULT changed from 1450 to 1492. According to the commit https://github.com/OpenVPN/openvpn/commit/0d86da32695539a96848b96149484af41bba83c5 that was merged into 2.6.x a community meeting agreed with 1492 being a common encapsulation upper bound.

I understand that a 1492 MSSFIX MTU value will almost occupy an entire Ethernet frame (1506 bytes, or 14 bytes overhead). This works great for most Internet connectivity where the link MTU to the provider is 1500 bytes (maxing out at 1514 bytes when you add Ethernet header).

However there are still Internet providers that encapsulate packets using PPPoE which reduces link MTU by up to 8 bytes (sometimes 6 bytes). So what was a link MTU of 1500 bytes is now 1492 bytes.

I would like to see a slight decrease in MSSFIX_DEFAULT to 1478, which accounts for such connectivity, making the maximal Ethernet frame size 1492 bytes, which fits nicely for aforemention PPPoE link MTUs. ~I suspect this might have been the original intention anyway when default MTU was agreed to be 1492 bytes, but MSSFIX_DEFAULT was set to 1492 but incorrectly leading to oddly sized 1506 byte Ethernet frames instead of 1492 byte Ethernet frames.~ Actually I realise what I'm asking for is reverting back to mssfix 1450 / mssfix 1478 mtu. I think this was a more sensible value and would work on a wide variety of Internet connectivity, though it probably won't work for ipv6.

schwabe commented 3 months ago

MTU always speaks about the payload of an Ethernet frame. A MTU 1500 Ethernet frame is 1514 byte in size. So the current mssfix default value of mssfix 1492 mtu already gives you an Ethernet frame with an MTU with 1492. Yes, the resulting Ethernet frame is larger with 1506 as you observed but that is intended. If we need to lower the default value to a lower value since people nowadays break before 1492 is a diferent discussion.

nnathan commented 3 months ago

Thanks for clarifying.

I'll try to use the MTU accurately as you describe. I found these obervations with 2.5.x and 2.6.x:

In v2.5.9 I notice that mssfix <val> doesn't make much sense. The default of 1450 results in an MTU of 1378 (udp4).

In v2.6.x an mssfix 1450 results in an MTU of 1478 (udp4).

If I understand correctly v2.6.x mssfix <val> is the maximum size of a P_DATA payload, which makes more sense than v2.5.9.

In any case:

If we need to lower the default value to a lower value since people nowadays break before 1492 is a diferent discussion.

This is what I would like to propose. A modest reduction of MSSFIX_DEFAULT from 1492 to 1478 to accommodate PPPoE links.

~My PPPoE connectivity has a MTU of 1480 which is due to a 6 byte PPPoE header, but some providers accompany that with a 2 byte PPPoE header.~

Let me try that again. My Router WAN Ethernet link MTU is 1494 when using PPPoE, because PPPoE adds a 6 byte header, though sometimes it might be accompanied with a 2 byte PPP header yielding a 1492 MTU. Ethernet frames are tunnelled through the PPPoE link, which gives an effective MTU for my Internet connectivity of 1480 bytes (1494 - 14).

nnathan commented 3 months ago

My apologies, I completely misunderstood the situation. I discovered my TP-Link router by default sets PPPoE connection to MTU of 1480 even though it can accommodate a maximum of 1492. I've changed it to 1492, which is in line with the default setting.