I have already described how to check external IP address using curl or your own SSH service, but you can also use dig utility to take advantage of the OpenDNS, Google or Akamai DNS service.

Check IP address using OpenDNS DNS service.

$ dig myip.opendns.com @resolver1.opendns.com +short
49.87.177.153

Check IP address using Google DNS service.

$ dig txt o-o.myaddr.test.l.google.com @ns1.google.com +short
49.87.177.153

Check IP address using Akamai DNS service.

$ dig whoami.akamai.net @ns1-1.akamaitech.net +short
49.87.177.153