How to Block An IP Address in Centos (RHEL/Fedora) Linux

This is a simple guide on how to block an IP address in Centos, RHEL or Fedora Linux. To block an ip address, type these two commands: # iptables -A...

This is a simple guide on how to block an IP address in Centos, RHEL or Fedora Linux.

To block an ip address, type these two commands:

iptables -A INPUT -s IP_ADDRESS -j DROP

service iptables save

(Replace IP_ADDRESS with IP Address you want to block)

If you need to unblock an IP Address, use these commands: (-d stands for: delete the rule from iptable):

iptables -D INPUT -s IP_ADDRESS -j DROP

service iptables save

Again, replace IP_ADDRESS with IP Address you want to un-block. I hope this helps.