How to check IPv6 address via command line?

to show the localy listed ipv6 address one can use

ip -6 addr

This will show all locally configured ipv6 address including the link-local address. to show just global reachable addresses you can use

ip -6 addr show scope global 

when you use a service like curl ipinfo.io/ip you are most often trying to work out the nat addresses you are using to reach the internet. Nat is much less common with IPv6 however there are many "whatsmyip" type service for ipv6 e.g.

With DNS:

dig -6 TXT +short o-o.myaddr.l.google.com @ns1.google.com
dig -t aaaa +short myip.opendns.com @resolver1.opendns.com

With HTTPS

curl -6 https://ifconfig.co
curl -6 https://ipv6.icanhazip.com  

with telnet

telnet -6 ipv6.telnetmyip.com 

Even With ssh

  ssh -6 sshmyip.com

I have seen this service over many other protocols as well so google and have fun ;)


Ipify has a ipv6 endpoint: curl https://api64.ipify.org