KCPTun 手动部署安装

服务端安装:

kcptun地址 https://github.com/xtaci/kcptun/releases

1
2
3
4
5
6
#创建kcptun目录
mkdir /root/kcptun
cd /root/kcptun
#下载并解压对应32或者64位版本
wget https://github.com/xtaci/kcptun/releases/download/v20210624/kcptun-linux-arm64-20210624.tar.gz
tar -zxf kcptun-linux-arm64-20210624.tar.gz

创建配置文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#创建server-config.json
vim /root/kcptun/server-config.json

#内容:
{
"listen": ":8070",
"target": "127.0.0.1:8060",
"key": "123456",
"crypt": "aes",
"mode": "fast",
"mtu": 1350,
"sndwnd": 512,
"rcvwnd": 512,
"datashard": 10,
"parityshard": 3,
"dscp": 0,
"nocomp": false,
"acknodelay": false,
"nodelay": 0,
"interval": 40,
"resend": 0,
"nc": 1,
"sockbuf": 4194304,
"keepalive": 10,
"log": "/root/kcptun/kcptun.log"
}

内容描述:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
   "listen"		//Kcptun 服务端运行端口
"target" //需要加速的地址
"key" //Kcptun 密码
"crypt" //加密方式
"mode" //加速模式
"mtu" //UDP 数据包的 MTU (最大传输单元)值
"sndwnd" //发送窗口大小(sndwnd)
"rcvwnd" //接收窗口大小(rcvwnd)
"datashard" //前向纠错 datashard
"parityshard" //前向纠错 parityshard,
"dscp" //差分服务代码点(DSCP)
"nocomp" //数据压缩
"nodelay" //是否开启nodelay模式,0不开启;1 启用
"interval" //协议内部工作间隔,单位为毫秒,如10 ms或20 ms
"resend" //快速重传模式,0代表默认关闭,可设置22个ACK跨度会导致直接重传)
"nc" //是否关闭流量控制,默认0不关闭,1关闭
"sockbuf" //套接字缓冲区
"keepalive" //心跳间隔
"log" //指定要输出的日志文件

创建脚本文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#创建 start.sh
vim /root/kcptun/start.sh
#内容:
cd /root/kcptun/
./server_linux_arm64 -c /root/kcptun/server-config.json 2>&1 &
echo "Kcptun started."

#创建 stop.sh
vim /root/kcptun/stop.sh
#内容:
echo "Stopping Kcptun..."
PID=`ps -ef | grep server_linux_arm64 | grep -v grep | awk '{print $2}'`
if [ "" != "$PID" ]; then
echo "killing $PID"
kill -9 $PID
fi
echo "Kcptun stoped."

#创建 restart.sh
vim /root/kcptun/restart.sh
#内容:
cd /root/kcptun/
sh stop.sh
echo "Restarting Kcptun..."
sh start.sh

客户端下载:

Windows 和 Linux 客户端
https://github.com/xtaci/kcptun/releases/

Windows 图形界面客户端
https://github.com/dfdragon/kcptun_gclient/releases

Windows 客服端shadowsocks插件
https://github.com/shadowsocks/kcptun/releases

android 客户端
https://github.com/shutup/Kcptun_android/releases

android 客户端shadowsocks插件
https://github.com/shadowsocks/kcptun-android/releases

注意:

1
2
3
需要开启kcptun对应的防火墙udp端口
服务端和客户端的部分配置不一致,会导致无法连接
服务端和客户端的版本最好一致,如果不一致可以去 kcptun 的项目地址中下载对应你系统的最新版

防火墙教程:Ubuntu配置iptables防火墙