[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to determine WAN IP address from behind a NAT router?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

A.Melon said:

> I searched for information on this and found only solutions by
> parsing the output of websites that display the HTTP REMOTE_ADDR.
> But I don't want to rely on an external website.
> 
> I know there must be a way to do this because Gnutella-type
> programs (client) display my "outside" IP address.  How do they
> do it?

they rely on an external site. :)

1) use dyndns.org client on your linux box and then never have
   to worry what your ip is.

2) You could use www.whatismyip.com and grep and sed for the ip.
   I guess that site is pretty reliable..

not very elegant, but this should work.

wget www.whatismyip.com -o /dev/null && \
 grep 'displaycopy' index.html | \
 sed "s/displaycopy('\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*/\1/"



- --

/phil


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCeq2ZGbd/rBLcaFwRAvSNAKCFs/qoCqcHcZ4s1tKUOdRkwvW4zgCffGP9
uyABQYdMC7TqwR3eFts5Xtg=
=gzn/
-----END PGP SIGNATURE-----



Reply to: