My phone and my Mac are connected to my wifi router which connects to the Internet in a metered service. Recently my high data usage seems to be related to SyncThing usage between the devices. Is it correct? Does SyncThing really transmit data over through WAN and back to my other local device?
If it can establish a direct link, no, it doesn’t.
That means you should check if it can establish that direct link - what address does the web interface give?
Also, is it the case that these two are always behind the same router? Syncthing goes to some lengths to be able to keep connecting even if the devices hop IP addresses.
To help give Syncthing hints as to where it can find devices, you can add host names and IP addresses into the Device entry. Syncthing will then try these, as well as using discovery.
In the Device pane, click Edit, Advanced tab, then in the Addresses field you can edit it to something along the lines of
tcp://computername, tcp://192.168.0.1, dynamic. Click Save to finish.
If you wish to go for a harder resolution, you can tell Syncthing to only connect through specific networks. This will mean a device can never be accessed from elsewhere, e.g. anywhere outside of the LAN. Depending on how you use your devices this might not be suitable. From Actions at the top-right, click Advanced. Scroll to the Device entry and expand it. In the “Allowed Networks” field you can add permitted network addresses here, e.g.
192.168.0.0/24, fe80::/8, click Save at the bottom.
You could remove “dynamic” from Device->Addresses, and use IPs/host names only, but this may give a less reliable experience as IP addresses can change, and local hostname resolution may not be dependable. For this reason using the Allowed Networks feature should prove more useful.
Both of my devices have local addresses dhcp’ed from the router (phone: 192.168.8.100, Mac: 192.168.8.101). Both devices are set as “dynamic”. Does it make them connect directly? How can I verify?
I did try turning off “Sync on metered network” on the phone, and it makes sync not happening at all. Does that indicate syncing relies on the WAN?
Setting a fixed address seems not a good option for me as I often change locations (and to different routers).
If Syncthing is showing the device has having a local address, then it won’t be transmitting via the WAN. With “dynamic” it will sometimes pick up the WAN address first. However, it will switch to a local address once that is found via Local Discovery.
I am not sure if “sync on metered network” being disabled will also disable local connections.
You shouldn’t be seeing ‘dynamic’ as an address except in the configuration dialog. If the web interface is showing you the RFC1918 addresses, that’s what’s being used - that is your verification.
I don’t know how the ‘metered network’ thing works, but the easiest way to implement something like that is to just tag the interface, so if the wi-fi is labelled as metered, no traffic will go through there at all. Any other option would require explicit configuration. If that’s how it works, it’s not a useful indicator, unfortunately.
Here’s the thing, though - if you often change locations and routers, isn’t it possible that the phone and the computer aren’t always on the same network? They’d still try to connect, and at that point they would definitely go through a WAN connection of some description.
You can set DHCP reservations so that your 2 devices always get the same IP when at home. Also, depending on the OS, wifi connections have their own “per SSID” IP settings.
Also, you say a phone is involved : are you sure when the phone is at home that it always has access to the wifi network? If in some rooms the phone looses wifi, it will use the cellular network.