IP2
===

IP2 is a small program that you can use to determine your IP addresses - both WAN and LAN. What this means is that along with showing you the traditional IP address that your computer is using in it's local environment (e.g. a LAN) it will also show you what your IP address is from the perspective of an "outsider" on the Internet. This is in contrast to the many tools and utilities available on the Internet that simply return the LAN address, which is useless if somebody on the Internet needs to connect to your computer.

Your WAN and LAN IP addresses may be the same if you are directly accessing the Internet with something like a dialup modem or a cable modem without a hardware NAT router. However, if you are using some kind of hardware router or firewall as your gateway to the Internet, your computer will most likely have been assigned a "non-routable" IP address such as 10.1.2.3 or 192.168.1.2 for example. In this situation there is no easy way to find out what your true Internet IP address is. This is where IP2 comes into play.

To enable IP2 to automatically find your IP addresses when you start the program you can select the checkbox labeled "Autorun" and the next time you start the program will connect to the Internet without you having to click the "Find my IP addresses" button. To disable this simply uncheck the box.


How It Works
============

IP2 uses one of several methods to determine your true Internet IP address. A built-in list of several servers enables the program to send a request and receive a reply from a remote server containing your Internet accessible IP address. The servers and methods used are as follows:

Queries one of the "MyWANIP" (http://www.mywanip.com) servers (hope they don't mind!) and deciphers the response containing your IP.

Queries the Geektools Whois server (whois.geektools.com) and parses the output for the string containing your IP address.

Queries one of the following web sites. All of these are running a script that will report back web CGI variables, including the REMOTE_ADDR environment variable that contains the caller's IP address. This list was gathered using a quick search on the web and is in no particular order.


http://ecerami.com/servlet/coreservlets.ShowCGIVariables
http://www.sanford.com/introcgi/cgi-bin/environment-example.pl?something
http://www.mueloliva.es/cgi-bin/variables.cgi?'0024'
http://inetarena.com/cgi-bin/environment.pl?this=that
http://curry.edschool.virginia.edu/go/www_uses/demos/cgi-test.html
http://www.cfhub.com/examples/cgi/

When IP2 runs it chooses one of the above methods at random and runs through the list until a successful response is found.

One caveat to IP2 is if you are accessing the Internet through a HTTP application proxy firewall, in which case IP2 won't be able to directly access the Internet and will fail to determine your IP. Since IP2 was written mainly to help people who wish to run servers on their PCs I did not add the ability to specify a HTTP proxy for the program to communicate through since you would probably not be able to run an Internet accessible server if your only method of accessing the Internet was by this method.

------------------------------------------------------------------------------------
Written by Robin Keir
http://keir.net
March 2001
