#1 (permalink)  
Old 11-02-2009, 04:36 PM
Registered User
 
Join Date: Feb 2003
Posts: 241
Sash
How To Block 10k IP Addresses

Does anyone know the best way to block 10k IP addresses?

We understand that iptables and hosts.deny will cause too many problems blocking 10k ip addresses.

Thanks,
Mike
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-02-2009, 05:29 PM
cPanelEricE's Avatar
cPanel Staff (Administrator)
 
Join Date: Nov 2007
Location: Texas
Posts: 202
cPanelEricE is on a distinguished road
Howdy,

Can you add any of those up to subnet blocks? A /24 or /8 here and there would help cut down that list drastically. My own list is about 3.5k long and I load them all in a simple for loop like this:

for ip in `cat /root/black-list`; do iptables -I INPUT -s $ip -j DROP; done

it will take some time to run, but it works.

Thanks!
__________________
--Eric(E)
www|twitter|xbox|linkedin
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-02-2009, 05:31 PM
cPanelDon's Avatar
cPanel Staff (Administrator)
 
Join Date: Nov 2008
Location: Houston, Texas, U.S.A.
Posts: 1,511
cPanelDon is on a distinguished road
If a software firewall (iptables) does not satisfy the performance requirements, you may want to consider a dedicated hardware firewall; I would check with your data center for available dedicated hardware firewall solutions.
__________________
For hands-on assistance please reference our new support information page: Where should I go for support?
cPResources: Support Options - Additional Support Options - Forums Search - Mailing Lists(Alt) - Documentation
-- cPanelDon - Donald Holl, Technical Analyst, cPanel Technical Support
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 11-02-2009, 05:45 PM
Registered User
 
Join Date: Feb 2003
Posts: 241
Sash
Quote:
Originally Posted by cPanelEricE View Post
Howdy,

Can you add any of those up to subnet blocks? A /24 or /8 here and there would help cut down that list drastically. My own list is about 3.5k long and I load them all in a simple for loop like this:

for ip in `cat /root/black-list`; do iptables -I INPUT -s $ip -j DROP; done

it will take some time to run, but it works.

Thanks!
I could try to trim the list into smaller subnets.

At 3.5k entries do you have any performance issues?

Thanks,
Mike

Last edited by Sash; 11-02-2009 at 05:54 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 11-03-2009, 07:20 AM
cPanelEricE's Avatar
cPanel Staff (Administrator)
 
Join Date: Nov 2007
Location: Texas
Posts: 202
cPanelEricE is on a distinguished road
Howdy,

This is on my little atom router box at home. I run even more on my little atom cPanel server. Never misses a beat. Just slow at boot time.
__________________
--Eric(E)
www|twitter|xbox|linkedin
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 11-06-2009, 05:27 PM
Registered User
 
Join Date: Sep 2007
Posts: 30
sirdopes is on a distinguished road
Route

Another option is to use route to reject ips.

route add 1.1.1.1 reject

This adds the ip to the routing table and blocks it. I have had 15K+ ips with no problem using this method.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 11-20-2009, 12:47 PM
Senior Member
 
Join Date: Jun 2005
Location: Area 51
Posts: 1,648
Spiral is on a distinguished road
Lightbulb

Quote:
Originally Posted by Sash View Post
Does anyone know the best way to block 10k IP addresses?

We understand that iptables and hosts.deny will cause too many problems blocking 10k ip addresses.

Thanks,
Mike
Why in the world would you want to block that many individual IPs?

You would have to be insane to do that for performance and memory consumption reasons among others!

As cPanelEricE pointed out, you can probably reduce the list greatly by using proper CIDR notation.

Also, if your intent is to block countries, there is much better and far simpler ways to deal with that than just blocking huge IP lists. One that comes to mind immediately is installing GEOIP from Maxmind and then you can just simply block traffic to your site or server by a single country or continent code (For example CN for "China") instead of dealing with long (often outdated) IP range lists.

Another would be to setup a DNS based RBL blacklist database and run IP checks against the RBL!

Last edited by Spiral; 11-20-2009 at 12:50 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 12-02-2009, 06:27 AM
Registered User
 
Join Date: Apr 2002
Location: Edinburgh, UK
Posts: 64
stugster is on a distinguished road
Quote:
Originally Posted by Spiral View Post
Why in the world would you want to block that many individual IPs?
Just thinking out loud here, but DDoS?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 12-02-2009, 07:40 PM
Senior Member
 
Join Date: Jun 2005
Location: Area 51
Posts: 1,648
Spiral is on a distinguished road
Lightbulb

Quote:
Originally Posted by stugster View Post
Just thinking out loud here, but DDoS?
Setting a firewall to try to block IPs from a dDOS attack is futile, and mostly pointless for the most part!

News Flash: 95% of all logged dDoS attack IP address are not actually real!

In fact, the vast majority of IPs that you would try to block aren't even actually being used to attack you whatsoever and are more often than not perfectly innocent 3rd parties who may even be the actual real target!

By masquerading IPs and a little creative packet header manipulation, a hacker could easily make you think that any server on the planet is attacking you and your server will happily log the wrong IP! In fact, the real goal of the hacker might even be to trick you into placing a block or ban someone else! Even more points scored if they can trick you into wrongfully reporting a bogus IP the the upstream as a hacking source! The same technique can be used to trick you into limiting access to your own server or internet networks! (extremely common these days)

There are much,better and far more effective ways to handle dDoS attacks ---

As a rule, I never put any solid faith in the IPs that any regular logs show, and in fact that most often tells me exactly which IPs not to block!

The good news and the flip side of the coin is that it's actually fairly trivial to distinguish legitimate packets from altered packets so the vast majority of dDoS traffic can often be blocked by packet composition instead of by packet origin (which may not even be that reliable in the first place).

Unfortunately many "security administrators" out there remain, technically speaking, often far behind the skill levels or knowledge of the hackers out there, ignorant of knowledge that might be helpful in being more effective in fighting these situations! Each and every day, I see so many administrators take on activities such as racing to block IPs in a dDoS attack simply because they just simply know no any other way to handle the situation!

Last edited by Spiral; 12-02-2009 at 10:25 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 12-10-2009, 12:37 PM
Registered User
 
Join Date: Jun 2009
Location: In the heart of obama.
Posts: 28
BareckObama is on a distinguished road
Arrow

Would you mind sharing with us on how you would filter the legitimate from the illegitimate traffic.
Quote:
Originally Posted by Spiral View Post
The good news and the flip side of the coin is that it's actually fairly trivial to distinguish legitimate packets from altered packets so the vast majority of dDoS traffic can often be blocked by packet composition instead of by packet origin (which may not even be that reliable in the first place).

Unfortunately many "security administrators" out there remain, technically speaking, often far behind the skill levels or knowledge of the hackers out there, ignorant of knowledge that might be helpful in being more effective in fighting these situations! Each and every day, I see so many administrators take on activities such as racing to block IPs in a dDoS attack simply because they just simply know no any other way to handle the situation!
__________________
James K
Ezeelogin - The ultimate multiple server administration & management software.
| Parallel shell | rm -rf protection |and much more..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Enable Cpanel Users to block email from defined IP addresses? diesel12 Mail 3 10-29-2009 07:45 PM
block IP addresses right away sehh Mail 13 01-23-2008 12:31 PM
email sending but not being received by one block of addresses swisslyons cPanel and WHM Discussions 2 12-29-2005 05:01 AM
IP Addresses shar cPanel and WHM Discussions 0 02-15-2003 12:05 PM
IP addresses welsh-wizard cPanel and WHM Discussions 2 01-17-2003 09:57 AM


All times are GMT -5. The time now is 06:58 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
© cPanel Inc