We can get our external IP address by following ways :
- Call http request :
curl http://wtfismyip.com/text
orcurl http://ifconfig.me/ip
- Lookup A record for hostname
nslookup myip.opendns.com resolver1.opendns.com
(this only works when you use resolver of OpenDNS)
Bonus : curl https://v6.ident.me/
for IPv6