zerotier / ZeroTierOne

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

Managed MTU doesn't get applied. #1554

Closed laduke closed 1 year ago

laduke commented 2 years ago

If you change a network's MTU, your interface still gets 2800, on Linux at least.

Leaving/Joining doesn't change it. If you restart zerotier-one, you get the network's value, but if you leave/join, it goes back to 2800.

Probably a netlink ordering thing.

laduke commented 2 years ago

Actually, the fact that it's getting set to 2800 implies it's using the default instead of the network config


Some printf debugging

joining

constructor setting mtu 2800
setMtu setting mtu 2800
setMtu setting mtu 1320
setMtu setting mtu 1320

restarting zerotier (already joined)

constructor setting mtu 1320
setMtu setting mtu 1320
setMtu setting mtu 1320

so...
at case ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_UP: it thinks the mtu is the default/2800 when it calls EthernetTap::newInstance

and

the setMtu function isn't functioning to change the mtu on the fly.

glimberg commented 2 years ago

Hrmm, so for joining, it looks like zerotier is creating the interface with the default MTU before even receiving the network config?

glimberg commented 2 years ago

Assuming the network config is coming in correct, it should be correct on ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_UP

https://github.com/zerotier/ZeroTierOne/blob/269501eaa0c22bdc402e689b0d061325fb6ddbce/service/OneService.cpp#L2426

So the value is either cached incorrectly, or coming across the wire incorrectly sometimes

laduke commented 2 years ago

https://github.com/zerotier/ZeroTierOne/blob/269501eaa0c22bdc402e689b0d061325fb6ddbce/node/Network.cpp#L587-L593

https://github.com/zerotier/ZeroTierOne/blob/269501eaa0c22bdc402e689b0d061325fb6ddbce/node/Network.cpp#L1390-L1400

-> on join, mtu is 2800

🐇

qt1 commented 2 years ago

Hi,

For me Setting mtu with local.config does not seem to work. Not sure if this is a different problem. (or I am not setting the mtu in the correct way)

sudo zerotier-cli info -j

gives

{
 "address": "1234567890",
 "clock": 1647550455798,
 "config": {
  "physical": {
   "72.28.0.0/16": {
    "mtu": 1200
   }
  },
  "settings": {
   "allowTcpFallbackRelay": true,
   "listeningOn": [
    "192.168.122.205/9993",
    "192.168.122.205/29994",
    "192.168.122.205/48689"
   ],
   "portMappingEnabled": true,
   "primaryPort": 9993,
   ...

But the actual mtu is 2800

Changing the mtu with ip link set does work but it is no persistent.

glimberg commented 2 years ago

@qt1 MTU is not settable via local.conf. It's a network level option controlled by the network controller.

qt1 commented 2 years ago

@glimberg ,

How should I set it the mtu? I do not see any dhcp option in the UI and the link is controlled by ZT , but I didn't find a way to set it there. Can you please advise? (ubuntu 21.10)

Thanks

glimberg commented 2 years ago

We don't recommend altering the default MTU, and as described above, there's currently an issue with it. That said, it is a modifiable field when using the https://my.zerotier.com API directly. We don't expose a way to do it in the UI.

qt1 commented 2 years ago

"We don't recommend altering the default MTU" Unfortunately my scenario is tunneling ssh via the machine, and this beaks with the default MTU. Known limitation of ssh (and also ipsec and co)

glimberg commented 2 years ago

OK. Well this is still the wrong place to bring up something off the current topic. This issue is about MTU changes not being persisted on Linux boxes. For talking out specific use cases you can ask on our discussion board

joseph-henry commented 1 year ago

Closing this since it's fixed by #1860