kcptun+udp2raw+ss双边加速

使用stretch-backports源

1
sh -c 'printf "deb http://deb.debian.org/debian stretch-backports main" > /etc/apt/sources.list.d/stretch-backports.list'

刷新源

1
apt update

安装ss

1
apt -t stretch-backports install shadowsocks-libev

查看ss版本

1
ss-server -h

开启SS实验性测试

1
nohup ss-server -s 127.0.0.1 -p 53103 -k 密码 -m aes-256-cfb >/dev/null 2>&1 &

kcptun下载

1
https://github.com/xtaci/kcptun/releases

kcptun服务器端配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
cat >/root/kcp.json << EOF
{
"listen": ":30001",
"target": "127.0.0.1:53103",
"key": "密码",
"crypt": "aes",
"mode": "fast",
"mtu": 1300,
"sndwnd": 1024,
"rcvwnd": 1024,
"datashard": 10,
"parityshard": 3,
"dscp": 0,
"nocomp": true,
"acknodelay": false,
"nodelay": 1,
"interval": 20,
"resend": 2,
"nc": 1,
"sockbuf": 4194304,
"keepalive": 10
}
EOF

udp2raw下载

1
https://github.com/wangyu-/udp2raw-tunnel/releases

udp2raw服务器端配置

1
2
3
4
5
6
7
8
9
10
11
12
13
cat >/root/udp.conf << EOF
-s
-l 0.0.0.0:8855
-r 127.0.0.1:30001
--raw-mode faketcp
--key 密码
--cipher-mode aes128cbc
--auth-mode md5
--auto-rule
--keep-rule
--seq-mode 3
--retry-on-error
EOF

开机启动配置

1
2
3
4
5
6
7
8
9
10
cat >/etc/rc.local << EOF
#!/bin/sh -e
#
# rc.local

# shadowsocks + kcptun + udp2raw 加速端口 53103 串联端口 30001 客户远程连接端口 8855
kcptun -c /root/kcp.json >/dev/null 2>&1 &
udp2raw --conf-file /root/udp.conf >/dev/null 2>&1 &
exit 0
EOF

加权限

1
chmod +x /etc/rc.local

开机启动

1
systemctl enable rc-local

启动rc-local

1
systemctl start rc-local.service

客户端udp2raw配置

1
2
3
4
5
6
7
8
9
10
11
12
13
cat >/root/udp.conf << EOF
-c
-r 176.32.35.67:8855
-l 127.0.0.1:30001
--raw-mode faketcp
--key 密码
--cipher-mode aes128cbc
--auth-mode md5
--auto-rule
--keep-rule
--seq-mode 3
--retry-on-error
EOF

客户端kcptun配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
cat >/root/kcp.json << EOF
{
"localaddr": ":3322",
"remoteaddr": "127.0.0.1:30001",
"key": "密码",
"crypt": "aes",
"mode": "fast",
"conn": 1,
"autoexpire": 0,
"scavengettl": 600,
"mtu": 1300,
"sndwnd": 128,
"rcvwnd": 512,
"datashard": 10,
"parityshard": 3,
"dscp": 0,
"nocomp": true,
"sockbuf": 4194304,
"keepalive": 10
}
EOF

安装后台守护程序

1
opkg install coreutils-nohup

openwrt-系统-启动项

1
2
3
4
5
6
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
nohup kcptun -c /root/kcp.json>/dev/null 2>&1 &
/bin/sleep 30
nohup udp2raw --conf-file /root/udp.conf>/dev/null 2>&1 &
exit 0

电脑终端

1
2
3
4
服务器:192.168.92.1
端口:3322
密码:ss密码
加密方式:aes-256-cfb

坚持原创技术分享,您的支持将鼓励我继续创作!