Page:
							Setup a Shadowsocks relay
						
						
					
					
							Pages
							
							
								Ban Brute Force Crackers
							
								Block Connection to localhost
							
								Change Server on the Fly
							
								Configuration via Config File
							
								Configure Multiple Users
							
								Configure Shadowsocks with Supervisor
							
								Connect to OpenVPN over Shadowsocks
							
								Convert Shadowsocks into an HTTP proxy
							
								Encryption
							
								Feature Comparison across Different Versions
							
								Forcing Chrome to Use Socks5 Proxy
							
								Generate QR Code for Android or iOS Clients
							
								Gentoo overlay
							
								Graceful shutdown and restart
							
								Home
							
								Install Shadowsocks Server on Windows
							
								Manage Multiple Users
							
								Objective
							
								Optimizing Shadowsocks
							
								Ports and Clients
							
								Salsa20
							
								Securing Public Shadowsocks Server
							
								Setting Up Shadowsocks on Linode
							
								Setup a Shadowsocks relay
							
								Shadowsocks 使用说明
							
								TCP Fast Open
							
								Troubleshooting
							
								Using Shadowsocks with Command Line Tools
							
								Workers
							
								优化 Shadowsocks
							
								回复模版
							
								在 Linode 上快速搭建 Shadowsocks
							
								用 Supervisor 运行 Shadowsocks
							
						
					No results
				
					9 
					Setup a Shadowsocks relay
					
				
						
						clowwindy edited this page 2015-01-11 21:23:31 +08:00 
					
				Table of Contents
If you want your client connected to a Japan VPS, but you want a US IP.
Client <--> Japan VPS <--> US VPS
Easy version:
- 
Setup Shadowsocks server as usual on US VPS. 
- 
On Japan VPS, enable forwarding. Replace US_VPS_IPandJAPAN_VPS_IPwith 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 US_VPS_IP:8388 iptables -t nat -A POSTROUTING -p tcp -d US_VPS_IP --dport 8388 -j SNAT --to-source JAPAN_VPS_IP
- 
Set your server to JAPAN_VPS_IP:8388 on your client. 
Better 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 Japan 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