Nodes using UPnP advertise multiple ports?

I have multiple nodes behind a UPnP-capable router, and it seems that the nodes, when registering to the global discovery server, advertise both the UPnP-obtained port AND the local listening port (22000).

This results is a very sub-optimal situation because my router itself is also running a Syncthing node on port 22000, which means that any external node trying to connect to a node behind my router also tries to connect to the node running on the router, prompting spurious “do you want to allow node ___ to connect” notices on the router’s node, while also significantly delaying connections from external nodes to internal nodes – and in some cases is a significant enough problem that the nodes never connect, incorrectly falling back to a relay.

If the internal nodes would just publish accurate information to the discovery server, I could avoid using relays.

Why do nodes advertise both their local listening port and the port obtained from a UPnP server? Is there a way to force them not to announce the local listening port globally?

Mmm. The device announces it’s listen port (0.0.0.0:22000 for example), in addition to any external addresses known from UPnP. The all-zeroes address then gets replaced with the source address on the discovery server, so you end up with your router’s address plus port 22000, and then the UPnP address which is again your router’s address and some other port.

Announcing the listen port is what makes any of this work when there is no NAT, or when there is NAT but with a manual port forward.

If I remember correctly, we will filter out private addresses. So if your computer has for example 192.168.1.42, you could set your listen address to 192.168.1.42:22000 and that would not be announced to the discovery server. This requires that you don’t change IP address on that device, though.

You can also select another port than 22000 and there will be no conflict.

I figured it was something like that.

An issue with altering the config is that I have Android nodes as well, and they move in and out of the network. I don’t really want to configure them all, particularly with static listen IPs.

Maybe the simplest solution is to have the node running on the router itself listen on a different port.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.