Created
May 25, 2016 21:02
-
-
Save xardit/cc8d126e86a9221c5aa7149e68feda05 to your computer and use it in GitHub Desktop.
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
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -m comment --comment "allow established sessions to receive traffic" | |
iptables -I INPUT -p tcp --dport 1723 -j ACCEPT -m comment --comment "allow PPTPD" | |
iptables -I INPUT -p tcp --dport 22 -j ACCEPT -m comment --comment "allow SSH" | |
iptables -I INPUT -p gre -j ACCEPT -m comment --comment "allow GRE protocol" | |
iptables -A INPUT -p icmp --icmp-type 0 -m state --state ESTABLISHED,RELATED -j ACCEPT -m comment --comment "allow icmp" | |
iptables -A INPUT -i lo -j ACCEPT -m comment --comment "allow loopback" | |
iptables -A INPUT -j DROP -m comment --comment "block everything else" | |
iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE -m comment --comment "masquerade network on eth0" | |
#save to file all the rules | |
iptables-save > /etc/iptables.rule | |
# then edit and add this to /etc/rc.local to run it at startup | |
iptables-restore < /etc/iptables.rules |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment