中继(中转)能用的工具很多,有 HaProxy、iptables、Socat等。
Socat:
优点:支持 TCP/UDP 转发。缺点:不支持端口段(多个端口需要开启多个转发)
HaProxy:
优点:支持 TCP 转发,支持 端口段 转发。缺点:不支持 UDP 转发。
iptables:
优点:支持 TCP/UDP 转发,支持 端口段 转发。缺点:配置麻烦,容易出错。
wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubiBackup/doubi/master/socat.sh && sudo chmod +x socat.sh && sudo bash socat.sh
如果上面的脚本下载不顺畅,可以浏览器打开 https://raw.githubusercontent.com/ToyoDAdoubiBackup/doubi/master/socat.sh
新建 socat.sh
粘贴进去,然后 sudo chmod +x socat.sh && sudo bash socat.sh
运行
sudo bash socat.sh
运行会出现图片中界面,输入1
并回车就会开始安装
输入3
选择 3. 新增 SoCat 后,会提示你依次输入 本地监听端口、欲转发IP、欲转发端口、转发类型。
最后会提示你确认配置是否有误,如果没有问题就按任意键继续,启动成功后就会提示:
——————————————————————————————
Socat 已启动 !
本地监听 IP : 101.132.111.111
本地监听端口 : 4444
远程转发 IP : 149.28.215.33
远程转发端口 : 65333
转发类型 : TCP+UDP
——————————————————————————————