Skip to content

Instantly share code, notes, and snippets.

@ratazzi
Created April 20, 2012 14:50
Show Gist options
  • Save ratazzi/2429249 to your computer and use it in GitHub Desktop.
Save ratazzi/2429249 to your computer and use it in GitHub Desktop.
iptables-rules.sh
# forward openvpn http to local 7777 port, squid cache
iptables -t nat -A PREROUTING -s 10.8.0.0/24 -i tun0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 7777
# VPN NAT
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
# or
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to-source 173.230.148.194
# block ip 200.164.230.186
iptables -A INPUT -s 200.164.230.186/32 -j DROP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment