iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
IT Discussion Forum Having IT issues? Got IT questions? Who doesn't? If you can't get your Apache to work with your MySQL or your php is choking on your ODBC... Let's see if we can help you come up with some ideas.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-07-2008, 02:32 PM
WebProWorld New Member
 
Join Date: Jul 2008
Posts: 7
mrl72 RepRank 0
Default Blocking non-US IPs?

Can anyone recommend a method/service for blocking access to non US IP addresses? I've tried a couple of web services but nothing 100% reliable.

Thanks!
Reply With Quote
  #2 (permalink)  
Old 10-07-2008, 04:23 PM
WebProWorld Member
 
Join Date: Jun 2006
Posts: 59
thorfjalar RepRank 1
Default Re: Blocking non-US IPs?

Do you need to block access from personal computer to websites with non-US IP or block access to website from computers with non-US IP?
Reply With Quote
  #3 (permalink)  
Old 10-07-2008, 06:32 PM
WebProWorld Pro
 
Join Date: Jan 2008
Posts: 290
Tech Manager RepRank 1
Default Re: Blocking non-US IPs?

Quote:
Originally Posted by mrl72 View Post
Can anyone recommend a method/service for blocking access to non US IP addresses? I've tried a couple of web services but nothing 100% reliable.

Thanks!
Sure thing. Go to Country IP Blocks. You can create your country specific access control lists in seven different formats. You can select one or all 247 different countries and instantaneously generate .htaccess deny/allow lists or produce lists to meet your formatting needs.

The database contains information on 4.3 billion IP addresses and is completely refreshed each day with the latest RIR information.

Country IP Blocks: Network Allocations by Country with Searchable IP Database
__________________
I use Country IP Blocks as added security for my networks and servers.
Reply With Quote
  #4 (permalink)  
Old 10-08-2008, 09:28 AM
Clint1's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: Jun 2005
Location: Louisiana, USA
Posts: 1,278
Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9
Default Re: Blocking non-US IPs?

Quote:
Originally Posted by mrl72 View Post
Can anyone recommend a method/service for blocking access to non US IP addresses? I've tried a couple of web services but nothing 100% reliable.

Thanks!
I use cPanel's "IP Deny" area which adds entries to the .htaccess file. This is only on Unix/Apache servers though.
__________________
God Bless,
-Clint
(Join Date: 2003)
Reply With Quote
  #5 (permalink)  
Old 10-09-2008, 08:41 AM
kgun's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: May 2005
Location: Norway
Posts: 5,612
kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9
Default Re: Blocking non-US IPs?

Quote:
Originally Posted by Clint1 View Post
I use cPanel's "IP Deny" area which adds entries to the .htaccess file. This is only on Unix/Apache servers though.
Interesting. What is your experience with it?
Reply With Quote
  #6 (permalink)  
Old 10-09-2008, 12:17 PM
Clint1's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: Jun 2005
Location: Louisiana, USA
Posts: 1,278
Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9
Default Re: Blocking non-US IPs?

It works fine. However, (LONG story short), there's some serious bugs with regards to that in combination with Hot Link Protection. If you don't use HL Protection, you're ok. Otherwise you have to manually edit the htaccess file forget about the cPanel easy-edit interfaces. So I just manually paste IP's or partial IP's in the htaccess file.

deny from 123. blocks everything beginning with "123". deny from 124.567.890 only blocks that specific IP address.
__________________
God Bless,
-Clint
(Join Date: 2003)
Reply With Quote
  #7 (permalink)  
Old 11-06-2008, 11:11 AM
netman4ttm's Avatar
WebProWorld Veteran
 
Join Date: Aug 2003
Location: Virginia
Posts: 331
netman4ttm RepRank 1
Default Re: Blocking non-US IPs?

We block at the firewall. Using PF from BSD, but any decent Firewall can be used.
__________________
"The future is here. It's just not evenly distributed.
Reply With Quote
  #8 (permalink)  
Old 11-06-2008, 11:33 AM
kgun's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: May 2005
Location: Norway
Posts: 5,612
kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9
Default Re: Blocking non-US IPs?

"The future is here. It's just not evenly distributed.

Hm.

IMO it is too early to know the future.
Reply With Quote
  #9 (permalink)  
Old 01-19-2009, 07:03 PM
netman4ttm's Avatar
WebProWorld Veteran
 
Join Date: Aug 2003
Location: Virginia
Posts: 331
netman4ttm RepRank 1
Default Re: Blocking non-US IPs?

This is a quick and dirty example of pf blocking a specific ip range using pf on FreeBSD This was for the ftp port
same line except of course port 80
block in on $ext_if proto tcp from 118.107.162.0/24 to port 21

TAKEN from this setup

set block-policy return
ext_if=bge0
int_if=bge1
udp_services = "{ domain, ntp }"
icmp_types = "echoreq"
scrub in all
block in on $ext_if

set skip on lo
pass inet proto icmp all icmp-type $icmp_types keep state
pass quick inet proto { tcp, udp } to any port $udp_services
pass in on $int_if proto tcp from any to $int_if port 53
pass in on $int_if proto udp from any to $int_if port 53
pass in on $int_if proto tcp from any to $int_if port 80
pass in on $int_if proto udp from any to $int_if port 80
pass in on $int_if proto tcp from any to $int_if port 22
pass in on $int_if proto tcp from any to any port 21 keep state
pass in on $int_if proto tcp from any to any port > 30000 keep state
pass out on $int_if proto { tcp, udp } all

pass in on $ext_if proto tcp from any to $ext_if port 53
pass in on $ext_if proto udp from any to $ext_if port 53
pass in on $ext_if proto tcp from any to $ext_if port 80
pass in on $ext_if proto udp from any to $ext_if port 80
pass in on $ext_if proto tcp from any to any port 21 keep state
pass in on $ext_if proto tcp from any to any port > 30000 keep state
pass out on $ext_if proto { tcp, udp } all
block in on $ext_if proto tcp from 118.107.162.0/24 to port 21
antispoof for $ext_if
antispoof for $int_if
__________________
"The future is here. It's just not evenly distributed.
Reply With Quote
  #10 (permalink)  
Old 01-20-2009, 07:03 PM
WebProWorld New Member
 
Join Date: Jan 2009
Location: McKinney, TX
Posts: 10
sfatula RepRank 0
Default Re: Blocking non-US IPs?

Keeping in mind of course that the saavy overseas "shopper" can just as easily use a web proxy and still get to your site.
Reply With Quote
  #11 (permalink)  
Old 01-21-2009, 12:26 PM
netman4ttm's Avatar
WebProWorld Veteran
 
Join Date: Aug 2003
Location: Virginia
Posts: 331
netman4ttm RepRank 1
Default Re: Blocking non-US IPs?

Quote:
Originally Posted by sfatula View Post
Keeping in mind of course that the saavy overseas "shopper" can just as easily use a web proxy and still get to your site.
True but since you are a wary sys admin you would be watching your logs and add the offending ip number to your deny.
__________________
"The future is here. It's just not evenly distributed.
Reply With Quote
  #12 (permalink)  
Old 01-21-2009, 05:19 PM
kgun's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: May 2005
Location: Norway
Posts: 5,612
kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9
Default Re: Blocking non-US IPs?

Disallow all and then allow US's IP's.

More info here from a Norwegian Ip: Network and System Administration I 10
Reply With Quote
  #13 (permalink)  
Old 01-21-2009, 05:28 PM
WebProWorld New Member
 
Join Date: Jan 2009
Location: McKinney, TX
Posts: 10
sfatula RepRank 0
Default Re: Blocking non-US IPs?

Of course a good system admin would locate offenders if they were on top of things. I merely wanted to point out that it isn't fail-safe by itself. I know you know that, for others.

It's definitely a cat and mouse game. Of course, the same applies not only to web services, but, email and other services. That's why the firewall is a better choice than simply adding to .htaccess
Reply With Quote
  #14 (permalink)  
Old 01-21-2009, 05:36 PM
kgun's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: May 2005
Location: Norway
Posts: 5,612
kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9kgun RepRank 9
Default Re: Blocking non-US IPs?

Yes, and there are foreigners signing up on Norwegian Ip's. That must be a much bigger problem to the USA, but there may be some hosters to avoid
Reply With Quote
  #15 (permalink)  
Old 03-05-2009, 12:10 PM
WebProWorld Member
 
Join Date: Jan 2009
Posts: 27
Superaff RepRank 0
Default Re: Blocking non-US IPs?

Quote:
Originally Posted by mrl72 View Post
Can anyone recommend a method/service for blocking access to non US IP addresses? I've tried a couple of web services but nothing 100% reliable.

Thanks!
You can try either paid or free proxies. These proxy sites will mask your non-US IP addresses. I hope this helps.
__________________
Click on this link NOW to start making money online: http://www.mynetmarketingland.com/FREE-Report/
Reply With Quote
  #16 (permalink)  
Old 03-11-2009, 03:49 AM
NetProwler's Avatar
WebProWorld Member
 
Join Date: Jan 2007
Posts: 88
NetProwler RepRank 2
Default Re: Blocking non-US IPs?

There is a caveat when you use the Apache's directives in a .htaccess file to allow only the US IP address. The directives run to a few thousand lines. Your HTTP server has to process this for every visitor and that can slow down your server. The best place to block unwanted elements is at the firewall.

For dynamic sites, extra load involved in processing long .htaccess files can sometimes result in transient overload.
Reply With Quote
  #17 (permalink)  
Old 03-11-2009, 04:20 AM
Clint1's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: Jun 2005
Location: Louisiana, USA
Posts: 1,278
Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9
Default Re: Blocking non-US IPs?

Quote:
Originally Posted by Superaff View Post
You can try either paid or free proxies. These proxy sites will mask your non-US IP addresses. I hope this helps.
Strange that after all this time, the OP has never shown up again since their first post. I believe what they were asking, as what the others apparently also believe, is regarding blocking bad bots and suspect IP ranges from getting access to their website. What you're talking about is personal computer IP address cloaking.
__________________
God Bless,
-Clint
(Join Date: 2003)
Reply With Quote
  #18 (permalink)  
Old 03-11-2009, 04:25 AM
Clint1's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: Jun 2005
Location: Louisiana, USA
Posts: 1,278
Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9
Default Re: Blocking non-US IPs?

Quote:
Originally Posted by NetProwler View Post
There is a caveat when you use the Apache's directives in a .htaccess file to allow only the US IP address. The directives run to a few thousand lines. Your HTTP server has to process this for every visitor and that can slow down your server. The best place to block unwanted elements is at the firewall.

For dynamic sites, extra load involved in processing long .htaccess files can sometimes result in transient overload.
That will only work if you "have your host's ear" and they'll add IP addresses to the server's firewall at each of your requests. Or, if you have your own personal server.

I'm no expert on Apache nor htaccess, but adding a new entry is only:
deny from x
Where "x" is the IP address, or partial address. Are you saying that creating one of those adds thousands of other lines elsewhere? The block only applies to PC with the tagged IP.
__________________
God Bless,
-Clint
(Join Date: 2003)
Reply With Quote
  #19 (permalink)  
Old 03-12-2009, 06:36 AM
NetProwler's Avatar
WebProWorld Member
 
Join Date: Jan 2007
Posts: 88
NetProwler RepRank 2
Default Re: Blocking non-US IPs?

Quote:
I'm no expert on Apache nor htaccess, but adding a new entry is only:
deny from x
Where "x" is the IP address, or partial address. Are you saying that creating one of those adds thousands of other lines elsewhere? The block only applies to PC with the tagged IP.
In this case we will assume that we block all and then allow only the country IP addresses we are interested in (standard operating procedure in setting up the rules in a firewall or with .htaccess).

For allowing only IP addresses coming from the US, you will have to factor in this:

# Country: UNITED STATES
# ISO Code: US
# Total Networks: 36,549
# Total Subnets: 1,460,108,286

The listing of all these network segments will run into a few thousand lines.
Reply With Quote
  #20 (permalink)  
Old 03-12-2009, 09:01 AM
Clint1's Avatar
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: Jun 2005
Location: Louisiana, USA
Posts: 1,278
Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9
Default Re: Blocking non-US IPs?

Quote:
Originally Posted by NetProwler View Post
In this case we will assume that we block all and then allow only the country IP addresses we are interested in (standard operating procedure in setting up the rules in a firewall or with .htaccess).

For allowing only IP addresses coming from the US, you will have to factor in this:

# Country: UNITED STATES
# ISO Code: US
# Total Networks: 36,549
# Total Subnets: 1,460,108,286

The listing of all these network segments will run into a few thousand lines.
When you say "in this case", do you mean what the OP asked? If so, there's no way of knowing for sure since they have disappeared. But the sentiments of the thread seem to imply they wanted to add blocks on specific regions instead of allowing specific regions. After all, it's must easier (I assume) to add IP block ranges.
__________________
God Bless,
-Clint
(Join Date: 2003)
Reply With Quote
  #21 (permalink)  
Old 03-30-2009, 10:38 PM
faststarter's Avatar
WebProWorld New Member
 
Join Date: Mar 2009
Location: US UK CA EU
Posts: 4
faststarter RepRank -1
Default Re: Blocking non-US IPs?

I believe there are a lot of scripts out there, I know some use the .htaccess thing in their index and directories.

But sometimes it depends on what's supported in your web hosting. And I think I have that feature easily handed.

Visit my free professional web hosting service below.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > IT Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IP Blocking whatever Webmaster Resources Discussion Forum 3 06-04-2008 07:07 PM
Would I be blocking Google? business-directory Google Discussion Forum 7 03-01-2008 09:08 AM
Blocking IP's MrLeN Web Programming Discussion Forum 3 01-25-2006 06:27 AM
Am I somehow blocking spiders? malcolm Search Engine Optimization Forum 1 05-23-2004 06:36 AM
Pop up blocking Greyhawk The Castle Breakroom (General: Any Topic) 7 01-29-2004 09:43 AM


All times are GMT -4. The time now is 04:43 PM.



Search Engine Optimization by vBSEO 3.3.0