MENU

xkcptun服务端安装编译过程(待完善,等忙完更新)

August 22, 2017 • Read: 80 • 各种资源

前言:

xkcptun开源地址:https://github.com/liudf0716/xkcptun
博主也是个小白,因为富强才接触了点Linux,无奈现在很多大佬的路由固件里都添加了xkcptun,我一向不折腾手痒。。。但是网上又没找到具体的编译教程。期间放弃很多次,主要是其中一条cmake .. (camke -DBUILD_STATIC_LINK=yes .. //静态链接)这个指令。。。说到这里,估计大佬都要笑出声了/捂脸。。。经过不断的尝试。。。结果居然还编译成功了。。。路由器在家,我在公司,没法截路由的图。废话不多说了。如有错误的地方,请大佬指点一下。。。

开始安装:

我这里用的是debian7 x86系统。

本文系统为最小化安装。期间需要用到的几个工具,我们先装下

apt-get update
apt-get install gcc make git cmake

首先xkcptun依赖libevent2
那我们先来装下libevent2

安装libevent2库后

apt-get install libevent-dev

你说你喜欢手动的?(可忽略)

wget --no-check-certificate https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
tar zxvf libevent-2.1.8-stable.tar.gz
cd libevent-2.1.8-stable
./configure –prefix=/usr    (这个好像复制粘贴还不行。。。得手动输)
make && make install

接下来呢:

git clone https://github.com/liudf0716/xkcptun.git
cd xkcptun
mkdir build && cd build
cmake /root/xkcptun
make

生成xkcp_client, xkcp_server, xkcp_spy

配置参数

server.json 如下:

{
  "localinterface": "eth0",
  "localport": 9089,
  "remoteaddr": "192.168.199.18",
  "remoteport": 80,
  "key": "换成你的密钥",
  "crypt": "none",
  "mode": "fast2",
  "mtu": 1350,
  "sndwnd": 1024,
  "rcvwnd": 1024,
  "datashard": 10,
  "parityshard": 3,
  "dscp": 0,
  "nocomp": true,
  "acknodelay": false,
  "nodelay": 0,
  "interval": 20,
  "resend": 2,
  "nc": 1,
  "sockbuf": 4194304,
  "keepalive": 10
}

client.json如下:

{
  "localinterface": "eth0",
  "localport": 9088,
  "remoteaddr": "192.168.199.18",
  "remoteport": 9089,
  "key": "换成你的密钥",
  "crypt": "none",
  "mode": "fast2",
  "mtu": 1350,
  "sndwnd": 1024,
  "rcvwnd": 1024,
  "datashard": 10,
  "parityshard": 3,
  "dscp": 0,
  "nocomp": true,
  "acknodelay": false,
  "nodelay": 0,
  "interval": 20,
  "resend": 2,
  "nc": 1,
  "sockbuf": 4194304,
  "keepalive": 10
}

服务端参数:

xkcp_server -c server.json -d 0

客户端指令:

xkcp_client -c server.json -d 0

查看服务器端的情况

xkcp_spy -h 192.168.199.18 -s -t status

查看客户端的情况

xkcp_spy -h 192.168.199.18 -c -t status
Tags: None
Leave a Comment

已有 1 条评论
  1. 衍生 衍生

    服务端参数那一步骤。提示:xkcp_server: command not found,怎么办.