Created
June 28, 2016 16:32
-
-
Save laetrid/868a61dc2d96e421813aa225d0c07492 to your computer and use it in GitHub Desktop.
Basic iptables config for newly installed Linux
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
# list iptables rules | |
iptables -L -vn | |
# flush iptables in chain, or everywhere if run without chain name | |
iptables -F | |
# change dafault chane rule | |
iptables -P FORWARD DROP | |
# append a new rule | |
iptables -A INPUT -p tcp -s 185.51.156.255 -j ACCEPT | |
# insert a new rule (here in 12th position) | |
iptables -I INPUT 12 -s 10.18.129.11/32 -j ACCEPT | |
# add CONNECTED/RELATED | |
iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT | |
# Save the rules # | |
# Debian | |
apt-get update | |
apt-get install iptables-persistent | |
service iptables-persistent {start|restart|reload|force-reload|save|flush} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment