This is an updated version of a previous #Guide (The Forum won’t let me edit original and the title spelling was incorrect)
First you may need to:
- Exclude syncthing from any VPN, firewall or Tor on Phone. Not always necessary but come back to this if you’re having issues. But when we’re done Syncthing shouldn’t even need an internet connection.
- Tweak Syncthing run conditions, for your desired outcomes in the Syncthing app settings and maybe remove android battery restrictions.
- Open the Syncthing web GUI on phone for more settings (accessed through the hamburger menu, top left, of android when Syncthing is running, you can force start syncthing if need be in the status tab)
- This guide may require that you allow incoming connections via port forwards in your router. You need to have access to your router back-end.
When we’re done you’ll have higher speed syncing. This guide is loosely based on the official guide:
Someone in the Self Hosting Matrix group said:
Don’t use UPnP, like ever (Security concerns) and port forwarding is not needed for what you’re looking for …
In your Syncthing app/server web interface click on Actions
then Settings
and go to the Connections
… change the Sync Protocol Listening Addresses to just tcp4://0.0.0.0:22000
and uncheck the following;
Enable NAT traversal, Global Discovery, Enable Relaying.
Make sure to leave Local Discovery ON.
That would allow Syncthing to check the local network for any IP address on port 22000 running Syncthing. But this is technically part of the default state and it didn’t work for me.
If that doesn’t work or you want a more specific setup:
- Set a static local IP for your PC for the LAN or Wifi network (Search guides online, but can be done in your PC’s network settings quite easily)
Router:
Login to your router. This is OpenWRT, your router setup may look different.
add these port forward rules to your router firewall.Firewall
Will be different per device, this is in Portmaster you’ll have to learn your own devices setup. Set these rules for the Syncthing app (You can also block internet):
Optional Portmaster YAML config export:
type: settings
config:
filter:
blockInbound: false
blockInternet: true
defaultAction: permit
domainHeuristics: true
includeCNAMEs: true
includeSubdomains: true
preventBypassing: true
serviceEndpoints:
- + LAN TCP/22001
spn:
use: false
# jess-checksum: Zws6tfFjF8rnpgrDDuepe87ExAQsY6xABJKZwYqmTGnn5G
Syncthing:
- Set listening address to your static IP and desired port, tcp4://192.168.x.xxx:22001 (where x is your PCs static IP) You can experiment with adding other protocols like QUIC:// or UDP:// (I believe you can add multiple with comma separated addresses)
- In the WebGUI (accessed through the hamburger menu of android when Syncthing is running) open: Actions>settings>connections of each device; turn off relaying, etc. Leave only local discovery on.
- On the device, without a static IP eg a phone, open the web GUI and select the device with the static IP eg your PC. Edit it and set it’s address to tcp4://192.168.x.xxx:22001 (where x is your PCs static IP):
Now your device/phone, knows where to look for your other device. (Again you can add other protocols here if you like)
- Check Status on each device to see if Syncthing is running, if not, edit the run conditions in app settings. Connect the phone and PC to a lan cable (or wifi if you allowed wifi in your router port forwarding) and they should detect each other after a short time.
- If it’s working local only, in the WebGUI you should see under: Remote Devices > connection Type: TCP LAN and syncing will be much faster
Optional sync over internet when away from home
Turn on Relaying in each devices WebGUI settings. This will be slower and use data but it is private: Relaying — Syncthing documentation
There is also an Arch wiki “guide”: title/Syncthing#Local_network_setup