Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 28th, 2005, 11:37 AM
Registered User
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to detect router ip

Hi all,
Can anyone tell me how to detect a ip address behind a router?
I know that using ASP, we can detect the actual ip and the proxy ip, but what if the visitor is using a router that dynamically assigns a ip.
Please advise
Many Thanks

Old January 28th, 2005, 11:41 AM
Friend of Wrox
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco

run ipconfig?

Old January 28th, 2005, 11:54 AM
Registered User
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Haha,thats a cute answer.
Im trying to detect the ip addressed of visitors coming to my site.
They are from all over the world.
I am able to do that if they use either a proxy server or if no proxy server is used.
However once a router is used, the ip address returned to me will not be the actual ip address of that visitor as the ip address returned to me is randomly assigned by the router of that visitor.

For example
A visitor from France not using a router will give me a ip address that indicates the country France.
However, if this same visitor from France is using a router not randomly assigns ip addresses, the ip address returned to me will not not indicate France, and may now give me a ip address that indicates that say the United States.
This way my program will have failed miserablely...
Is there anyway i can request for the actaul ip instead of that ip that the router sends to me in attempt to hide the actual ip address of the visitor.
Any Advise is greatly appreciated..
Many Thanks..

Old July 5th, 2007, 05:54 PM
Registered User
Join Date: Apr 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to elmemo

pikachew, IP-NAT works in such a way that if a visitor from France is going through a router then you will see that router's IP as his. This is true whether the visitor is connecting to the router via a dynamic or static IP. The said router will be leasing an IP from some ISP, so doing a whois to that IP will reveal whatever location the ISP fed into their ICANN registration. (there's other ways to know location of a router but they depend on the owner having actually fed the info into the device and made it available to the world - e.g. having the router be a DNS and feeding LOC records).

However, there are numerous ways to appear to come from a country (or IP) that is not the "real" one, including using a proxy and forging IP packets, or going through routers with bogus location information.

In short this means that your program doesn't need any modification, you just have to trust the country of origin his ISP tells you the connection has. I don't think you can do any better, but definately having a connection to your router via DHCP or manually assigned doesn't make a difference.

Hope that helps, cheers!

Old July 5th, 2007, 08:29 PM
Friend of Wrox
Join Date: May 2003
Posts: 202
Thanks: 0
Thanked 1 Time in 1 Post

The short answer is, you can't. And the second answer is, it wouldn't be of any use to you.

That's because the user's computer will be on a LAN behind the router with private addresses that are not routeable over the internet (192.168.x.x, 10.x.x.x, etc.). So even if you knew their actual private address, you couldn't connect to it anyway. The router acts as an agent and masquerades their connection using the router's external public IP address. To make matters worse, you'll have many users with the same private address. Almost every cable/dsl router assigns private addresses in the 192.168.0.x (or 192.168.1.x) range by default, and most corporate networks utilize 10.x.x.x addresses.

It's the router's job to prevent you from finding out the private addresses to shield and protect the user's computer.

Bruce Luckcuck
Director, Applications & Support Services
Wiley Publishing, Inc.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Login To ADSL Router ibmsuh VB.NET 0 November 7th, 2006 06:12 AM
Detect associated label ysiline Access VBA 1 April 26th, 2006 07:16 AM
Dynamic IP of Router jack_3 C# 0 November 15th, 2005 10:02 PM
IP mani_he Beginning PHP 4 November 8th, 2004 09:53 PM
Winsock Problem when server run behind the router mihir9274 VB Components 0 November 29th, 2003 05:19 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.