zerotier / ZeroTierOne

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

zerotier keeps overwriting external port UDP 29994 on router for different linux machines on the same lan, from time to time, constantly. #1626

Closed hradec closed 1 year ago

hradec commented 2 years ago

I have about 5 machines on a LAN network, all running zerotier (debian). I just noticed that port 29994 keeps been overwritten by each on those machines from time to time, which essentially means just one of those machines have direct UDP access from outside at a time.

It seems zerotier on linux doesn't check if port 29994 is already open to another ip, and just overwrites the redirection to itself all the time.

On the same lan I have 2 OSX machines running zerotier, and each of then choose a random UDP port to be open on the router, so they don't suffer of this problem.

hradec commented 2 years ago

as a workaround, I have created a local.conf file where I set different custom secondary ports for each zerotier machine, and setup a crontab to open the custom ports in case they are not open, as it seems zerotier-one won't open custom ports automatically when they're setup on local.conf.

glimberg commented 2 years ago

The patch above should fix both of your issues. Sounds like you've got a router with a funky UPnP implementation. A sane router should map a separate external port to 29994 for each machine like so: image

The patch randomizes the port used for UPnP rather than making it deterministic and ending up with multiple on the same port. Also fixes the portmapper not running on manually specified tertiary ports.

laduke commented 2 years ago

What kind of router are these machines behind?

joseph-henry commented 1 year ago

Closing this due to age and the suspicion that the issue was resolved with the patch above. Please re-open if this is still a problem. Thanks.