Init script and usage for ARM based OpenWrt devices.
This document is only applicable for devices with an ARM chip, and is only tested on OpenWrt BarrierBreaker 14.07.
-
Login to your OpenWrt device via SSH.
-
Download and extract the Syncthing tarball, and copy the syncthing executable to
/usr/bin
or any other location that are in yourPATH
environment variable. (Please replace the URL and file names with the latest version. You can find the link on https://syncthing.net .)$ curl -k https://github.com/syncthing/syncthing/releases/download/v0.11.9/syncthing-linux-arm-v0.11.9.tar.gz $ tar -zxf syncthing-linux-arm-v0.11.9.tar.gz $ cd syncthing-linux-arm-v0.11.9 $ cp syncthing /usr/bin/
-
Run Syncthing for the first time.
syncthing
When you see a message about your Node ID that looks like this:
[2EQK3] 15:47:15 OK: Ready to synchronize default (read-write) [2EQK3] 15:47:15 INFO: Node 2EQK3ZR77PTBQGM44KE7VQIQG7ICXJDEOK34TO3SWOVMUL4QFBHA is "server1" at [dynamic]
You can press Ctrl-C to stop it.
-
If you don't want the Syncthing Web GUI to be accessible from WAN, you can skip 5 and 6.
-
Modify the Syncthing configuration file.
$ vi ~/.config/syncthing/config.xml
Look for a section that looks like this:
<gui enabled="true" tls="false"> <address>127.0.0.1:8384</address> </gui>
Change it to:
<gui enabled="true" tls="false"> <address>0.0.0.0:8384</address> </gui>
-
Open TCP port 8384 to WAN. Add the following lines in
/etc/config/firewall
:config rule option enabled '1' option target 'ACCEPT' option src 'wan' option proto 'tcp' option dest_port '8384' option name 'Syncthing Web'
-
Download
/etc/init.d/syncthing
from this repository and copy it to/etc/init.d
and make it executable.$ curl -k https://github.com/brglng/syncthing-openwrt/raw/master/etc/init.d/syncthing $ cp syncthing /etc/init.d $ chmod +x /etc/init.d/syncthing
-
Enable and start the syncthing service.
$ /etc/init.d/syncthing enable $ /etc/init.d/syncthing start
-
Open http://your-openwrt-device-address:8384 on your browser.
-
If you have allowed access to your Syncthing Web GUI from WAN, make sure to turn on "GUI Authentication Password" and "Use HTTPS for GUI" in the settings.
-
Open ports 20022/TCP and 21025/UDP to WAN, and set up port forward for port 20022/TCP. Add the following lines in
/etc/config/firewall
:config rule option target 'ACCEPT' option src 'wan' option proto 'tcp' option dest_port '22000' option name 'Syncthing TCP' config rule option enabled '1' option target 'ACCEPT' option src 'wan' option proto 'udp' option dest_port '21025' option name 'Syncthing UDP' config redirect option enabled '1' option target 'DNAT' option src 'wan' option dest 'lan' option proto 'tcp' option src_dport '22000' option dest_ip '192.168.1.1' option dest_port '22000' option name 'Syncthing'