-
-
Save wzxjohn/3d1f275b1a36b39475d8 to your computer and use it in GitHub Desktop.
iptables rules for IKEv2 VPN and SSH on Ubuntu
This file contains 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
*nat | |
:PREROUTING ACCEPT [0:0] | |
:INPUT ACCEPT [0:0] | |
:OUTPUT ACCEPT [0:0] | |
:POSTROUTING ACCEPT [0:0] | |
-A POSTROUTING -j MASQUERADE | |
-A POSTROUTING -s 172.0.0.0/24 -o eth0 -j MASQUERADE | |
COMMIT | |
*filter | |
:INPUT ACCEPT [0:0] | |
:FORWARD ACCEPT [0:0] | |
:OUTPUT ACCEPT [0:0] | |
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | |
#Accept Related Connections | |
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT | |
#Accept SSH Connections Be sure to change the port to your own SSH port! | |
-A INPUT -p udp -m udp --dport 500 -j ACCEPT | |
#Accept IPSec connections | |
-A INPUT -p udp -m udp --dport 4500 -j ACCEPT | |
#Accept IPSec connections | |
-A FORWARD -s 172.0.0.0/24 -j ACCEPT | |
#Forward packages from 172.0.0.0/24 The subnet is defined in ipsec.conf | |
-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu | |
COMMIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment