Skip to content

Instantly share code, notes, and snippets.

@x2c3z4
Last active December 23, 2016 14:09
Show Gist options
  • Save x2c3z4/f26b7f70cf2bce08a3c00ebb728b3da4 to your computer and use it in GitHub Desktop.
Save x2c3z4/f26b7f70cf2bce08a3c00ebb728b3da4 to your computer and use it in GitHub Desktop.
重定向google 的流量到其他的vps
#!/bin/sh
iptables -t nat -F
#create a new chain named SHADOWSOCKS
iptables -t nat -N SHADOWSOCKS
ips=(google.com www.google.com www.google.com.hk 74.125.203.0/24 64.233.188.0/24 114.134.80.0/24 64.18.0.0/20 64.233.160.0/19 66.102.0.0/20 66.249.80.0/20 72.14.192.0/18 74.125.0.0/16 108.177.8.0/21 173.194.0.0/16 207.126.144.0/20 209.85.128.0/17 216.58.192.0/19 216.239.32.0/19)
for ip in "${ips[@]}";do
iptables -t nat -A SHADOWSOCKS -p tcp -d $ip -j REDIRECT --to-ports 1081
done
iptables -t nat -A SHADOWSOCKS -p tcp -j RETURN
#iptables -t nat -A PREROUTING -p tcp -j SHADOWSOCKS
iptables -t nat -A OUTPUT -p tcp -j SHADOWSOCKS
iptables -t nat --list
@x2c3z4
Copy link
Author

x2c3z4 commented Dec 23, 2016

启动ss-redir,监听1081端口。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment