Last active
February 22, 2016 13:42
-
-
Save VarunAgw/93eec287ab2870b3b85a to your computer and use it in GitHub Desktop.
iptables cheatsheet
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
Programs: | |
iptables | |
ip6iptables | |
Type: | |
INPUT OUTPUT FORWARD | |
ACCEPT DROP REJECT | |
-s = Source IP | |
-d = Destination IP | |
-sport = Source Port | |
-dport = Destination Port | |
Save: | |
iptables-save | |
apt-get install iptables-persistent | |
service iptables-persistent save | |
service iptables-persistent <tab> | |
List: | |
iptables -L | |
iptables -S (in command form) | |
Flush: | |
iptables -F | |
Default: | |
iptables -P INPUT ACCEPT | |
Loopback: | |
iptables -I INPUT 1 -i lo -j ACCEPT | |
Append: | |
iptables -A INPUT -p tcp --dport 22 -s 10.10.10.10 -j DROP | |
Connection: | |
iptables -A INPUT -p tcp --dport 22 -s 10.10.10.10 -m state --state NEW,ESTABLISHED -j ACCEPT | |
iptables -A OUTPUT -p tcp --sport 22 -d 10.10.10.10 -m state --state ESTABLISHED -j ACCEPT | |
iptables -A INPUT -s 52.5.71.33 -j REJECT |
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
iptables -P FORWARD ACCEPT | |
iptables -P INPUT ACCEPT | |
iptables -P OUTPUT ACCEPT | |
iptables -F | |
iptables -I INPUT 1 -i lo -j ACCEPT | |
iptables -A INPUT -s 192.168.56.1 -m state --state NEW,ESTABLISHED -j ACCEPT | |
iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT | |
iptables -P FORWARD DROP | |
iptables -P INPUT DROP | |
iptables -P OUTPUT ACCEPT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment