The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How Do I Block Range of IPs?

Discussion in 'General Discussion' started by bmcpanel, Feb 27, 2007.

  1. bmcpanel

    bmcpanel Well-Known Member

    Joined:
    Jun 1, 2002
    Messages:
    546
    Likes Received:
    0
    Trophy Points:
    16
    Hi. I want to block a range of IPs. Currently, I use the following command as an effective weapon against the IPs of people I find in the log trying to do bad things.

    /sbin/route add -host x.x.x.x reject

    Works like a charm. I then put the offending IP in the file /etc/rc.d/rc.local so that it will reload the bad ips when the server reboots next.

    I also use Chirpy's CSF/LFD firewall, and it succesfully blocks offensive IPs also.

    What I need, though, is the ability to block an entire range of IPs. For example, i have a very persistant hacker trying to access from the range 205.196.x.x. The last two numbers are always changing but the first two remain the same.

    How do I block this "range" of IPs from accessing my server.

    Note, I know how to add a range of IPs in a .htaccess file for a certain account, I put this in...

    deny from 205.196.

    But when I try this with /sbin/route, it will not accept the ip.

    Thanks.
     
  2. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    Check out DNSstuff tools at http://www.dnsstuff.com/ they offer CIDR/Netmask which will assist in getting the IP ranges.

    Mickalo
     
  3. gorilla

    gorilla Well-Known Member

    Joined:
    Feb 3, 2004
    Messages:
    699
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Sydney / Australia
    just block the range like this in your firewall

    205.196.0.0/16

    and if you dont want to be that aggressive

    205.196.111.0/24
     
  4. bmcpanel

    bmcpanel Well-Known Member

    Joined:
    Jun 1, 2002
    Messages:
    546
    Likes Received:
    0
    Trophy Points:
    16
    Cool. That's just what I was looking for. Thanks.
     
Loading...

Share This Page