Re: External IP address
- From: "slebetman@xxxxxxxxx" <slebetman@xxxxxxxxx>
- Date: 15 Dec 2006 02:44:38 -0800
slebetman@xxxxxxxxx wrote:
Uwe Klein wrote:
slebetman@xxxxxxxxx wrote:
chawki.jreige@xxxxxxxxx wrote:
How would I obtain the external IP address?
package require http
set f [http::geturl http://checkip.dyndns.com]
set raw [http::data $f]
http::cleanup $f
regexp -- {(\d+\.\d+\.\d+\.\d+)} $raw --> ip_address
puts $ip_address
my workplace, your script: 84.144.214.55
Which is exactly what the OP wanted.
Read carefully: the OP specified the "external" IP address which I
interpreted as the public IP, one attached to the NAT gateway.
It should be noted however that even this may not get you the
"external" ip in question (the one belonging to the NAT gateway, if
any) but will instead get you an ip given by your HTTP proxy --
definitely not what you wanted since it is useless (the ip of the NAT
gateway is at least useful when used with port forwarding).
My ISP decided to install a transparent proxy one day without telling
anyone about it. The unfortunate part is that the proxy apparently has
a bug (or is over-eager) and ignores the HTTP header returned by
checkip.dyndns.com telling it not to cache the packet. So when I
queried the page it returned a cached version which contains an ip
address that belongs to someone else who accessed the page earlier
(probably my neighbor). Fortunately checkip.dyndns.com supports
querying via an alternate port which should solve the problem. I just
can't remember what port it is.
.
- References:
- External IP address
- From: chawki . jreige
- Re: External IP address
- From: slebetman@xxxxxxxxx
- Re: External IP address
- From: Uwe Klein
- Re: External IP address
- From: slebetman@xxxxxxxxx
- External IP address
- Prev by Date: Re: External IP address
- Next by Date: Re: counting substrings in a string
- Previous by thread: Re: External IP address
- Next by thread: Re: External IP address
- Index(es):
Relevant Pages
|