About Linux FAQ

Browse More FAQs:

Block ip address of spammers with iptables under Linux

Posted by Vivek Gite [Last updated: September 25, 2007]

Q. How do I block ip address of spammers with iptables based firewall under CentOS Linux 5?

A. You can simply block IP address of spammers by editing /etc/sysconfig/iptables file under:

a) CentOS Linux
b) Fedora Linux
c) RHEL 4.x/5.x etc

Open file /etc/sysconfig/iptables:
# vi /etc/sysconfig/iptables
Append ip address of spammers as follows:
-A RH-Firewall-1-INPUT -s SPAMMER-IP -j DROP
-A RH-Firewall-1-INPUT -s SPAMMER-SUBNET-BLOCK -j DROP

Save and close the file. Just restart the firewall:
# /etc/init.d/iptables restart

You can also create a small shell script to block lots of IP address at a time.

E-mail this to a friend      Printable version

Related Other Helpful FAQs:

Discussion on This FAQ

  1. Andy Says:

    Hi

    Do you know of any way that it does it automatically by getting a list of known spammers from the internet?

  2. kunal Says:

    How to automatically block a user after multiple failed sshd logins say after 3 failed logins
    for temporary time say 2 days.

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , ,

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.