How to optimize a "server-client" setup?

I put in place basic synchronization between devices and would like to optimize the discovery/announcement/transfers in my situation.

  • A is a “server” (syncthing in a docker container), with a fixed IP
  • B is a device with a stable LAN IP
  • C is a device that connects to the LAN via Wireguard (or OpenVPN, or another VPN)
  • D is a device on Internet

My typical usecases:

  • a folder that everyone shares with everyone
  • a folder A shares with D

So far I left the default settings and use the public services for discovery (and relay?)

I read Specifications — Syncthing documentation to try to understand which element is worth optimizing and I think that it is the relay.

Specifically, I could use a relay on teh edge of my LAN which would shorten the relay → A path (D → relay will always be more or less random, I would still probably gain by forcing that part too as I will use the relay at full power).

I also have concerns about C because it lives on a network different from the LAN, the announcements will not go through and I will end up going in a similar way as D.

My questions:

  • are my concerns viable?
  • if so, what should I do to enforcethe usage of my relay across the devices?
  • is this something that can be set as a default?

The default settings should be fine and your devices should connect to each other if your network is not broken. Verify by inspecting each device and verify that they are connected to each other using expected IP addresses.

Yes, everything works. Sorry if I was not clear but my question is not about fixing/troubleshooting but about optimization.

Specifically, how to configure the relays (and the other questions in the bullet list) to make the best use of the available resources.

You’d be better of creating port forwards or similar in your gateways/firewalls to allow direct TCP connections. Private relays should be a last resort, they’ll always give worse performance and are annoying to set up properly.

1 Like

Thank you. I will set this up for the “server” that has a fixed IP. And manually set the destination on all devices (which is a bit annoying when having quite a few peers)

In that case, can I set my own relay and somehow point the peer devices to use it instead of the public ones?

No need manual destination configuration, discovery will take care of finding the correct address.

Yes you can. However it seems like you don’t need it as you can get direct tcp connections. Which are both more performant and less cumbersome (as explained by Jakob).

I can set direct connections for devices that have a fixed IP on my LAN. The majority does not (phones, laptops). I am considering UPnP though.

EDIT: I enabled UPnP and it seems that everything (almost) works!

Thank you very much for the help.

Most routers allow configuring fixed IPs for mobile devices, then you could also setup port forwards for those and have a direct connection. So the only remaining problem would be connections between multiple devices on the internet (multiple Ds). In which case a private relay in your LAN doesn’t do much good, connection is still over the internet (you’d get guaranteed bandwidth, which is an advantage of course).

All this happens in my home network so I have control of the settings (having replaced the ISP router with my own which is more configurable). I also work in IT (though not in networking specifically) so all of this is a very interesting challenge. Thanks for the help!

PS. I set up UPnP - having static DHCP addresses is a major pain, especially with phones that advertise a randomized MAC.

1 Like