syncthing-networking.7 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. .\" Man page generated from reStructuredText.
  2. .
  3. .TH "SYNCTHING-NETWORKING" "7" "Nov 18, 2020" "v1" "Syncthing"
  4. .SH NAME
  5. syncthing-networking \- Firewall Setup
  6. .
  7. .nr rst2man-indent-level 0
  8. .
  9. .de1 rstReportMargin
  10. \\$1 \\n[an-margin]
  11. level \\n[rst2man-indent-level]
  12. level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
  13. -
  14. \\n[rst2man-indent0]
  15. \\n[rst2man-indent1]
  16. \\n[rst2man-indent2]
  17. ..
  18. .de1 INDENT
  19. .\" .rstReportMargin pre:
  20. . RS \\$1
  21. . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
  22. . nr rst2man-indent-level +1
  23. .\" .rstReportMargin post:
  24. ..
  25. .de UNINDENT
  26. . RE
  27. .\" indent \\n[an-margin]
  28. .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
  29. .nr rst2man-indent-level -1
  30. .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
  31. .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
  32. ..
  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 forward for port
  52. \fB22000/TCP\fP (or whichever port is set in the \fISync Protocol Listen Address\fP setting).
  53. The external forwarded port and the internal destination port has 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 (or the actual listening port if you have changed
  80. the \fISync Protocol Listen Address\fP setting.)
  81. .IP \(bu 2
  82. Port \fB21027/UDP\fP (for discovery broadcasts on IPv4 and multicasts on IPv6)
  83. .UNINDENT
  84. .SS Uncomplicated Firewall (ufw)
  85. .sp
  86. 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:
  87. .INDENT 0.0
  88. .INDENT 3.5
  89. .sp
  90. .nf
  91. .ft C
  92. sudo ufw allow syncthing
  93. .ft P
  94. .fi
  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. .nf
  103. .ft C
  104. sudo ufw allow syncthing\-gui
  105. .ft P
  106. .fi
  107. .UNINDENT
  108. .UNINDENT
  109. .sp
  110. Allowing external access is \fBnot\fP necessary for a typical installation.
  111. .sp
  112. You can then verify that the ports mentioned above are allowed:
  113. .INDENT 0.0
  114. .INDENT 3.5
  115. .sp
  116. .nf
  117. .ft C
  118. sudo ufw status verbose
  119. .ft P
  120. .fi
  121. .UNINDENT
  122. .UNINDENT
  123. .sp
  124. 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.
  125. .SS Firewalld
  126. .sp
  127. If you are using \fI\%Firewalld\fP <\fBhttps://www.firewalld.org/\fP> it has included
  128. support for syncthing (since version 0.5.0, January 2018), and you can enable
  129. it with:
  130. .INDENT 0.0
  131. .INDENT 3.5
  132. .sp
  133. .nf
  134. .ft C
  135. sudo firewall\-cmd \-\-zone=public \-\-add\-service=syncthing \-\-permanent
  136. sudo firewall\-cmd \-\-reload
  137. .ft P
  138. .fi
  139. .UNINDENT
  140. .UNINDENT
  141. .sp
  142. Similarly there is also a \fBsyncthing\-gui\fP service.
  143. .SH REMOTE WEB GUI
  144. .sp
  145. To be able to access the web GUI from other computers, you need to change the
  146. \fIGUI Listen Address\fP setting from the default \fB127.0.0.1:8384\fP to
  147. \fB0.0.0.0:8384\fP\&. You also need to open the port in your local firewall if you
  148. have one.
  149. .SS Tunneling via SSH
  150. .sp
  151. If you have SSH access to the machine running Syncthing but would rather not
  152. open the web GUI port to the outside world, you can access it through a SSH
  153. tunnel instead. You can start a tunnel with a command like the following:
  154. .INDENT 0.0
  155. .INDENT 3.5
  156. .sp
  157. .nf
  158. .ft C
  159. ssh \-L 9999:localhost:8384 machine
  160. .ft P
  161. .fi
  162. .UNINDENT
  163. .UNINDENT
  164. .sp
  165. This will bind to your local port 9999 and forward all connections from there to
  166. port 8384 on the target machine. This still works even if Syncthing is bound to
  167. listen on localhost only.
  168. .SH VIA A PROXY
  169. .sp
  170. Syncthing can use a SOCKS5 proxy for outbound connections. Please see proxying\&.
  171. .SH AUTHOR
  172. The Syncthing Authors
  173. .SH COPYRIGHT
  174. 2014-2019, The Syncthing Authors
  175. .\" Generated by docutils manpage writer.
  176. .