2017-08-06 00:46:25 -07:00
|
|
|
|
# udp2raw+kcptun 加速tcp流量 Step by Step 教程
|
|
|
|
|

|
|
|
|
|
|
2017-10-20 21:28:01 -07:00
|
|
|
|
本教程会一步一步演示用udp2raw+kcptun加速SSH流量的过程。加速任何其他tcp流量也一样,包括$\*\*\*;本文避免涉及科学上网,所以演示ssh。
|
2017-08-06 00:46:25 -07:00
|
|
|
|
|
|
|
|
|
### 环境要求
|
2017-08-16 21:46:36 -07:00
|
|
|
|
两边的主机都是linux,有root权限。 可以是openwrt路由器或树莓派,也可以是root了的android。
|
|
|
|
|
|
2018-02-23 16:39:41 +08:00
|
|
|
|
在windows/mac上运行udp2raw可以参考这个教程:
|
|
|
|
|
|
|
|
|
|
https://github.com/wangyu-/udp2raw-tunnel/wiki/在windows-mac上运行udp2raw客户端,带图形界面
|
2017-08-06 00:46:25 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 安装
|
|
|
|
|
下载好kcptun和udp2raw的压缩包,解压分别解压到client端和server端。
|
|
|
|
|
|
|
|
|
|
https://github.com/xtaci/kcptun/releases
|
|
|
|
|
https://github.com/wangyu-/udp2raw-tunnel/releases
|
|
|
|
|
|
|
|
|
|
解压好后,如图:
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
### 运行
|
|
|
|
|
1.在远程服务器运行 udp2raw_amd64 server模式:
|
|
|
|
|
```
|
|
|
|
|
./udp2raw_amd64 -s -l0.0.0.0:8855 -r 127.0.0.1:4000 -k "passwd" --raw-mode faketcp -a
|
|
|
|
|
```
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
2.在本地运行udp2raw_amd64 client模式,假设server ip是45.66.77.88:
|
|
|
|
|
```
|
|
|
|
|
./udp2raw_amd64 -c -r45.66.77.88:8855 -l0.0.0.0:4000 --raw-mode faketcp -a -k"passwd"
|
|
|
|
|
```
|
|
|
|
|
如果一切正常client端输出如下,显示client_ready:
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
server端也会有类似输出,显示server_ready:
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
3.在远程服务器运行 kcp server
|
2017-08-07 16:05:27 -07:00
|
|
|
|
|
|
|
|
|
|
2017-08-06 00:46:25 -07:00
|
|
|
|
```
|
|
|
|
|
./server_linux_amd64 -t "127.0.0.1:22" -l ":4000" -mode fast2 -mtu 1300
|
|
|
|
|
```
|
2017-08-07 16:05:27 -07:00
|
|
|
|
-mtu 1300很重要,或者设置成更小。
|
2017-08-06 00:46:25 -07:00
|
|
|
|

|
|
|
|
|
|
|
|
|
|
4.在本地运行
|
2017-08-07 16:05:27 -07:00
|
|
|
|
|
|
|
|
|
|
2017-08-06 00:46:25 -07:00
|
|
|
|
```
|
2017-08-07 16:05:27 -07:00
|
|
|
|
./client_linux_amd64 -r "127.0.0.1:4000" -l ":3322" -mode fast2 -mtu 1300
|
2017-08-06 00:46:25 -07:00
|
|
|
|
```
|
2017-08-07 16:05:27 -07:00
|
|
|
|
-mtu 1300很重要,或者设置成更小。
|
2017-08-06 00:46:25 -07:00
|
|
|
|

|
|
|
|
|
|
|
|
|
|
5.所有准备工作已经做好,在本地运行
|
|
|
|
|
```
|
|
|
|
|
ssh -p 3322 root@127.0.0.1
|
|
|
|
|
```
|
|
|
|
|
已经连进去了,而且是经过kcptun加速的:
|
|
|
|
|

|