zerotier / ZeroTierOne

A Smart Ethernet Switch for Earth
https://zerotier.com
Other
14.55k stars 1.7k forks source link

Lower ZT_MIN_PHYSMTU #2361

Open laduke opened 2 months ago

laduke commented 2 months ago

ZeroTierOne.h

#define ZT_DEFAULT_PHYSMTU 1432

-#define ZT_MIN_PHYSMTU 1400
+#define ZT_MIN_PHYSMTU 576

This seems to work, with a local.conf like this:

{ "physical": {"192.168.82.0/24": { "mtu": 789 } } }

576 is allegedly the minumum for ipv4.

If I set MTU to 510, the real packets are 576 in tcpdump, so maybe 510 is the right minimum.

Was looking at this because people on cell connections get stuck sometimes. They lower the virtual mtu and that works by side effect.

This way users can set the MTU based on the physical connection.

They could use a different value for IPv6 traffic also.

The constant is used in only 1 place.

pjkundert commented 2 months ago

This seems like something that must be auto-configured. I just had to compute the MTU was 1194 (manually, using ping -M do -s $(( <MTU> - 28 )) <host>) and then set it using ifconfig <interface> mtu 1194.

It is unlikely that 100% of ZeroTier users are going to be able to A) determine that this is necessary, and B) figure out how to do it, and B) repeat the process each time every ZeroTier interface is dynamically re-created!

What's the right solution?

destroyer5656 commented 1 month ago

Yeah I also ran into this issue.