View Full Version : Denying IPs (to prevent SPAM)

Mr. Pink
02-09-2010, 08:03 AM

I get a lot of spam through my sites, from spammers that are abusing my contact forms. Every time I get the spam message I can see the IP number of the sender. The sender is of course (in 99% of cases) just a spam robot.

So, I have once denied these IPs by putting them on the .htaccess file (or through the IP Deny Manager on the hosting CP).

Then the list got long and I removed them all, because I really didn't notice any change and was also wondering if denied IPs hur me somehow.

recently I started adding IPs to the list again. As of now, this is the list of denied IPs:

So, I have a few questions.

1 - Does adding an IP on the deny list actually help me in any way?

2 - Can adding an IP on the deny list end up denying legit traffic?

3 - Is it risky to deny a range of IPs, such as 91.214. (when I notice a lot of spam comes from IPs starting with those numbers)?

It seems that the same spammers are revisiting my sites with different IPs every time, so I don't know if denying does any good at all.

Any thoughts?


02-09-2010, 10:20 AM
1. Yes, but as you noticed, with millions of IPS out there, the spammers can always find another.... unless... (See 3)

2. Yes, possibly. Sometimes IP ranges change. I at one point thought I was spamming some russian traffic, but the russian ISP sold the IP block to a Hawaiin ISP so I was blocking Hawaii for a time, accidentially. You should refresh your ranges regularly.

3. If you really want to take a bite out of spam, block whole ranges.


Assuming you don't have any customers in the following countries, block the entire country. Russia, Korea, China, Pakistan, India, Indonesia, Malaysia, Nigeria (all of Africa really) etc.

But refresh those blocks atleast once a year, maybe twice, incase IP ownership changes.

On quite a few of my forums I have taken to doing that. It is draconian, but, it works.

If you have your own server and can block them all at the firewall level, you'll also block a ton of your incoming email spam as well.

The only spam you'll get then is typically from a botnet of infected computers from legitimate countries, so you'll still get some, but a good chunk will be blocked.

Especially forum spam, because a lot of forum spammers have adopt the "pay a real person half a penny a post" method of spamming, which uses people from such countries almost entirely.

Also, don't block an IP range if it is from a country you want customers from, even if you get a lot of spammers from it. If you're unsure the country of an IP, check arin.net

Mr. Pink
02-09-2010, 01:39 PM
Thanks for the quick reply, Chris, and valuable guidelines.

02-19-2010, 11:33 AM
After reading this post I recently banned russia, china, vietnam, korea, nigeria and this has cut my spam to virtually none...thanks!