What *nix based command can I use to find my external IP?
curl http://myip.dnsomatic.com
dig +short myip.opendns.com
This only works if you are using OpenDNS as your dns server.
If you aren't, one of these should work:
dig +short myip.opendns.com @208.67.222.222 dig +short myip.opendns.com @208.67.220.220 dig +short myip.opendns.com @208.67.222.222 @208.67.220.220
STUN is the proper solution.
% stun -v stun.ekiga.net ... MappedAddress = 88.189.152.187:18009
- a list of public STUN servers
- a free software STUN client
- The STUN standard
You can use curl to get the page from something like whatismyip and then get the pieces out. I used whatismyipaddress.com in this example...obviously the fields will differ with different services.
curl -s http://whatismyipaddress.com/ | grep LOOKUPADDRESS | awk '{ print $4 }'