背景:
现有:
一台baidu/ali/tecent云服务器A(地址为a.a.a.a);
一台VPS B(地址为b.b.b.b), B中搭建有ss,监听端口为8000.
需求:
一:使用A做跳板机访问B中搭建的ss。且使用A的12344端口。(即把A的12344转发到B的8000)
二:使用A做跳板机访问国内网站。且使用A的12345端口。
其他要求:使用haproxy实现。
解决方案:
global
user haproxy
group haproxy
daemon
defaults
log global
mode tcp
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
#需求一:
frontend ss-in
bind *:12344
default_backend ss-out
backend ss-out
server server1 a.a.a.a:17001 maxconn 20480
# 需求二:
frontend sunflower-in
bind *:12345
default_backend sunflower-out
backend sunflower-out
server server1 127.0.0.1:8123 maxconn 20480
logSyslog = true
logFile = /dev/null
allowedPorts = 1-65535
tunnelAllowedPorts = 1-65535
proxyAddress = 0.0.0.0
proxyPort = 8123
sudo systemctl enable --now polipo
sudo systemctl enable --now haproxy
不足:
haproxy无法进行udp代理。
原文:https://www.cnblogs.com/dylanchu/p/11335872.html