Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Member
    Join Date
    Feb 2003
    Posts
    251

    Default 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

  2. #2
    Support Manager cPanelEric's Avatar
    Join Date
    Nov 2007
    Location
    Texas
    Posts
    452
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    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!

  3. #3
    cPanel Quality Assurance Analyst cPanelDon's Avatar
    Join Date
    Nov 2008
    Location
    Houston, Texas, U.S.A.
    Posts
    2,554
    cPanel/Enkompass Access Level

    DataCenter Provider

    Default

    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.

  4. #4
    Member
    Join Date
    Feb 2003
    Posts
    251

    Default

    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 06:54 PM.

  5. #5
    Support Manager cPanelEric's Avatar
    Join Date
    Nov 2007
    Location
    Texas
    Posts
    452
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    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.

  6. #6
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Sep 2007
    Posts
    138

    Default 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.

  7. #7
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    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 01:50 PM.

  8. #8
    Member stugster's Avatar
    Join Date
    Apr 2002
    Location
    Edinburgh, UK
    Posts
    78
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    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?

  9. #9
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    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 11:25 PM.

  10. #10
    Member
    Join Date
    Jun 2009
    Location
    In the heart of obama.
    Posts
    32

    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..

Similar Threads & Tags
Similar threads

  1. Enable Cpanel Users to block email from defined IP addresses?
    By diesel12 in forum E-mail Discussions
    Replies: 3
    Last Post: 10-29-2009, 08:45 PM
  2. block IP addresses right away
    By sehh in forum E-mail Discussions
    Replies: 13
    Last Post: 01-23-2008, 01:31 PM
  3. email sending but not being received by one block of addresses
    By swisslyons in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 12-29-2005, 06:01 AM
  4. What's going on with my IP addresses!?
    By xWho in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 06-15-2004, 06:13 AM
  5. IP addresses
    By welsh-wizard in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 01-17-2003, 10:57 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube