lala.im:Pingtunnel:把TCP/UDP/Sock5伪装成ICMP

運維技術·VPN代理·lala.im · 2020-06-30 · 120 人浏览

原文地址:https://lala.im/7167.html,請支持原作者!該處僅作轉載。

使用这个工具可以让你的某些被TCP阻断的机器重新复活。玩法很多,这里就介绍几个基本的用法。
首先pingtunnel可以直接用来翻墙,无需套用其他的协议,不过貌似不太推荐?这里先介绍这个最基本的用法,后续再介绍套shadowsocks。
服务端系统使用Debian10,安装一些需要用到的工具:

apt -y update
apt -y install wget unzip supervisor shadowsocks-libev

下载/解压pingtunnel二进制文件:

mkdir -p /opt/pingtunnel && cd /opt/pingtunnel
wget https://github.com/esrrhs/pingtunnel/releases/download/2.3/pingtunnel_linux64.zip
unzip pingtunnel_linux64.zip

新建一个supervisor配置文件:

nano /etc/supervisor/conf.d/pingtunnel.conf

写入如下配置:

[program:pingtunnel]
priority=1
directory=/opt/pingtunnel
command=/opt/pingtunnel/pingtunnel -type server -nolog 1 -noprint 1 -key 设置一个你的密码
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/supervisor/pingtunnel.log

更新supervisor配置即可:

supervisorctl update

查看运行状态:

supervisorctl status pingtunnel

类似如下回显说明服务端运行正常:

pingtunnel RUNNING pid 5450, uptime 0:16:10

服务端就部署好了,接下来下载对应客户端系统架构的二进制文件:
https://github.com/esrrhs/pingtunnel/releases
打开cmd/powershell之类的终端,执行下面的命令即可建立一个隧道:

./pingtunnel.exe -type client -l :4455 -s 服务器公网IP -key 你之前设置的密码 -sock5 1 -nolog 1

浏览器SwitchyOmega插件设置socks5代理即可:

範例
这样用的话毕竟不太方便,所以我们还可以用来套shadowsocks,在之前我们已经在服务器上安装好了shadowsocks,这里直接编辑配置文件就行:

nano /etc/shadowsocks-libev/config.json

修改配置为如下所示:

{
    "server":["::", "0.0.0.0"],
    "mode":"tcp_and_udp",
    "server_port":60000,
    "local_port":1080,
    "password":"设置你的ss连接密码",
    "timeout":60,
    "method":"chacha20-ietf-poly1305"
}

注:shadowsocks端口监听在60000。
重启/设置开机自启shadowsocks:

systemctl restart shadowsocks
systemctl enable shadowsocks supervisor

然后在客户端执行如下命令:

./pingtunnel.exe -type client -l :4455 -s 服务器公网IP -t 服务器公网IP:60000 -key 你之前设置的密码 -tcp 1 -nolog 1

最后shadowsocks客户端配置服务器地址为127.0.0.1,端口为4455,密码和加密方式不变:

範例

運維技術 VPN代理 lala.im
Theme Jasmine by Kent Liao