Get public IP using DNS

show public IP

Google:

dig o-o.myaddr.l.google.com txt @ns1.google.com +short
nslookup -type=txt o-o.myaddr.l.google.com ns1.google.com
"10.11.12.13"

OpenDNS:

dig myip.opendns.com @resolver1.opendns.com +short
nslookup myip.opendns.com resolver1.opendns.com
10.11.12.13

Akamai:

dig whoami.akamai.net. @ns1-1.akamaitech.net. +short
nslookup whoami.akamai.net. ns1-1.akamaitech.net.
10.11.12.13

other usage

dig o-o.myaddr.l.google.com txt
nslookup -type=txt o-o.myaddr.l.google.com

returns txt record of DNS request to authoritative source address
edns0-client-subnet if available, showing original DNS request source address

dig o-o.myaddr.l.google.com txt @8.8.8.8 +short
nslookup -type=txt o-o.myaddr.l.google.com 8.8.8.8
"198.51.100.1"
"edns0-client-subnet 203.0.113.0/24"