Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2003
    Location
    Potsdam, NY
    Posts
    646

    Banning Out of Country IPs

    I understand that there are many lists out there countaining the IP ranges of specific countries, but how would I go about creating an htaccess file that would only allow US and Canada visits?

    Does anyone know the IP ranges used in the US and Canada?

  2. #2
    Join Date
    Apr 2000
    Location
    California
    Posts
    3,051
    I don't think you can easily do this, at least not with very high accuracy. Is complete accuracy important to you? What is the purpose/function of this?

  3. #3

  4. #4
    Join Date
    Feb 2003
    Location
    Potsdam, NY
    Posts
    646
    Basically, we have a site that allows uploads of images, files, and mp3s to users and due to some of the features on this site, it would have no use to out of country users except to exploit its features.

    Banning out of country IPs would reduce the possibility of abuse. Accuracy isnt important, really.

  5. #5
    Join Date
    Feb 2003
    Location
    Potsdam, NY
    Posts
    646
    what country would you like to block ?
    You can find it by search around this forum !
    Yes, I know. Like I said in my original post, I want to block ALL countries except US and canada. Blocking all those IPs would result in a larger performance hit than just allowing the US and Canada, which is why I'm asking for those specific IP ranges.

  6. #6
    Join Date
    Apr 2000
    Location
    California
    Posts
    3,051
    I don't know about the list of IP ranges/classes. Really. I'd instead suggest you block A, B and C classes that you _know_ for sure are not US/Canadian based. Some might still be able to access it, but you don't want to make a mistake and block too many US based people. This method goes against everything I'd usually say in regards to security or abuse, and I'd usually recommend you just block everyone and only allow those you know you can trust--in that regard, it would be the more accurate, but it would also potentially block legitimate US/CA based traffic.

  7. #7
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    6,984
    You can try using this list to block the rest of the countries, they have the specific country lists you can use to block for all except USA and Canada. A bit weird to block so extensively : ), but here it is
    http://www.blackholes.us/

  8. #8
    Join Date
    Feb 2005
    Posts
    334
    http://www.iana.org/assignments/ipv4-address-space

    A little more research will show you which provide IP's to where.

  9. #9
    Join Date
    Dec 2001
    Location
    QLD, Australia
    Posts
    284
    This lists current assignations (and their country allocation) for the Arin database. There's a few other registries there too:

    ftp://ftp.arin.net/pub/stats/arin/

    I'll leave the rest up to you (like how to convert the decimal values to IP addresses ).

    Stuart
    Seekbrain.com - Personal Blog
    E-Currency Australia - Crypto Currency Services

  10. #10
    Join Date
    Feb 2003
    Location
    Potsdam, NY
    Posts
    646
    Thanks Guys

Posting Permissions

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