2020-06-22 04:15:24 +00:00
. \" Man page generated from reStructuredText.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\ $1 \\ n[an-margin]
level \\ n[rst2man-indent-level]
level margin: \\ n[rst2man-indent\\ n[rst2man-indent-level]]
-
\\ n[rst2man-indent0]
\\ n[rst2man-indent1]
\\ n[rst2man-indent2]
. .
.de1 INDENT
. \" .rstReportMargin pre:
. RS \\ $1
. nr rst2man-indent\\n[rst2man-indent-level] \\ n[an-margin]
. nr rst2man-indent-level +1
. \" .rstReportMargin post:
. .
.de UNINDENT
. RE
. \" indent \\n[an-margin]
. \" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
. \" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\ n[rst2man-indent\\n[rst2man-indent-level]]u
. .
2024-08-19 03:45:18 +00:00
.TH "SYNCTHING-NETWORKING" "7" "Aug 15, 2024" "v1.27.10" "Syncthing"
2021-04-28 05:45:43 +00:00
.SH NAME
syncthing-networking \- Firewall Setup
2020-08-19 05:45:23 +00:00
.SH ROUTER SETUP
.SS Port Forwards
2020-06-22 04:15:24 +00:00
.sp
If you have a NAT router which supports UPnP, the easiest way to get a working
port forward is to make sure UPnP setting is enabled on both Syncthing and the
router – Syncthing will try to handle the rest. If it succeeds you will see a
message in the console saying:
.INDENT 0 .0
.INDENT 3 .5
.sp
2024-05-13 03:45:18 +00:00
.EX
2020-06-22 04:15:24 +00:00
Created UPnP port mapping for external port XXXXX on UPnP device YYYYY.
2024-05-13 03:45:18 +00:00
.EE
2020-06-22 04:15:24 +00:00
.UNINDENT
.UNINDENT
.sp
2021-03-03 06:45:37 +00:00
If this is not possible or desirable, you should set up a port forwarding for ports
\fB 22000/TCP\fP and \fB 22000/UDP\fP (or whichever port is set in the \fI Sync Protocol Listen Address\fP setting).
The external forwarded ports and the internal destination ports have to be the same
2020-08-19 05:45:23 +00:00
(e.g. 22000/TCP).
2020-06-22 04:15:24 +00:00
.sp
Communication in Syncthing works both ways. Therefore if you set up port
forwards for one device, other devices will be able to connect to it even when
they are behind a NAT network or firewall.
.sp
2024-07-22 03:45:28 +00:00
In the absence of port forwarding, \fI \% Relaying\fP may work well enough to get
2020-06-22 04:15:24 +00:00
devices connected and synced, but will perform poorly in comparison to a
direct connection.
2020-08-19 05:45:23 +00:00
.SS Local Discovery
.sp
The router needs to allow/forward broad\- /multicasts for local discovery to work.
Usually these are allowed by default in a single local subnet, but may be
blocked between different subnets or even between a bridged Wi\- Fi and LAN.
.sp
If you are unable to set up your router thus or your firewall as shown below,
and your devices have static IP addresses, you can specify them directly by
changing the default \fB dynamic\fP setting for \fI Addresses\fP to something like:
\fB tcp://192.168.1.xxx:22000, dynamic\fP \& .
2020-06-22 04:15:24 +00:00
.SH LOCAL FIREWALL
.sp
If your PC has a local firewall, you will need to open the following ports for
incoming and outgoing traffic:
.INDENT 0 .0
.IP \(bu 2
2021-03-03 06:45:37 +00:00
Port \fB 22000/TCP\fP : TCP based sync protocol traffic
2020-06-22 04:15:24 +00:00
.IP \(bu 2
2021-03-03 06:45:37 +00:00
Port \fB 22000/UDP\fP : QUIC based sync protocol traffic
.IP \(bu 2
Port \fB 21027/UDP\fP : for discovery broadcasts on IPv4 and multicasts on IPv6
2020-06-22 04:15:24 +00:00
.UNINDENT
2021-03-03 06:45:37 +00:00
.sp
If you configured a custom port in the \fI Sync Protocol Listen Address\fP setting,
you have to adapt the firewall rules accordingly.
2020-06-22 04:15:24 +00:00
.SS Uncomplicated Firewall (ufw)
.sp
2024-05-13 03:45:18 +00:00
If you’ re using \fB ufw\fP on Linux and have installed the \X 'tty: link https://apt.syncthing.net/'\fI \% Syncthing package\fP <\fB https://apt.syncthing.net/\fP >\X 'tty: link', you can allow the necessary ports by running:
2020-06-22 04:15:24 +00:00
.INDENT 0 .0
.INDENT 3 .5
.sp
2024-05-13 03:45:18 +00:00
.EX
2020-06-22 04:15:24 +00:00
sudo ufw allow syncthing
2024-05-13 03:45:18 +00:00
.EE
2020-06-22 04:15:24 +00:00
.UNINDENT
.UNINDENT
.sp
If you also want to allow external access to the Syncthing web GUI, run:
.INDENT 0 .0
.INDENT 3 .5
.sp
2024-05-13 03:45:18 +00:00
.EX
2020-06-22 04:15:24 +00:00
sudo ufw allow syncthing\- gui
2024-05-13 03:45:18 +00:00
.EE
2020-06-22 04:15:24 +00:00
.UNINDENT
.UNINDENT
.sp
Allowing external access is \fB not\fP necessary for a typical installation.
.sp
You can then verify that the ports mentioned above are allowed:
.INDENT 0 .0
.INDENT 3 .5
.sp
2024-05-13 03:45:18 +00:00
.EX
2020-06-22 04:15:24 +00:00
sudo ufw status verbose
2024-05-13 03:45:18 +00:00
.EE
2020-06-22 04:15:24 +00:00
.UNINDENT
.UNINDENT
.sp
2024-05-13 03:45:18 +00:00
In case you installed Syncthing manually you can follow the \X 'tty: link https://github.com/syncthing/syncthing/tree/main/etc/firewall-ufw'\fI \% instructions to manually add the syncthing preset\fP <\fB https://github.com/syncthing/syncthing/tree/main/etc/firewall-ufw\fP >\X 'tty: link' to ufw.
2020-06-22 04:15:24 +00:00
.SS Firewalld
.sp
2024-05-13 03:45:18 +00:00
If you are using \X 'tty: link https://firewalld.org/'\fI \% Firewalld\fP <\fB https://firewalld.org/\fP >\X 'tty: link' it has included
2020-06-22 04:15:24 +00:00
support for syncthing (since version 0.5.0, January 2018), and you can enable
2020-09-09 05:45:21 +00:00
it with:
2020-06-22 04:15:24 +00:00
.INDENT 0 .0
.INDENT 3 .5
2020-09-09 05:45:21 +00:00
.sp
2024-05-13 03:45:18 +00:00
.EX
2020-09-09 05:45:21 +00:00
sudo firewall\- cmd \- \- zone=public \- \- add\- service=syncthing \- \- permanent
sudo firewall\- cmd \- \- reload
2024-05-13 03:45:18 +00:00
.EE
2020-06-22 04:15:24 +00:00
.UNINDENT
.UNINDENT
.sp
2020-09-09 05:45:21 +00:00
Similarly there is also a \fB syncthing\- gui\fP service.
2020-06-22 04:15:24 +00:00
.SH REMOTE WEB GUI
.sp
To be able to access the web GUI from other computers, you need to change the
\fI GUI Listen Address\fP setting from the default \fB 127.0.0.1:8384\fP to
\fB 0.0.0.0:8384\fP \& . You also need to open the port in your local firewall if you
have one.
.SS Tunneling via SSH
.sp
If you have SSH access to the machine running Syncthing but would rather not
open the web GUI port to the outside world, you can access it through a SSH
tunnel instead. You can start a tunnel with a command like the following:
.INDENT 0 .0
.INDENT 3 .5
.sp
2024-05-13 03:45:18 +00:00
.EX
2020-06-22 04:15:24 +00:00
ssh \- L 9999:localhost:8384 machine
2024-05-13 03:45:18 +00:00
.EE
2020-06-22 04:15:24 +00:00
.UNINDENT
.UNINDENT
.sp
This will bind to your local port 9999 and forward all connections from there to
port 8384 on the target machine. This still works even if Syncthing is bound to
listen on localhost only.
.SH VIA A PROXY
.sp
2024-07-22 03:45:28 +00:00
Syncthing can use a SOCKS5 proxy for outbound connections. Please see \fI \% Using Proxies\fP \& .
2020-06-22 04:15:24 +00:00
.SH AUTHOR
The Syncthing Authors
.SH COPYRIGHT
2014-2019, The Syncthing Authors
. \" Generated by docutils manpage writer.
.