[Linux-disciples] Finding an external IP

Stephen R Laniel steve at laniels.org
Tue Nov 22 17:04:50 EST 2005


I want to figure out what IP address the external world sees
for a given hostname. I could ssh to a remote host and run
ping -- something like

ssh remote_host ping -c 1 hostname

where 'hostname' is the one for which I want the IP. Then I
could parse the output in various ways.

The trouble is that a lot of the hostnames I'm interested in
will give fallbacks. So for instance, I want to know what IP
address the external world thinks that
adam.americanprogress.org has. If I just ping it, I'll get
back 216.234.246.150, when what I really want to know is
that adam.americanprogress.org is not externally visible.

As far as I can tell, the best way to discover that bit of
information is to run dig from an external machine, look for
the ANSWER section, and munge the results appropriately.
Which is what this script does:

http://laniels.org/scripts/remote_dns_query.pl.txt

If anyone can think of a better way to do what I want, lemme
know.

-- 
Stephen R. Laniel
steve at laniels.org
+(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20051122/aa9a7c7e/attachment.pgp


More information about the Linux-disciples mailing list