Best way to get your public IP address is to use ifconfig.me which only returns the IP; simple and efficient.
$ curl http://ifconfig.me
The only problem is the responsiveness (few seconds).Another cool way is to query the opendns servers :
This method is pretty fast but requires the dig command (part of the bind-utils package).$ dig
+short
myip.opendns.com @resolver1.opendns.com
That indeed works but it is not very handy if you're querying it from command line :-)
ReplyDelete