Blocking all IP's except US & Canada

They have: 1 posts

Joined: Jul 2007

I am looking to make changes to my .htaccess file so that all ip addresses are set to deny and I will explicitly allow only ip addresses from the US & Canada. I am able to discern which IP addresses are allocated to these two countries from the following URL:

I have two questions however.

1) How often are ip addresses reallocated, moved are added to a specific countries block? For instance, is there ever a conceiveable scenario where the US would take over an IP block that was previously allocated to Mexico? Will specific US IP ranges ever fall out of service or move to new countries? Are all IP addresses accounted for? Will the US be adding new IP's moving forward?

2) This will require a good number of entries in my .htaccess file. Will this in effect slow down the web site for all US users to the point where I will loose any benefit I will have received from keeping foreigners out?

He has: 1,758 posts

Joined: Jul 2002

Yes, IP ranges do get re-assigned and moved around.

Personally I use as it gets updated quite frequently.

Can't you just specify the IP's that you want to ALLOW rather than the ones that you want to disallow?


Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.