wget
# icanhazip.com
wget -qO - http://icanhazip.com
# dyndns.org
wget http://checkip.dyndns.org/ -q -O - |
grep -Eo '\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>'
curl
# whatismyip.com
curl https://whatsmyip.com/ -s |
grep -oE "\b([0-9]{1,3}.){3}[0-9]{1,3}\b" -m1
# google.com
curl https://www.google.com/search?q=what+is+my+ip+address -s |
grep -oE "\b([0-9]{1,3}.){3}[0-9]{1,3}\b" -m1
# ipecho.net
curl -s http://ipecho.net/plain
# akamai.com
curl -s http://whatismyip.akamai.com
# ipecho.net
wget -qO- http://ipecho.net/plain
# ipinfo.io
curl https://ipinfo.io/ip
dig
# google.com
dig @ns1.google.com TXT o-o.myaddr.l.google.com +short
# opendns.com
dig +short myip.opendns.com @resolver1.opendns.com
host
# opendns.com
host myip.opendns.com resolver1.opendns.com |
grep -m2 -oE "\b([0-9]{1,3}.){3}[0-9]{1,3}\b" | tail -n1
nslookup
# google.com
nslookup -query=TXT o-o.myaddr.l.google.com ns1.google.com |
grep -m2 -oE "\b([0-9]{1,3}.){3}[0-9]{1,3}\b" | tail -n1
# opendns.com
nslookup myip.opendns.com resolver1.opendns.com |
grep -m2 -oE "\b([0-9]{1,3}.){3}[0-9]{1,3}\b" | tail -n1
Recommended content
Refs