Syncthing settings for truely local only syncing
You need to:
- exclude from any VPN, firewall or Tor on Phone (Not necessary)
- remove syncthing run conditions and maybe battery restrictions
- open web GUI on phone for more info (accessed through the hamburger menu of android when syncthing is running)
- For true incoming local connections with high speed need to add port forwards in router and allow that for for LAN in firewall:
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.
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.
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):
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)
- 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.
- 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
See also Telegram: View @PrivateYourTech
An Official guides which don’t explain this well :
https://docs.syncthing.net/users/firewall.html
or Arch wiki “guide”:
https://wiki.archlinux.org/title/Syncthing#Local_network_setup
This is for people who want a phone to sync to a laptop only on one home lan/wifi network allowing local sync without relaying or global discovery.