Skip to content

Instantly share code, notes, and snippets.

Created November 14, 2018 00:36
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save inspector71/e3a42f9db62baeb0f6eda1151e4fcfc9 to your computer and use it in GitHub Desktop.
# Accept all loopback traffic localhost or
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# Accept all local traffic from
iptables -A INPUT -s -d -j ACCEPT
iptables -A OUTPUT -s -d -j ACCEPT
# Forward all eth0, eth1, etc through tun interfaces
iptables -A FORWARD -i eth+ -o tun+ -j ACCEPT
iptables -A FORWARD -i tun+ -o eth+ -j ACCEPT
# Postroute masquerade through tun interfaces
iptables -t nat -A POSTROUTING -o tun+ -j MASQUERADE
# Drop any other traffic through eth adapters
iptables -A OUTPUT -o eth+ ! -d a.b.c.d -j DROP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment