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 to block IP from being served?

Discussion in 'General Discussion' started by SupermanInNY, Nov 11, 2005.

  1. SupermanInNY

    SupermanInNY Well-Known Member

    Joined:
    Jul 19, 2003
    Messages:
    255
    Likes Received:
    0
    Trophy Points:
    16
    Occationally I have an account that is attacked with millions of hits per day.
    This is not so common, yet it still happens every so often.
    Is there a directive in httpd.conf that can block IPs (range or specifics) and prevent such
    access?
    This is of course will be closely monitored as I do not wish to have any IP blocked for a prolong time.
    I have a user who has an avg of 1 gb a day,. and yesterday had 35 gb all from a single IP, with over a million hits.
    Any suggestions?

    Also, if this is possible, is there a GUI to this within cPanel itself (at WHM level only!!).

    -Alon.
     
  2. DigitalSurgeon

    DigitalSurgeon Well-Known Member

    Joined:
    Aug 13, 2005
    Messages:
    134
    Likes Received:
    0
    Trophy Points:
    16
    You can block an IP from the shell by using the below mentioned commands :

    To Firewall/block an IP

    /sbin/iptables -A INPUT -s 192.168.0.1 -j REJECT

    To unblock an IP

    /sbin/iptables -D INPUT -s 192.168.0.1 -j REJECT

    This will block the IP access for the whole server.However if you want to block IP's access to acertain account you can use the CPanel > IP Deny Manager funtion to block that IP to access that site.

    You can also block the whole range of IPs from IP Deny Manager by ignoring the last part i.e 192.168.0 instead of 192.168.0.1
     
  3. SupermanInNY

    SupermanInNY Well-Known Member

    Joined:
    Jul 19, 2003
    Messages:
    255
    Likes Received:
    0
    Trophy Points:
    16
    Wow,.. that was simple :))

    I like the IP manager in cPanel,.. as well as the IPTables solutions.
    How do I list the IPs that are blocked in the IPTables?

    Thanks,

    -Alon.
     
  4. Zaf

    Zaf Well-Known Member

    Joined:
    Aug 22, 2005
    Messages:
    119
    Likes Received:
    0
    Trophy Points:
    16
    To list the rules setup in IPTABLES (-n will give ips and not resolve hosts)
    iptables -L INPUT -n

    See the possible options with brief description
    iptables --help

    Detailed description and understand the command better
    man iptables


    hth
     
  5. SupermanInNY

    SupermanInNY Well-Known Member

    Joined:
    Jul 19, 2003
    Messages:
    255
    Likes Received:
    0
    Trophy Points:
    16

    Yes,. that certainly helped.

    Thank you very much for this very useful info.

    -Alon.
     
Loading...

Share This Page