背景

服务器AB通过WireGuard进行异地组网,现服务器B需要使用A的出口地址访问某服务。

实现

服务器A使用TintProxy 代理B的流量以实现A的出口IP进行访问

安装

apt install tinyproxy

配置

vim /etc/tinyproxy/tinyproxy.conf

注释掉以Allow开头的配置,默认只允许本机代理,注释掉后默认允许所有ip,或进行自定义配置:

Allow 10.0.30.0/24
#Allow 192.168.0.0/16
#Allow 172.16.0.0/12
#Allow 10.0.0.0/8

命令

systemctl start tinyproxy.service
systemctl stop tinyproxy.service
systemctl status tinyproxy.service
systemctl restart tinyproxy.service

验证

┌──(root㉿Kali)-[~]
└─# curl -x 'http://10.0.20.1:8888' cip.cc
IP      : 39.105.xxx.xxx
地址    : 中国  北京
运营商  : 阿里云/电信/联通/移动/铁通/教育网

数据二  : 中国北京北京 | 阿里云

数据三  : 中国北京北京市 | 阿里云

URL     : http://www.cip.cc/39.105.xxx.xxx