Weblogs for mnaumann

Posted by mnaumann on Fri 16 Mar 2007 at 11:55
Tags: none.

Here's what I consider a handy snippet to quickly determine your current external/public IP address. This can be useful in a NAT environment where you have no access to the firewall and networking configuration (such as in a virtual server which has no public IP address assigned to it).

GET checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'

If you don't have sed, try awk, or any scripting language which supports regular expressions (the pattern formatting may differ with other implementations).

GET requires perl to be installed. If you don't have perl, try one of these:

curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
links -dump checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
lynx -dump checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'|grep -v '^$'

This snippet is dependant of the availability and current output formatting of http://checkip.dyndns.org/. Luckily, this URL is also used by many dyndns clients/updaters, so it's likely to remain the same for quite a while.

You know an easier way? Let me know!

 

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search