syncthing-networking.7 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. .\" Man page generated from reStructuredText.
  2. .
  3. .TH "SYNCTHING-NETWORKING" "7" "Aug 04, 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 PORT FORWARDS
  34. .sp
  35. If you have a NAT router which supports UPnP, the easiest way to get a working
  36. port forward is to make sure UPnP setting is enabled on both Syncthing and the
  37. router – Syncthing will try to handle the rest. If it succeeds you will see a
  38. message in the console saying:
  39. .INDENT 0.0
  40. .INDENT 3.5
  41. .sp
  42. .nf
  43. .ft C
  44. Created UPnP port mapping for external port XXXXX on UPnP device YYYYY.
  45. .ft P
  46. .fi
  47. .UNINDENT
  48. .UNINDENT
  49. .sp
  50. If this is not possible or desirable you should set up a port forward for port
  51. \fB22000/TCP\fP, or the port set in the \fISync Protocol Listen Address\fP setting.
  52. The external forwarded port and the internal destination port has to be the same
  53. (i.e. 22000/TCP).
  54. .sp
  55. Communication in Syncthing works both ways. Therefore if you set up port
  56. forwards for one device, other devices will be able to connect to it even when
  57. they are behind a NAT network or firewall.
  58. .sp
  59. In the absence of port forwarding, relaying may work well enough to get
  60. devices connected and synced, but will perform poorly in comparison to a
  61. direct connection.
  62. .SH LOCAL FIREWALL
  63. .sp
  64. If your PC has a local firewall, you will need to open the following ports for
  65. incoming and outgoing traffic:
  66. .INDENT 0.0
  67. .IP \(bu 2
  68. Port \fB22000/TCP\fP (or the actual listening port if you have changed
  69. the \fISync Protocol Listen Address\fP setting.)
  70. .IP \(bu 2
  71. Port \fB21027/UDP\fP (for discovery broadcasts on IPv4 and multicasts on IPv6)
  72. .UNINDENT
  73. .SS Uncomplicated Firewall (ufw)
  74. .sp
  75. 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:
  76. .INDENT 0.0
  77. .INDENT 3.5
  78. .sp
  79. .nf
  80. .ft C
  81. sudo ufw allow syncthing
  82. .ft P
  83. .fi
  84. .UNINDENT
  85. .UNINDENT
  86. .sp
  87. If you also want to allow external access to the Syncthing web GUI, run:
  88. .INDENT 0.0
  89. .INDENT 3.5
  90. .sp
  91. .nf
  92. .ft C
  93. sudo ufw allow syncthing\-gui
  94. .ft P
  95. .fi
  96. .UNINDENT
  97. .UNINDENT
  98. .sp
  99. Allowing external access is \fBnot\fP necessary for a typical installation.
  100. .sp
  101. You can then verify that the ports mentioned above are allowed:
  102. .INDENT 0.0
  103. .INDENT 3.5
  104. .sp
  105. .nf
  106. .ft C
  107. sudo ufw status verbose
  108. .ft P
  109. .fi
  110. .UNINDENT
  111. .UNINDENT
  112. .sp
  113. 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.
  114. .SS Firewalld
  115. .sp
  116. If you are using [Firewalld](\fI\%https://www.firewalld.org\fP) it has included
  117. support for syncthing (since version 0.5.0, January 2018), and you can enable
  118. it with
  119. .INDENT 0.0
  120. .INDENT 3.5
  121. sudo firewall\-cmd –zone=public –add\-service=syncthing –permanent
  122. sudo firewall\-cmd –reload
  123. .UNINDENT
  124. .UNINDENT
  125. .sp
  126. Similarly there is also a syncthing\-gui service.
  127. .SH REMOTE WEB GUI
  128. .sp
  129. To be able to access the web GUI from other computers, you need to change the
  130. \fIGUI Listen Address\fP setting from the default \fB127.0.0.1:8384\fP to
  131. \fB0.0.0.0:8384\fP\&. You also need to open the port in your local firewall if you
  132. have one.
  133. .SS Tunneling via SSH
  134. .sp
  135. If you have SSH access to the machine running Syncthing but would rather not
  136. open the web GUI port to the outside world, you can access it through a SSH
  137. tunnel instead. You can start a tunnel with a command like the following:
  138. .INDENT 0.0
  139. .INDENT 3.5
  140. .sp
  141. .nf
  142. .ft C
  143. ssh \-L 9999:localhost:8384 machine
  144. .ft P
  145. .fi
  146. .UNINDENT
  147. .UNINDENT
  148. .sp
  149. This will bind to your local port 9999 and forward all connections from there to
  150. port 8384 on the target machine. This still works even if Syncthing is bound to
  151. listen on localhost only.
  152. .SH VIA A PROXY
  153. .sp
  154. Syncthing can use a SOCKS5 proxy for outbound connections. Please see proxying\&.
  155. .SH AUTHOR
  156. The Syncthing Authors
  157. .SH COPYRIGHT
  158. 2014-2019, The Syncthing Authors
  159. .\" Generated by docutils manpage writer.
  160. .