Skip to content

Instantly share code, notes, and snippets.

Created November 14, 2018 00:36
What would you like to do?
# 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