Skip to content

Instantly share code, notes, and snippets.

@WanpengQian
Created March 28, 2016 07:17
Show Gist options
  • Save WanpengQian/c7fd5adcb727aa5db0fd to your computer and use it in GitHub Desktop.
Save WanpengQian/c7fd5adcb727aa5db0fd to your computer and use it in GitHub Desktop.
iptables -t nat -N REDSOCKS
iptables -t nat -A REDSOCKS -d 0.0.0.0/8 -j RETURN
iptables -t nat -A REDSOCKS -d 10.0.0.0/8 -j RETURN
iptables -t nat -A REDSOCKS -d 127.0.0.0/8 -j RETURN
iptables -t nat -A REDSOCKS -d 169.254.0.0/16 -j RETURN
iptables -t nat -A REDSOCKS -d 172.16.0.0/12 -j RETURN
iptables -t nat -A REDSOCKS -d 192.168.0.0/16 -j RETURN
iptables -t nat -A REDSOCKS -d 224.0.0.0/4 -j RETURN
iptables -t nat -A REDSOCKS -d 240.0.0.0/4 -j RETURN
iptables -t nat -A REDSOCKS -p tcp -j REDIRECT --to-ports 12345
iptables -t nat -A PREROUTING --in-interface eth0 -p tcp -j REDSOCKS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment