-
-
Save simonlucalandi/580ed5f988a2e16f2e3399c745477395 to your computer and use it in GitHub Desktop.
iptables rules for vpn config
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
# for ISAKMP (handling of security associations) | |
iptables -A INPUT -p udp --dport 500 --j ACCEPT | |
# for NAT-T (handling of IPsec between natted devices) | |
iptables -A INPUT -p udp --dport 4500 --j ACCEPT | |
# for ESP payload (the encrypted data packets) | |
iptables -A INPUT -p esp -j ACCEPT | |
# for the routing of packets on the server | |
iptables -t nat -A POSTROUTING -j SNAT --to-source %IP% -o eth0 | |
# internet access | |
iptables -t nat -A POSTROUTING -s 10.0.42.0/24 -o eth0 -m policy --dir out --pol ipsec -j ACCEPT | |
iptables -t nat -A POSTROUTING -s 10.0.42.0/24 -o eth0 -j MASQUERADE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment