1STRELAYSRV(1)                      Syncthing                     STRELAYSRV(1)
2
3
4

NAME

6       strelaysrv - Syncthing Relay Server
7

SYNOPSIS

9          strelaysrv [-debug] [-ext-address=<address>] [-global-rate=<bytes/s>] [-keys=<dir>] [-listen=<listen addr>]
10                     [-message-timeout=<duration>] [-nat] [-nat-lease=<duration> [-nat-renewal=<duration>]
11                     [-nat-timeout=<duration>] [-network-timeout=<duration>] [-per-session-rate=<bytes/s>]
12                     [-ping-interval=<duration>] [-pools=<pool addresses>] [-protocol=<string>] [-provided-by=<string>]
13                     [-status-srv=<listen addr>]
14

DESCRIPTION

16       Syncthing  relies  on a network of community-contributed relay servers.
17       Anyone can run a relay server, and it will automatically join the relay
18       pool  and  be  available to Syncthing users. The current list of relays
19       can be found at http://relays.syncthing.net/.
20

OPTIONS

22       -debug Enable debug output.
23
24       -ext-address=<address>
25              An optional address to advertising as being available on. Allows
26              listening on an unprivileged port with port forwarding from e.g.
27              443, and be connected to on port 443.
28
29       -global-rate=<bytes/s>
30              Global rate limit, in bytes/s.
31
32       -keys=<dir>
33              Directory where cert.pem and key.pem is stored (default “.”).
34
35       -listen=<listen addr>
36              Protocol listen address (default “:22067”).
37
38       -message-timeout=<duration>
39              Maximum amount of time we wait for relevant messages  to  arrive
40              (default 1m0s).
41
42       -nat   Use UPnP/NAT-PMP to acquire external port mapping
43
44       -nat-lease=<duration>
45              NAT lease length in minutes (default 60)
46
47       -nat-renewal=<duration>
48              NAT renewal frequency in minutes (default 30)
49
50       -nat-timeout=<duration>
51              NAT discovery timeout in seconds (default 10)
52
53       -network-timeout=<duration>
54              Timeout for network operations between the client and the relay.
55              If no data is received between the client and the relay in  this
56              period of time, the connection is terminated. Furthermore, if no
57              data is sent between either clients being  relayed  within  this
58              period of time, the session is also terminated. (default 2m0s)
59
60       -per-session-rate=<bytes/s>
61              Per session rate limit, in bytes/s.
62
63       -ping-interval=<duration>
64              How often pings are sent (default 1m0s).
65
66       -pools=<pool addresses>
67              Comma separated list of relay pool addresses to join (default “‐
68              http://relays.syncthing.net/endpoint”).   Blank    to    disable
69              announcement to a pool, thereby remaining a private relay.
70
71       -protocol=<string>
72              Protocol used for listening. ‘tcp’ for IPv4 and IPv6, ‘tcp4’ for
73              IPv4, ‘tcp6’ for IPv6 (default “tcp”).
74
75       -provided-by=<string>
76              An optional description about who provides the relay.
77
78       -status-srv=<listen addr>
79              Listen address for status service (blank  to  disable)  (default
80              “:22070”).   Status  service is used by the relay pool server UI
81              for displaying stats (data transfered, number of clients, etc.)
82

SETTING UP

84       Primarily, you need to decide on a directory to store the TLS  key  and
85       certificate  and a listen port. The default listen port of 22067 works,
86       but for optimal compatibility a well known port for  encrypted  traffic
87       such  as  443 is recommended. This may require additional setup to work
88       without running as root or a privileged user, see Running on  port  443
89       as  an  unprivileged user below. In principle something similar to this
90       should work on a Linux/Unix system:
91
92          $ sudo useradd relaysrv
93          $ sudo mkdir /etc/relaysrv
94          $ sudo chown relaysrv /etc/relaysrv
95          $ sudo -u relaysrv /usr/local/bin/relaysrv -keys /etc/relaysrv
96
97       This creates a user relaysrv and a directory /etc/relaysrv to store the
98       keys.  The keys are generated on first startup. The relay will join the
99       global relay pool, unless a -pools="" argument is given.
100
101       To make the relay server start automatically at boot,  use  the  recom‐
102       mended procedure for your operating system.
103
104   Client configuration
105       Syncthing  can be configured to use specific relay servers (exclusively
106       of the public pool) by adding the required servers to the Sync Protocol
107       Listen Address field, under Actions and Settings. The format is as fol‐
108       lows:
109          relay://<host name|IP>[:port]/?id=<relay device ID>
110
111       For example:
112          relay://private-relay-1.exam‐
113          ple.com:443/?id=ITZRNXE-YNROGBZ-HXTH5P7-VK5NYE5-QHRQGE2-7JQ6VNJ-KZUEDIU-5PPR5AM
114
115       The relay’s device ID is output on start-up.
116
117   Running on port 443 as an unprivileged user
118       It is recommended that you run the relay on port 443 (or  another  port
119       which  is  commonly  allowed  through corporate firewalls), in order to
120       maximise the chances that people are able to connect. However,  binding
121       to  ports  below  1024 requires root privileges, and running a relay as
122       root is not recommended. Thankfully there are a  couple  of  approaches
123       available to you.
124
125       One  option is to run the relay on port 22067, and use an iptables rule
126       to forward traffic from port 443 to port 22067, for example:
127
128          iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 22067
129
130       Or, if you’re using ufw, add the following to /etc/ufw/before.rules:
131
132          *nat
133          :PREROUTING ACCEPT [0:0]
134          :POSTROUTING ACCEPT [0:0]
135
136          -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 22067
137
138          COMMIT
139
140       You will need to start relaysrv with -ext-address  ":443".  This  tells
141       relaysrv  that  it can be contacted on port 443, even though it is lis‐
142       tening on port 22067. You will also need to let both port 443 and 22067
143       through your firewall.
144
145       Another  option  is  described here <https://wiki.apache.org/httpd/Non
146       RootPortBinding>, although your mileage may vary.
147

FIREWALL CONSIDERATIONS

149       The relay server listens on two ports by default.  One for data connec‐
150       tions    and   the   other   for   providing   public   statistics   at
151       http://relays.syncthing.net/.  The firewall,  such  as  iptables,  must
152       permit incoming TCP connections to the following ports:
153
154       · Data  port:   22067/tcp  overridden  with -listen and advertised with
155         -ext-address
156
157       · Status port: 22070/tcp overridden with -status-srv
158
159       Runtime iptables rules to allow access to the default ports:
160
161          iptables -I INPUT -p tcp --dport 22067 -j ACCEPT
162          iptables -I INPUT -p tcp --dport 22070 -j ACCEPT
163
164       Please consult Linux distribution  documentation  to  persist  firewall
165       rules.
166

SEE ALSO

168       syncthing-relay(7), syncthing-faq(7), syncthing-networking(7)
169

AUTHOR

171       The Syncthing Authors
172
174       2014-2019, The Syncthing Authors
175
176
177
178
179v1                               Mar 17, 2020                    STRELAYSRV(1)
Impressum