-
-
Save sunlei/5f73a7f9b813307c6b22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # For *nix users, just run iptables.shadow | |
| # For OpenWRT users, copy iptables.shadow to /etc/firewall.user | |
| # For OpenWRT users, remember to change OUTPUT to PREROUTING in iptables.footer | |
| ./generate.sh route_table > analysis_result | |
| node minifier.js|node formatter.js --profile=custom --format="iptables -t nat -A SHADOWSOCKS -d %prefix/%mask -j %gw" --netgw RETURN --vpngw ACCEPT > iptables.rules | |
| echo "#!/bin/bash" > iptables.shadow && cat iptables.header >> iptables.shadow && cat iptables.rules | grep RETURN >> iptables.shadow && cat iptables.footer >> iptables.shadow | |
| rm iptables.rules route_table analysis_result | |
| chmod 0755 iptables.shadow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ############## HEADER HERE | |
| # Create new chain | |
| iptables -t nat -N SHADOWSOCKS | |
| # Ignore your shadowsocks server's addresses | |
| # It's very IMPORTANT, just be careful. | |
| # 192.81.133.116 is FoOTOo Public shadowsocks server | |
| iptables -t nat -A SHADOWSOCKS -d REPLACE_YOUR_VPS_ADDRESS_HERE -j RETURN | |
| # Ignore LANs and any other addresses you'd like to bypass the proxy | |
| # See Wikipedia and RFC5735 for full list of reserved networks. | |
| # See ashi009/bestroutetb for a highly optimized CHN route list. | |
| iptables -t nat -A SHADOWSOCKS -d 0.0.0.0/8 -j RETURN | |
| iptables -t nat -A SHADOWSOCKS -d 10.0.0.0/8 -j RETURN | |
| iptables -t nat -A SHADOWSOCKS -d 127.0.0.0/8 -j RETURN | |
| iptables -t nat -A SHADOWSOCKS -d 169.254.0.0/16 -j RETURN | |
| iptables -t nat -A SHADOWSOCKS -d 172.16.0.0/12 -j RETURN | |
| iptables -t nat -A SHADOWSOCKS -d 192.168.0.0/16 -j RETURN | |
| iptables -t nat -A SHADOWSOCKS -d 224.0.0.0/4 -j RETURN | |
| iptables -t nat -A SHADOWSOCKS -d 240.0.0.0/4 -j RETURN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment