Thursday, June 13, 2013

iptables Quick Reference

List current iptables

# iptables -L

To list in numeric form

# iptables -L -n

To include interface information too use verbose output

# iptables -L -n -v 

To append to a chain follow the example below

# iptables -A INPUT -s 10.1.10.1 -p tcp --dport 80 -j ACCEPT

To insert at say 7th position instead of Append

# iptables -I INPUT 7 -s 10.1.10.1 -p tcp --dport 80 -j ACCEPT

To save the iptables so that they survive reboots

# service iptables save

Saves every thing to /etc/sysconfig/iptables

No comments: