IPTables

From WikiWiki
Jump to navigation Jump to search

List

iptables -L

Add

iptables -A INPUT -p tcp --dport 80 -j ACCEPT

Replace (append)

iptables -R INPUT 1 -p tcp -s 192.168.0.0/24 --dport 80 -j ACCEPT

Delete

iptables -D INPUT 5

== Delete all (flush)

iptables -F

Actually save changes

iptables-save > iptables.dump 
CentOS: iptables-save | sudo tee /etc/sysconfig/iptables
Ubuntu:  sudo /sbin/iptables-save
Red Hat/CentOS: /sbin/service iptables save or /etc/init.d/iptables save