The way Syncthing syncs data...

Hello,

I share mobile Internet (with data limit) from my Android smartphone to my Windows PC via mobile hotspot feature. I’d like to ask two questions:

  1. If I sync folders only between those two devices, will all the transfer be taking place via LAN or via Internet? Currently I have the impression that it is done via intranet because the download speed (on the PC) is higher than on my sole mobile internet connection. But I’m not sure will it be always that way.

  2. Is it possible to sync data between two devices in various locations (e.g., cities)? If so, how the app transfers data via Internet? Via https or some other protocol? Is there a place where I could read on how the app solves data transfer over Internet?

Thank You for Your time, Thomas Leigh

1 Like

There’s docs about how syncing works, but that mostly talks about how Syncthing handles files and changes to them, not about how it connects: Understanding Synchronization — Syncthing documentation. I don’t think we have a nice single page that explains those aspects, it’s probably distributed in pages about configs, firewalls and relays.
Transport is secured by TLS, not https but BEP over TLS, so similar :slight_smile: If security is what’s on your mind, read Security Principles — Syncthing documentation

As for the phone to PC by hotspot: The problem there is connectivity, reports vary. If the two devices can discover each other over the hotspot, they can indeed directly communicate i.e. no traffic over your mobile link/internet. However I think in most cases that doesn’t work automatically because the hotspot network is too restrictive. You’d need to add the respective local IP addresses manually on the remote devices to establish a connection.

4 Likes

Thank You very much for Your answer. Is there a way (other that disabling mobile internet) I could determine which exact channel (mobile internet or direct connection between those two devices=no internet) is used?

Wireless Network Watcher (“scans your wireless network and displays the list of all computers and devices that are currently connected to your network”) discovers both my phone (as a router) and the PC.

1 Like

You can see the address and thus what kind of connection it is on the respective remote device in the web UI.

I have no clue what that watcher is and what it does, but it might do scans - Syncthing obviously doesn’t do that. Again, remote devices in the web UI have either the active address or a list of discovered addresses when disconnected.

2 Likes

The address (from the Web UI) begins with 192.168… (on the port 22000) - it is the same as the router address within my network. Does it therefore mean that all the synchronization between those two devices will be handled 100% locally in my case?

1 Like

At that moment, yes. However if you have default configuration, it might happen that at some point that connection doesn’t work. Nothing will prevent it to go outside of your network then. If you want to ensure it only ever connects there, you need to modify the remote device address to not be “default” (or maybe “dynamic”, don’t remember), but hardcode the tcp://192.168… address.

2 Likes

Thank You very much, it’s a very useful advice, very interesting.

What could cause such a failure?

1 Like

Anything. Android (nothing more specific here), firewalls, networking config changes, … And it’s not a failure, it’s a feature - Syncthing connects by whatever means available.

2 Likes

If you NEVER want transfers/syncs via the Internet and ALWAYS want to only use your local network dscovery:

In the GUI’s top tight corner, is an ‘Actions’ pull-down. Select ‘Settings’ and then the ‘Connections’ tab. Unchecking everything EXCEPT ‘Local Discovery’ will keep all discovery actions local with no Internet involvement.

Good Luck.

2 Likes

Please keep in mind that local discovery is currently broken in newer versions of Android, so if the OP does that, the phone probably won’t be able to connect at all. Either global discovery or a local static IP address needs to be set in order for the connection to work.

2 Likes

My remote device (Android smartphone) has the address beginning with 192.168… (web GUI › Remote Devices). In its properties (“Edit › Advanced”) I’ve set the same “tcp://192.168…” within the address field, and restarted Syncthing.

Does this give the certainty that this particular device won’t be synced via Internet at all?

As FachryMyID wrote in another thread:

“Syncthing doesn’t work if hotspot the device is activated but the data internet connection is turned off”

I can confirm this on my side, Android 10. Thus my question is: could You make Syncthing work via such a hotspot, but without Internet connection enabled on the smartphone?

1 Like

@Tomasz86 : Interesting that it’s broke in the android environment…

Just out of curiosity: What would happen if the ‘local ip’ address were set to the network broadcast (.255) address? Once the local MAC was discovered, are there any chances that syncthing local discovery would work? Or maybe provide an avenue to communications?

Or is this all an ‘Android broke it’ limitation?

Not being a CellPhoneJunkie ™ I have no way of testing yeah-or-nay but Inquiring Minds want to know…

1 Like

The reason for this is most likely that the devices needs to find each other using Global Discovery (as tomasz86 said). However, this does not mean that internet is used for the actual data transfer. Once the devices has found each other’s address, as long as that address can be reached locally, they will communicate locally.

I would suggest that you enable Global Discovery (and have internet available), but only enter a local address for “Sync Protocol Listen Address”.

I usually do not use SyncThing on a regular basis, last time i was able to setup a working connection between my Android phone and my computer. Data synched nicely.

These days i tried to sync a new Android phone to my computer but i did not succeed, because: both devices are always off - be it my computer on my phone or my phone on my computer (paths are ok on both phone and computer)

Could it be therefore possible to make Syncthing able to fully operate without Internet in the future (I mean over non-Internet hotspot)?

It is already possible, but firewalls sometimes prevents it.

Until local discovery is fixed on Android, you can still always just hardcode IP addresses to force it to operate on your local network only.