syncthing-networking.7 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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" "May 08, 2024" "v1.27.7" "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. .EX
  44. Created UPnP port mapping for external port XXXXX on UPnP device YYYYY.
  45. .EE
  46. .UNINDENT
  47. .UNINDENT
  48. .sp
  49. If this is not possible or desirable, you should set up a port forwarding for ports
  50. \fB22000/TCP\fP and \fB22000/UDP\fP (or whichever port is set in the \fISync Protocol Listen Address\fP setting).
  51. The external forwarded ports and the internal destination ports have to be the same
  52. (e.g. 22000/TCP).
  53. .sp
  54. Communication in Syncthing works both ways. Therefore if you set up port
  55. forwards for one device, other devices will be able to connect to it even when
  56. they are behind a NAT network or firewall.
  57. .sp
  58. In the absence of port forwarding, \X'tty: link #relaying'\fI\%Relaying\fP\X'tty: link' may work well enough to get
  59. devices connected and synced, but will perform poorly in comparison to a
  60. direct connection.
  61. .SS Local Discovery
  62. .sp
  63. The router needs to allow/forward broad\-/multicasts for local discovery to work.
  64. Usually these are allowed by default in a single local subnet, but may be
  65. blocked between different subnets or even between a bridged Wi\-Fi and LAN.
  66. .sp
  67. If you are unable to set up your router thus or your firewall as shown below,
  68. and your devices have static IP addresses, you can specify them directly by
  69. changing the default \fBdynamic\fP setting for \fIAddresses\fP to something like:
  70. \fBtcp://192.168.1.xxx:22000, dynamic\fP\&.
  71. .SH LOCAL FIREWALL
  72. .sp
  73. If your PC has a local firewall, you will need to open the following ports for
  74. incoming and outgoing traffic:
  75. .INDENT 0.0
  76. .IP \(bu 2
  77. Port \fB22000/TCP\fP: TCP based sync protocol traffic
  78. .IP \(bu 2
  79. Port \fB22000/UDP\fP: QUIC based sync protocol traffic
  80. .IP \(bu 2
  81. Port \fB21027/UDP\fP: for discovery broadcasts on IPv4 and multicasts on IPv6
  82. .UNINDENT
  83. .sp
  84. If you configured a custom port in the \fISync Protocol Listen Address\fP setting,
  85. you have to adapt the firewall rules accordingly.
  86. .SS Uncomplicated Firewall (ufw)
  87. .sp
  88. If you’re using \fBufw\fP on Linux and have installed the \X'tty: link https://apt.syncthing.net/'\fI\%Syncthing package\fP <\fBhttps://apt.syncthing.net/\fP>\X'tty: link', you can allow the necessary ports by running:
  89. .INDENT 0.0
  90. .INDENT 3.5
  91. .sp
  92. .EX
  93. sudo ufw allow syncthing
  94. .EE
  95. .UNINDENT
  96. .UNINDENT
  97. .sp
  98. If you also want to allow external access to the Syncthing web GUI, run:
  99. .INDENT 0.0
  100. .INDENT 3.5
  101. .sp
  102. .EX
  103. sudo ufw allow syncthing\-gui
  104. .EE
  105. .UNINDENT
  106. .UNINDENT
  107. .sp
  108. Allowing external access is \fBnot\fP necessary for a typical installation.
  109. .sp
  110. You can then verify that the ports mentioned above are allowed:
  111. .INDENT 0.0
  112. .INDENT 3.5
  113. .sp
  114. .EX
  115. sudo ufw status verbose
  116. .EE
  117. .UNINDENT
  118. .UNINDENT
  119. .sp
  120. 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 <\fBhttps://github.com/syncthing/syncthing/tree/main/etc/firewall-ufw\fP>\X'tty: link' to ufw.
  121. .SS Firewalld
  122. .sp
  123. If you are using \X'tty: link https://firewalld.org/'\fI\%Firewalld\fP <\fBhttps://firewalld.org/\fP>\X'tty: link' it has included
  124. support for syncthing (since version 0.5.0, January 2018), and you can enable
  125. it with:
  126. .INDENT 0.0
  127. .INDENT 3.5
  128. .sp
  129. .EX
  130. sudo firewall\-cmd \-\-zone=public \-\-add\-service=syncthing \-\-permanent
  131. sudo firewall\-cmd \-\-reload
  132. .EE
  133. .UNINDENT
  134. .UNINDENT
  135. .sp
  136. Similarly there is also a \fBsyncthing\-gui\fP service.
  137. .SH REMOTE WEB GUI
  138. .sp
  139. To be able to access the web GUI from other computers, you need to change the
  140. \fIGUI Listen Address\fP setting from the default \fB127.0.0.1:8384\fP to
  141. \fB0.0.0.0:8384\fP\&. You also need to open the port in your local firewall if you
  142. have one.
  143. .SS Tunneling via SSH
  144. .sp
  145. If you have SSH access to the machine running Syncthing but would rather not
  146. open the web GUI port to the outside world, you can access it through a SSH
  147. tunnel instead. You can start a tunnel with a command like the following:
  148. .INDENT 0.0
  149. .INDENT 3.5
  150. .sp
  151. .EX
  152. ssh \-L 9999:localhost:8384 machine
  153. .EE
  154. .UNINDENT
  155. .UNINDENT
  156. .sp
  157. This will bind to your local port 9999 and forward all connections from there to
  158. port 8384 on the target machine. This still works even if Syncthing is bound to
  159. listen on localhost only.
  160. .SH VIA A PROXY
  161. .sp
  162. Syncthing can use a SOCKS5 proxy for outbound connections. Please see \X'tty: link #proxying'\fI\%Using Proxies\fP\X'tty: link'\&.
  163. .SH AUTHOR
  164. The Syncthing Authors
  165. .SH COPYRIGHT
  166. 2014-2019, The Syncthing Authors
  167. .\" Generated by docutils manpage writer.
  168. .