mwarning / zerotier-openwrt

A OpenWrt package for ZeroTier One - Pull requests are welcome!
669 stars 140 forks source link

How do you solve mtu issue on Zerotier? #118

Closed LoneWolff7 closed 1 month ago

LoneWolff7 commented 4 months ago

With the default mtu of 2800 zerotier doesn’t work on 5G cellular data. I have to manually change the mtu to 1280 to get it to work on cellular, but then it struggles on wifi.

Is there a permanent way to fix this issue?

ogarcia commented 1 month ago

The truth is that I have never had to deal with this problem. Let's leave this issue open to see if anyone else has this problem and can give us more information.

generalinterest commented 1 month ago

My understanding is that the Cellular Link will have an MTU, the wifi link will have it's own MTU. The zerotier interface will default to 2800. I would have thought that the network stack on openwrt would fragment the packets from zerotier when routing out of which ever interface. And that would just work.

Maybe there is something about this configuration we are missing? Can you describe the setup a bit further with all the links?

ip link
or
ifconfig

should show the MTU settings of all the interfaces.

You could also check this from some other device on the wifi network to confirm the best MTU for that network.

I also see there are long running discussions on zerotier MTU values at here where the goal is to identify the highest MTU that will work across links. I believe that is what is needed.

LoneWolff7 commented 1 month ago

My understanding is that the Cellular Link will have an MTU, the wifi link will have it's own MTU. The zerotier interface will default to 2800. I would have thought that the network stack on openwrt would fragment the packets from zerotier when routing out of which ever interface. And that would just work.

I’m not using Zerotier anymore, but I was talking about 5G cellular on my phone, in this case. With mtu at default 2800 Zerotier would work while connected to wifi but as I switch to my carrier’s 5G SA network it would stop working.

Adjusting the mtu using ifconfig <zerotier id> mtu 1280 used to work but it would stop working randomly, and I had to fiddle with mtu size to get to work again.

I’m using Tailscale currently and it uses a default mtu size of 1280 and has no issues working between WiFi and mobile networks.

ogarcia commented 1 month ago

According to the documentation the MTU value of a ZT network can be adjusted through the API.

TOKEN="your_my.zerotier.one_api_token"
NETWORK_ID="your_network_id"
curl -X POST \
  -H "Authorization: token ${TOKEN}" \
  -d '{"config": {"mtu": 1280}}' \
  "https://my.zerotier.com/api/v1/network/${NETWORK_ID}" 

Once this request is made, by simply stopping and restarting the ZT daemon on the nodes, the new configuration is picked up automatically and the whole system starts working with the new MTU.

pjkundert commented 1 day ago

This is still an issue; clients using ZeroTier version 1.14.0.