Results 1 to 7 of 7
  1. #1

    Block all IPs except few

    How do i

    - Block all IP addresses from using all the services of the server except the ones on a safe list..

    I am using Linux with CentOS..
    Thank you..

  2. #2
    Join Date
    Jul 2009
    add a rannge of IP address in /etc/csf/csf.deny which you want to denny and add only IP addresses which you want to allow in /etc/csf/csf.allow

  3. #3
    Join Date
    Jun 2006
    If you're not using CSF which many aren't

    To block an entire range, for example: then use either of the two commands below:
    /sbin/iptables -I INPUT -s -j DROP
    /sbin/iptables -I INPUT -s -j DROP
    They do the same thing, you're just using CIDR notation instead of netmasks...

    Note that using /24 will just block

    For anyone else wondering on FreeBSD then it is:
    ipfw add deny tcp from to any in
    or for just the /24:
    ipfw add deny tcp from to any in
    Last edited by FiberPeer; 08-13-2009 at 04:02 AM.
    FiberPeer.Com | | REAL DDoS Protection | Cloud Hosting | VPS | Dedicated Servers | High Bandwidth Hosting | 1Gbps-10Gbps Unmetered
    FiberPeer DDoS Mitigation | ethProxy Upgraded! | 14-Years Experience | Emergency 24/7 Support
    Visit us @

  4. #4
    What firewall do you use to protect your server?
    Support Facility | 24/7 web hosting technical support services
    Technical support | Server management | Data migration

    Technical Articles

  5. #5
    Join Date
    Jun 2008
    please be carefull blocking the IPs , and if csf try running it on Devel mode first or else you will be locked out
    Light travels faster thn sound.This is why some people look bright until you actually hear them speak

  6. #6
    Just add an entry in your /etc/hosts.deny

    ALL: ALL EXCEPT <IP Range that you allow>

  7. #7
    Also, please allow your machine's IP in /etc/hosts.allow as

    ALL: <Your IP>

Similar Threads

  1. How to block all other IP and allow certain IP using APF
    By Abdo-sa in forum Hosting Security and Technology
    Replies: 2
    Last Post: 04-28-2007, 01:02 PM
  2. How to Block a Block of IP'S
    By LP560 in forum Hosting Security and Technology
    Replies: 3
    Last Post: 01-10-2007, 05:45 PM
  3. To block or not to block mouse right bottom click?
    By Oleks in forum Web Design and Content
    Replies: 56
    Last Post: 02-23-2005, 12:53 PM
  4. Using .htacces block how do i block .css downloads
    By Mosaic in forum Programming Discussion
    Replies: 10
    Last Post: 10-01-2004, 11:26 AM
  5. Replies: 1
    Last Post: 05-19-2004, 07:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts