静看光阴荏苒
不管不顾不问不说也不念

一个全能的梯子鸡搭建过程

主要用到的工具有:V2ray/AdGuard/Kcptun/Caddy,机器是套路云的4.5刀,网卡是内网IP的那种。AdGuard是可以在这种内网IP的机器上用的,特此说明一下。。

为啥要搞个这样的机器?主要是因为前段时间GFW像个沙雕一样疯狂屏蔽IP,我的两台套路云不幸躺枪,而后又因为香港散步那些批事情,导致近一个月来我都不能好好的看个片了。。这几天看样子是缓和了一点,所以重新去买了一台套路云,决定好好折腾一下。

所谓全能,这里指的是:V2ray起4个服务:

一个TCP协议的vmess

一个KCP协议的vmess

一个WebSocket+TLS+WEB协议的vmess

一个Shadowsocks协议

然后AdGuard负责DNS解析和去广告,Kcptun单独用来加速Shadowsocks协议,而Caddy这里只是当作配置WebSocket+TLS+WEB的一个工具。

这样做的话,几个明显的好处是:

如果机器IP被TCP阻断了(呸三下,佛祖保佑我的机器永不阻断!)可以换成KCP去用,无论是vmess的KCP还是Shadowsocks的KCP都不会受TCP阻断的影响。

其次KCP协议属于多倍发包,如果哪天线路比较爆炸也可以做到一个提速的效果。而WebSocket+TLS+WEB是为机器完全被墙后套CDN苟且偷生的准备(呸三下,佛祖保佑我的机器永不被封!)

反正用一句话来说就是:我全都要emmm

安装v2ray:

bash <(curl -L -s https://install.direct/go.sh)

安装adguard(配置的时候把webui端口监听在50005,防止和caddy的80端口冲突):

cd /opt
wget https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.96-hotfix/AdGuardHome_linux_amd64.tar.gz
tar -xzvf AdGuardHome_linux_amd64.tar.gz
rm -rf AdGuardHome_linux_amd64.tar.gz
cd AdGuardHome
./AdGuardHome -s install

安装kcptun:

mkdir -p /opt/kcptun && cd /opt/kcptun
wget https://github.com/xtaci/kcptun/releases/download/v20190611/kcptun-linux-amd64-20190611.tar.gz
tar -xzvf kcptun-linux-amd64-20190611.tar.gz

安装caddy:

curl https://getcaddy.com | bash -s personal

安装supervisor

apt -y install supervisor
systemctl enable supervisor

清空v2ray默认的配置文件/生成一个UUID:

echo "" > /etc/v2ray/config.json
cat /proc/sys/kernel/random/uuid

编辑v2ray的配置文件:

nano /etc/v2ray/config.json

这一套方案最关键的地方就是v2ray要怎么配,下面贴出我目前自用的:

{
  "dns": {
    "servers": [
      "AdGuard的DNS地址,一般就是服务器的公网IP"
    ]
  },
  "inbounds": [
    {
      "port": 50000,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "你的UUID",
            "alterId": 64
          }
        ]
      }
    },
    {
      "port": 50001,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "你的UUID",
            "alterId": 64
          }
        ]
      },
      "streamSettings": {
        "network":"kcp",
        "kcpSettings": {
          "mtu": 1350,
          "tti": 20,
          "uplinkCapacity": 30,
          "downlinkCapacity": 100,
          "congestion": false,
          "readBufferSize": 1,
          "writeBufferSize": 1,
          "header": {
            "type": "none"
          }
        }
      }
    },
    {
      "port": 50002,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "你的UUID",
            "alterId": 64
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "wsSettings": {
          "path": "/python3"
        }
      }
    },
    {
      "port": 50003,
      "protocol": "shadowsocks",
      "settings": {
        "method": "chacha20-ietf-poly1305",
        "password": "你的SS连接密码",
        "network": "tcp,udp"
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {
        "domainStrategy": "UseIP"
      }
    }
  ]
}

上面这个配置你需要修改UUID为你自己生成的,DNSIP为你自己的服务器公网IP,然后再设置一个Shadowsocks密码。

另外这个配置文件分别要起4个端口:

50000(TCPVmess)/50001(KCPVmess)/50002(WebSocket+TLS+WEB)/50003(Shadowsocks)

如果开启了防火墙注意放行这些端口,尤其是套路云/GCP这种大厂,记得去他们的后台放行端口。

配置好了后,使用下面的命令检查你的配置是否完全正确:

/usr/bin/v2ray/v2ray -config /etc/v2ray/config.json -test

如果OK那么重启V2ray的服务即可:

systemctl restart v2ray

TCPVmess/KCPVmess/Shadowsocks只用填好V2ray的配置文件就能用,但WebSocket+TLS+WEB还需要我们额外配置一下Caddy,这里我还是偷懒用的Caddy,如果用Nginx步骤会比现在繁琐很多,我自认为这一套配置已经算非常简单的了。

新建Caddy证书存放目录和配置文件存放目录,然后新建一个站点配置文件:

mkdir -p /etc/caddy && mkdir -p /etc/ssl/caddy
nano /etc/caddy/Caddyfile

写入如下配置(域名和邮箱换成你自己的就行了):

v2.koko.cat {
	log stdout
	tls example@gmail.com
	proxy /python3 localhost:50002 {
		websocket
		header_upstream -Origin
	}
}

这里直接用supervisor去守护caddy的进程,不用以往那种systemctl的方式了,因为我们还要配置kcptun,正好可以都用supervisor,省事:

nano /etc/supervisor/conf.d/caddy.conf

写入如下配置:

[program:caddy]
priority=1
environment=CADDYPATH=/etc/ssl/caddy
directory=/etc/caddy
command=/usr/local/bin/caddy -log stdout -agree=true -conf=/etc/caddy/Caddyfile
autorestart=true

重启supervisor:

systemctl restart supervisor

接下来再配置一下Kcptun套Shadowsocks,首先新建一个Kcptun的配置文件:

nano /opt/kcptun/server-config.json

写入如下配置:

{
"listen": ":50004",
"target": "127.0.0.1:50003",
"key": "你的kcp连接密码",
"crypt": "salsa20",
"mode": "fast2",
"mtu": 1350,
"sndwnd": 1024,
"rcvwnd": 1024,
"datashard": 70,
"parityshard": 30,
"dscp": 46,
"nocomp": false,
"acknodelay": false,
"nodelay": 0,
"interval": 40,
"resend": 0,
"nc": 0,
"sockbuf": 4194304,
"keepalive": 10
}

在上面这个配置文件中,Kcptun监听的端口是50004,加速的是50003端口(即V2ray内的Shadowsocks协议端口)。

再新建一个supervisor的配置文件:

nano /etc/supervisor/conf.d/kcptun.conf

写入如下配置:

[supervisord]
nodaemon=false

[program:kcptun]
priority=1
directory=/opt/kcptun
command=/opt/kcptun/server_linux_amd64 -c server-config.json
autorestart=true

重启supervisor:

systemctl restart supervisor

至此,服务端就配置完成了,不过我们还可以稍微优化一下,即打开AdGuard的WEB界面,加几个去广告的规则:

EasyListChina

https://easylist-downloads.adblockplus.org/easylistchina.txt

EasyList

https://easylist.to/easylist/easylist.txt

以下是这套方案所需要用到的全部端口,如果后续客户端连不上,首先排查你的防火墙是否放行了这些端口:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name             
tcp6       0      0 :::80                   :::*                    LISTEN      6634/caddy          
tcp6       0      0 :::50000                :::*                    LISTEN      6595/v2ray          
tcp6       0      0 :::50002                :::*                    LISTEN      6595/v2ray          
tcp6       0      0 :::50003                :::*                    LISTEN      6595/v2ray          
tcp6       0      0 :::53                   :::*                    LISTEN      6250/AdGuardHome    
tcp6       0      0 :::50005                :::*                    LISTEN      6250/AdGuardHome    
tcp6       0      0 :::443                  :::*                    LISTEN      6634/caddy                 
udp6       0      0 :::50001                :::*                                6595/v2ray          
udp6       0      0 :::50003                :::*                                6595/v2ray          
udp6       0      0 :::50004                :::*                                6635/server_linux_a 
udp6       0      0 :::53                   :::*                                6250/AdGuardHome

现在说下客户端这边,我常用的设备是iOS和Windows,这里我就只说一下这两个平台怎么配置。

iOS上我推荐用kitsunebi,最开始我买了一个shadowrocket结果发现不支持vmess的kcp,我就退款买了kitsunebi,kitsunebi几乎支持所有的vmess类型。

Windows上我推荐v2rayN,用这个基本上你的客户端这块就不用去自己手动写配置文件了,在软件内填一下配置信息就能用。

1 2 3
赞(14)
未经允许不得转载:荒岛 » 一个全能的梯子鸡搭建过程
分享到: 更多 (0)

评论 38

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #1

    沙发 :razz: :razz: :razz:

    xeon5年前 (2019-06-27) Google Chrome 75.0.3770.101 Google Chrome 75.0.3770.101 Android 9 Android 9回复
  2. #2

    Kcptun一看就是富强用的,太明显了。建议别用Kcptun :cool:

    caddy5年前 (2019-06-27) Google Chrome 75.0.3770.100 Google Chrome 75.0.3770.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
  3. #3

    问一下,v2测速时返回500错误是怎么回事?

    光阴逆旅5年前 (2019-06-27) Google Chrome 75.0.3770.100 Google Chrome 75.0.3770.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • v2rayN上面那个测速?是的话我也碰到过,多试几次应该就好了。

      LALA5年前 (2019-06-27) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • 哦,原来如此

        光阴逆旅5年前 (2019-06-29) Google Chrome 75.0.3770.100 Google Chrome 75.0.3770.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
  4. #4

    特朗普:你说的条件我都答应,但别把我的梯子封了 :cry:

    橘子5年前 (2019-06-27) Google Chrome 72.0.3626.142 Google Chrome 72.0.3626.142 Windows 10 x64 Edition Windows 10 x64 Edition回复
  5. #5

    Linux怎么安装我的世界HMCL启动器?出错Java有问题

    欧马可5年前 (2019-06-29) Microsoft Edge 16.16299 Microsoft Edge 16.16299 Xbox Xbox回复
  6. #6

    大佬知道v2ray tls开启强制安全后没法连接是怎么回事吗,把证书装到电脑里也没用 :mad:
    PS:这俩天开新加坡B区很大概率是161 IP

    兰州烧饼5年前 (2019-06-29) Microsoft Edge 18.17763 Microsoft Edge 18.17763 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 在v2ray的服务端上面开启日志记录,连接的时候看看日志。。我开的就是161,还以为是自己运气好,原来是现在很大概率了哈。。

      LALA5年前 (2019-06-29) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • 日志看不出来,用开卡巴斯基把证书替换(连接时卡巴点信任证书)后强制安全能连接,退了卡巴,裸连自签名证书(直接签的ip)不管加不加到本地信任列表都连不上…很迷找了好久都没个办法

        兰州烧饼5年前 (2019-06-29) Firefox 67.0 Firefox 67.0 GNU/Linux x64 GNU/Linux x64回复
        • 搞个免费域名,签个let也比自签ip证书好吧。。

          LALA5年前 (2019-06-30) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
          • 抓包看过….签域名会发sni,我这运营商会reset阿里云之类的ip的连接导致连不上,签ip不发sni不会断…不过现在好像进化出了直接断tcp….

            兰州烧饼5年前 (2019-06-30) Firefox 67.0 Firefox 67.0 GNU/Linux x64 GNU/Linux x64
          • 联通移动双线>阿里云新加坡…移动只要tcp都可能reset,联通ssl client hello带sni偶尔会拦截几分钟…

            兰州烧饼5年前 (2019-06-30) PS4 Web Browser PS4 Web Browser PlayStation 4 PlayStation 4
  7. #7

    lala,现在linode哪个机房国内最友好 :grin: :grin: :grin:

    moe5年前 (2019-06-30) Safari 4.0.5 Safari 4.0.5 iPhone iOS 4.0 iPhone iOS 4.0回复
    • 都是辣鸡,不过你要说做站套个CF也没多大问题就是。

      LALA5年前 (2019-06-30) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
  8. #8

    v2.koko.cat {
    log stdout
    tls example@gmail.com
    proxy /python3 localhost:50002 {
    websocket
    header_upstream -Origin
    }
    }
    更换成自己域名是把localhost更换掉吗?

    joiln5年前 (2019-07-09) Google Chrome 75.0.3770.100 Google Chrome 75.0.3770.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 更换:v2.koko.cat

      LALA5年前 (2019-07-09) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
  9. #9

    adguard这个可以屏蔽youtube广告吗?按照你的教程(加了两个变态规则),全部东西配置好之后,浏览网站之类的,发现google ad可以被屏蔽掉,但是貌似youtube好像屏蔽不了;如果可以的话,可以教教不?

    shengshengman5年前 (2019-07-12) Google Chrome 75.0.3770.100 Google Chrome 75.0.3770.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 你说的youtube广告是指视频开头的那种广告?

      LALA5年前 (2019-07-12) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • 是的,能去除吗? :arrow: :arrow:

        shengshengman5年前 (2019-07-12) Google Chrome 75.0.3770.100 Google Chrome 75.0.3770.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
        • 还想问一个问题 :mrgreen: :mrgreen:
          使用了websocket+tls,那打开自己的网站会提示404 not found,原因是自己没得放内容到vps里,我该把内容放到哪个具体文件夹呢?跪求大佬提示

          shengshengman5年前 (2019-07-12) Google Chrome 75.0.3770.100 Google Chrome 75.0.3770.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
          • 放不放都无所谓了,我这个主要是当备胎用的,就是哪天要是ip被墙了就用这个方法套个CloudFlare,目的是这个。。

            LALA5年前 (2019-07-12) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition
        • 不能。。要是能去除的话那就牛b大发了 :grin:

          LALA5年前 (2019-07-12) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
          • 那我就要放,咋整 :smile: :smile: :smile:

            shengshengman5年前 (2019-07-12) Google Chrome 75.0.3770.100 Google Chrome 75.0.3770.100 Windows 10 x64 Edition Windows 10 x64 Edition
  10. #10

    额,用chrome访问又可以去除广告,那youtube app可以吗

    shengshengman5年前 (2019-07-12) Google Chrome 75.0.3770.100 Google Chrome 75.0.3770.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
  11. #11

    还有一个问题,好像用不了wget,curl

    shengshengman5年前 (2019-07-12) Google Chrome 75.0.3770.100 Google Chrome 75.0.3770.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 用不了wget,curl是什么操作?

      LALA5年前 (2019-07-12) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • 比如我wget -N –no-check-certificate “https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh” && chmod +x tcp.sh && ./tcp.sh就会提示wget unable resolve ‘raw.githubusercontent.com’

        shengshengman5年前 (2019-07-12) Google Chrome 75.0.3770.100 Google Chrome 75.0.3770.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
        • 。。这是什么玄学问题,你nano /etc/resolv.conf看看里面有DNS服务器地址吗?

          LALA5年前 (2019-07-12) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
  12. #12

    大佬是在日本吗,居然用软银!

    liukirby5年前 (2019-07-14) Google Chrome 75.0.3770.100 Google Chrome 75.0.3770.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 想多了,手机越狱后改的运营商名字而已emmm

      LALA5年前 (2019-07-15) Google Chrome 75.0.3770.100 Google Chrome 75.0.3770.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
  13. #13

    Caddy无法启动!哪里能看到日志嘛

    Bobby5年前 (2019-07-29) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 你可以先不用systemd,直接放到前台运行,就可以看到日志。

      LALA5年前 (2019-07-29) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
  14. #14

    V2ray有自带kcp
    https://www.v2ray.com/chapter_02/transport/mkcp.html

    z5年前 (2019-08-08) Firefox 68.0 Firefox 68.0 Android 9 Android 9回复
  15. #15

    来晚辽,最近刚入坑番·羽·土·啬,在某歌搜索v2ray如何更好调教的文章,翻到大大你的这篇教学,文中提到uuid需要生成一个,麻烦站长大大补充个在线生成uuid的网站呗 :cry: :cry: 搜索这类网站,搜出来的许多网站,只是带“生成uuid”的字眼,实质上都是垃圾内容农场

    mayuu酱重症患者4年前 (2020-10-09) UC Browser 11.9.4.974 UC Browser 11.9.4.974 Android 8.1.0 Android 8.1.0回复
  16. #16

    学习了

    光阴逆旅2年前 (2022-01-09) Google Chrome 86.0.4240.198 Google Chrome 86.0.4240.198 Windows 10 x64 Edition Windows 10 x64 Edition回复

分享创造快乐

广告合作资源投稿