明日复明日,明日何其多。
我生待明日,万事成蹉跎。

openwrt/b70/极路由搭建syncthing

Usage

  1. Login to your OpenWrt device via SSH.
  2. Download and extract the Syncthing tarball, and copy the syncthing executable to /usr/bin or any other location that are in your PATH 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/

3.Run Syncthing for the first time.

syncthing

4.If you don’t want the Syncthing Web GUI to be accessible from WAN, you can skip 5 and 6.

5.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>

6.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'

7.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

或者在/etc/init.d/下新建一个syncthing文件。粘贴下面的内容保存。

#!/bin/sh /etc/rc.common
# Copyright (C) 2015 brglng@github.com

START=99
STOP=99

start() {
        service_start /usr/bin/syncthing 2>&1 | logger -t syncthing &
}

stop() {
        service_stop /usr/bin/syncthing
}

执行下面的命令:

$ cp syncthing /etc/init.d
$ chmod +x /etc/init.d/syncthing

8.Enable and start the syncthing service

$ /etc/init.d/syncthing enable
$ /etc/init.d/syncthing start

9.Open http://your-openwrt-device-address:8384 on your browser.

10.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.

11.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'

结束

赞(0) 打赏
未经允许不得转载:致明日 » openwrt/b70/极路由搭建syncthing
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

坚持,总会看见蓝天和白云

联系我们你来了,你就是最棒的!

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏