Thursday, April 16, 2009

Get The External IP of Any Machine You're On

If you ever need to figure out the extenal IP of your machine (/sbin/ifconfig only returns your internal IP) you can use the follwing command:

wget -O- "http://checkip.dyndns.org"

From your desktop you can simply his the webpage listed in the weget, but if you're logged into a machine on ref, you'll need to wget it. You should get something like the following in response:

--14:23:32--  http://checkip.dyndns.org/
=> `-'
Resolving checkip.dyndns.org... done.
Connecting to checkip.dyndns.org[GXMMS:63.208.196.105]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [GXMMS:text/html]

[GXMMS:<=> ] 0
--.--K/s
\\\Current IP Check\\
\Current IP Address: 63.215.196.180\
\

[GXMMS: <=> ] 106
103.52K/s

14:23:32 (103.52 KB/s) - `-' saved [GXMMS:106]

This is the bit you're interested in:

Current IP Address: 63.215.196.180

No comments:

Post a Comment