syncthing-networking.7 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. .\" Man page generated from reStructuredText.
  2. .
  3. .
  4. .nr rst2man-indent-level 0
  5. .
  6. .de1 rstReportMargin
  7. \\$1 \\n[an-margin]
  8. level \\n[rst2man-indent-level]
  9. level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
  10. -
  11. \\n[rst2man-indent0]
  12. \\n[rst2man-indent1]
  13. \\n[rst2man-indent2]
  14. ..
  15. .de1 INDENT
  16. .\" .rstReportMargin pre:
  17. . RS \\$1
  18. . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
  19. . nr rst2man-indent-level +1
  20. .\" .rstReportMargin post:
  21. ..
  22. .de UNINDENT
  23. . RE
  24. .\" indent \\n[an-margin]
  25. .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
  26. .nr rst2man-indent-level -1
  27. .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
  28. .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
  29. ..
  30. .TH "SYNCTHING-NETWORKING" "7" "Oct 07, 2022" "v1.22.0" "Syncthing"
  31. .SH NAME
  32. syncthing-networking \- Firewall Setup
  33. .SH ROUTER SETUP
  34. .SS Port Forwards
  35. .sp
  36. If you have a NAT router which supports UPnP, the easiest way to get a working
  37. port forward is to make sure UPnP setting is enabled on both Syncthing and the
  38. router – Syncthing will try to handle the rest. If it succeeds you will see a
  39. message in the console saying:
  40. .INDENT 0.0
  41. .INDENT 3.5
  42. .sp
  43. .nf
  44. .ft C
  45. Created UPnP port mapping for external port XXXXX on UPnP device YYYYY.
  46. .ft P
  47. .fi
  48. .UNINDENT
  49. .UNINDENT
  50. .sp
  51. If this is not possible or desirable, you should set up a port forwarding for ports
  52. \fB22000/TCP\fP and \fB22000/UDP\fP (or whichever port is set in the \fISync Protocol Listen Address\fP setting).
  53. The external forwarded ports and the internal destination ports have to be the same
  54. (e.g. 22000/TCP).
  55. .sp
  56. Communication in Syncthing works both ways. Therefore if you set up port
  57. forwards for one device, other devices will be able to connect to it even when
  58. they are behind a NAT network or firewall.
  59. .sp
  60. In the absence of port forwarding, relaying may work well enough to get
  61. devices connected and synced, but will perform poorly in comparison to a
  62. direct connection.
  63. .SS Local Discovery
  64. .sp
  65. The router needs to allow/forward broad\-/multicasts for local discovery to work.
  66. Usually these are allowed by default in a single local subnet, but may be
  67. blocked between different subnets or even between a bridged Wi\-Fi and LAN.
  68. .sp
  69. If you are unable to set up your router thus or your firewall as shown below,
  70. and your devices have static IP addresses, you can specify them directly by
  71. changing the default \fBdynamic\fP setting for \fIAddresses\fP to something like:
  72. \fBtcp://192.168.1.xxx:22000, dynamic\fP\&.
  73. .SH LOCAL FIREWALL
  74. .sp
  75. If your PC has a local firewall, you will need to open the following ports for
  76. incoming and outgoing traffic:
  77. .INDENT 0.0
  78. .IP \(bu 2
  79. Port \fB22000/TCP\fP: TCP based sync protocol traffic
  80. .IP \(bu 2
  81. Port \fB22000/UDP\fP: QUIC based sync protocol traffic
  82. .IP \(bu 2
  83. Port \fB21027/UDP\fP: for discovery broadcasts on IPv4 and multicasts on IPv6
  84. .UNINDENT
  85. .sp
  86. If you configured a custom port in the \fISync Protocol Listen Address\fP setting,
  87. you have to adapt the firewall rules accordingly.
  88. .SS Uncomplicated Firewall (ufw)
  89. .sp
  90. If you’re using \fBufw\fP on Linux and have installed the \fI\%Syncthing package\fP <\fBhttps://apt.syncthing.net/\fP>, you can allow the necessary ports by running:
  91. .INDENT 0.0
  92. .INDENT 3.5
  93. .sp
  94. .nf
  95. .ft C
  96. sudo ufw allow syncthing
  97. .ft P
  98. .fi
  99. .UNINDENT
  100. .UNINDENT
  101. .sp
  102. If you also want to allow external access to the Syncthing web GUI, run:
  103. .INDENT 0.0
  104. .INDENT 3.5
  105. .sp
  106. .nf
  107. .ft C
  108. sudo ufw allow syncthing\-gui
  109. .ft P
  110. .fi
  111. .UNINDENT
  112. .UNINDENT
  113. .sp
  114. Allowing external access is \fBnot\fP necessary for a typical installation.
  115. .sp
  116. You can then verify that the ports mentioned above are allowed:
  117. .INDENT 0.0
  118. .INDENT 3.5
  119. .sp
  120. .nf
  121. .ft C
  122. sudo ufw status verbose
  123. .ft P
  124. .fi
  125. .UNINDENT
  126. .UNINDENT
  127. .sp
  128. In case you installed Syncthing manually you can follow the \fI\%instructions to manually add the syncthing preset\fP <\fBhttps://github.com/syncthing/syncthing/tree/main/etc/firewall-ufw\fP> to ufw.
  129. .SS Firewalld
  130. .sp
  131. If you are using \fI\%Firewalld\fP <\fBhttps://firewalld.org/\fP> it has included
  132. support for syncthing (since version 0.5.0, January 2018), and you can enable
  133. it with:
  134. .INDENT 0.0
  135. .INDENT 3.5
  136. .sp
  137. .nf
  138. .ft C
  139. sudo firewall\-cmd \-\-zone=public \-\-add\-service=syncthing \-\-permanent
  140. sudo firewall\-cmd \-\-reload
  141. .ft P
  142. .fi
  143. .UNINDENT
  144. .UNINDENT
  145. .sp
  146. Similarly there is also a \fBsyncthing\-gui\fP service.
  147. .SH REMOTE WEB GUI
  148. .sp
  149. To be able to access the web GUI from other computers, you need to change the
  150. \fIGUI Listen Address\fP setting from the default \fB127.0.0.1:8384\fP to
  151. \fB0.0.0.0:8384\fP\&. You also need to open the port in your local firewall if you
  152. have one.
  153. .SS Tunneling via SSH
  154. .sp
  155. If you have SSH access to the machine running Syncthing but would rather not
  156. open the web GUI port to the outside world, you can access it through a SSH
  157. tunnel instead. You can start a tunnel with a command like the following:
  158. .INDENT 0.0
  159. .INDENT 3.5
  160. .sp
  161. .nf
  162. .ft C
  163. ssh \-L 9999:localhost:8384 machine
  164. .ft P
  165. .fi
  166. .UNINDENT
  167. .UNINDENT
  168. .sp
  169. This will bind to your local port 9999 and forward all connections from there to
  170. port 8384 on the target machine. This still works even if Syncthing is bound to
  171. listen on localhost only.
  172. .SH VIA A PROXY
  173. .sp
  174. Syncthing can use a SOCKS5 proxy for outbound connections. Please see proxying\&.
  175. .SH AUTHOR
  176. The Syncthing Authors
  177. .SH COPYRIGHT
  178. 2014-2019, The Syncthing Authors
  179. .\" Generated by docutils manpage writer.
  180. .