How to tell IP address of remote machine?

Tim ignored_mailbox at yahoo.com.au
Tue Oct 27 03:35:35 UTC 2009


On Mon, 2009-10-26 at 16:36 +0000, Timothy Murphy wrote:
> "firefox http://whatismyipaddress.com/"
> (where I had to wait for a minute or so to get the response).

Perhaps it's overloaded?  I just tried it, and it took ages responding.
The other site, responded near instantly.

Do you have your own webspace, somewhere external from your LAN?  Does
it run Apache, or some other webserver where you can run commands, and
have the instructions for doing so?  You could run your own script to do
the same thing (tell you your IP address).  (See the end of this message
for examples.)

As to why there's different answers, there's any number of reasons.
Proxies and NAT devices between you and them, being the first things
that springs to mind.  But, in general, there's two addresses (fairly)
easily discovered from the remote end - the address of the computer that
you're browser runs on (may be a LAN address), and your external IP
address.

Things can get confusing if the thing querying names resolves IP
addresses.  It may find the IP, resolve the name, then find the IP for
the name.  There may be more than one IP associated...

An example script for Apache,
a one-line page saved as address.shtml:
<!--#echo var="REMOTE_ADDR" -->

When requested via any HTTP agent (browser, wget, etc):
wget http://example.com/address.shtml

Returns just the remote IP address, on a single line, and nothing else,
as the page.

NB:  You must be allows to run SSI (server side includes) on your
webserver.  You must write your page in a manner that the server expects
(typically, using the .shtml suffix).

The Apache manual doesn't list all of the variables that can be
returned, it only lists the extra ones it adds to the CGI environment
variables from ye olde NCSA web server.  The NCSA ones can be seen here:
http://hoohoo.ncsa.illinois.edu/cgi/env.html

-- 
[tim at localhost ~]$ uname -r
2.6.27.25-78.2.56.fc9.i686

Don't send private replies to my address, the mailbox is ignored.  I
read messages from the public lists.






More information about the fedora-list mailing list