How does syncthing chooses which interface to use / when does it stop looking for a better one?

I have some wireguard tunnel set up to make a computer reachable from another via another server, no matter where I am. These two computers also share files via syncthing.

I’ve seen in the past that the wireguard interface was used by syncthing when it was up. But it has higher latency and lower bandwidth than a (real) direct connection, so ideally syncthing would still try to establish one outside of wireguard.

I know that syncthing makes a distinction between a relayed and non-relayed connection, and gets rid of the relayed one if possible. Does it make further distinctions, e.g. looking at the number of hops / latency / bandwidth? Or is it stuck with the first (seemingly) direct connection it finds? Is it possible to ensure that connections are used in this order, depending on availability:

  1. direct
  2. wireguard
  3. relayed


No, it looks at the CIDR of the destination address and prefers local over internet ip addresses.

Sounds like you should configure static addresses for devices if you know exactly how you’d like them to connect.

Ok, so my local ip address I get from the wireguard interface will be preferred over a public ip, that’s not ideal in my situation.

Unfortunately I can’t use static addresses as my public IP regularly changes. I guess my best option would be to play with allowedNetworks depending on whether I currently want my wireguard connection to be used or not.

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