Skip to content

在华硕梅林固件(Asuswrt Merlin)路由器上部署 Shadowsocks 服务器端(ss server)

G.X.F edited this page Nov 7, 2018 · 1 revision
  1. 在路由器上安装 Entware

  2. 安装 ss-server:

$ opkg install shadowsocks-libev-ss-server
  1. 在 U 盘目录下创建 shadowsocks 文件夹:
$ mkdir /tmp/mnt/sda1/shadowsocks/
  1. 创建 ss-server 配置文件:
$ nano /tmp/mnt/sda1/shadowsocks/ss-server.json

保存以下配置内容(酌情修改):

{
    "server":"0.0.0.0",
    "server_port":8443,
    "password":"密码",
    "timeout":300,
    "method":"rc4-md5",
    "fast_open": false,
    "mode": "tcp_and_udp"
}
  1. 启动 ss-server:
$ /opt/bin/ss-server -c /tmp/mnt/sda1/shadowsocks/ss-server.json -f /tmp/mnt/sda1/shadowsocks/ss-server.pid
  1. 添加 ss-server 启动命令到路由器 services-start 启动脚本中:
$ nano /jffs/scripts/services-start

添加以下内容:

# ss-server
/opt/bin/ss-server -c /tmp/mnt/sda1/shadowsocks/ss-server.json -f /tmp/mnt/sda1/shadowsocks/ss-server.pid

给 services-start 添加运行权限:

$ chmod a+rx /jffs/scripts/services-start
  1. 路由器防火墙打开 ss-server 端口:
$ nano /jffs/scripts/firewall-start

添加以下内容:

# Open ports for ss-server
iptables -I INPUT -p tcp --dport 8443 -j ACCEPT
iptables -I INPUT -p udp --dport 8443 -j ACCEPT

给 firewall-start 添加运行权限:

$ chmod a+rx /jffs/scripts/firewall-start
  1. 重启防火墙:
$ service restart_firewall