HostOnNet Blog


Looking for Linux Server Admin or WordPress Expert? We can help.

iptables is firewall used in linux servers. This is a command line tool. Most other firewalls like uwf, csf, apf etc actually use iptables to do the blocking, they are just programs make it easy to work with iptables.

ip table rules on CentOS 6


List Firewall rules

iptables -L -n

Flush Firewall rules

iptables -F

Block an IP

In this example, we block IP subnet

iptables -I INPUT -s -j DROP

Saving and Restoring iptable rules

To save current IP table rules, run

/sbin/iptables-save > /etc/iptables.rules

To restore it on boot, add following to /etc/rc.local

/sbin/iptables-restore < /etc/iptables.rules

Posted in Linux

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.