SS中转方案
纯搬运https://github.com/shadowsocks/shadowsocks/wiki/Setup-a-Shadowsocks-relay
Client <--> VPS_JUMP <--> VPS_TARGET
Easy Version
- Setup Shadowsocks server as usual on VPS_TARGET.
- On VPS_JUMP, enable forwarding. Replace VPS_TARGET_IP and VPS_JUMP_IP with actual IP:
sudo su
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p tcp --dport 8388 -j DNAT --to-destination Target_VPS_IP:8388
iptables -t nat -A POSTROUTING -p tcp -d Target_VPS_IP --dport 8388 -j SNAT --to-source JUMP_VPS_IP
- Set your server to JAPAN_VPS_IP:8388 on your client.
Pro Version
For those who want more control and better performance, use haproxy instead. You can also enable load balance by adding multiple servers.
For Debian 7.0:
On JUMP VPS. Append the following line to /etc/apt/sources.list
deb http://ftp.us.debian.org/debian/ wheezy-backports main
Run
apt-get install haproxy
Edit /etc/haproxy/haproxy.cfg
global
ulimit-n 51200
defaults
log global
mode tcp
option dontlognull
contimeout 1000
clitimeout 150000
srvtimeout 150000
frontend ss-in
bind *:8388
default_backend ss-out
backend ss-out
server server1 US_VPS_IP:8388 maxconn 20480
Then run haproxy -f /etc/haproxy/haproxy.cfg