Banning an Entire Country from My Proxy

Discussion in 'Site & Server Administration' started by Sleepy_Sentry, Jan 23, 2007.

  1. #1
    I need to free up some resources on my web proxy's server. I also have a reasonable amount of traffic of Iranians looking up porn. These guys are sucking bandwidth, but are notorious for not producing conversions. Some of the traffic is even from Iranian government facilities!

    I would like to block the entire Iran IP range. If I had my choice I would not block Iran like many proxy owners do, but I need to keep my proxy alive.

    What is the code to block the entire Iran IP range using the .htaccess file? I already have the list of IPs for the country, but it is very long.
     
    Sleepy_Sentry, Jan 23, 2007 IP
  2. rednimer

    rednimer Well-Known Member

    Messages:
    455
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    120
    #2
    maybe something like this

    order allow,deny
    allow from all
    deny from 61.0.0.0/14
    deny from 61.11.0.0/17
    (etc)
     
    rednimer, Jan 23, 2007 IP
  3. lkj

    lkj Peon

    Messages:
    729
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #3
    check out http://www.ipdeny.com IP country blocks and deny the countries you want ;)


    If you are on a VPS or dedicated box, block the country IPs using iptables. If you are on a shared platform, use advice that "rednimer" posted above.
     
    lkj, Jan 23, 2007 IP
  4. Nickower

    Nickower Banned

    Messages:
    437
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Do this, go to cpanel or whatver your using, go to "ban ip" or whatever option you have.
    For example, to block the United Kingom you would type in
    *.co.uk
    For australia
    *.com.au
    For america
    *.com
    And so on.
     
    Nickower, Jan 23, 2007 IP
  5. theblight

    theblight Peon

    Messages:
    246
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #5
    not all Ip has it's hostname counter parts with the endings for each country...put the suggested code of rednimer between the <Directory></Directory> of the particular site or on the .htaccess and it would not affect any surrounding site
     
    theblight, Jan 26, 2007 IP
  6. exponent

    exponent Peon

    Messages:
    1,243
    Likes Received:
    60
    Best Answers:
    0
    Trophy Points:
    0
    #6
    exponent, Feb 9, 2007 IP
  7. theblight

    theblight Peon

    Messages:
    246
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #7
    theblight, Feb 10, 2007 IP