How do I check the IPv6 address via command line? For IPv4 I simply use:

curl ipinfo.io/ip

This doesn't work for IPv6.

  • 7
    Does wget -O - v6.ident.me 2>/dev/null && echo work? Mar 17, 2020 at 2:59
  • 3
    You do realise you don't mention an operating system in this question right?
    – Chopper3
    Feb 5, 2021 at 16:02
  • IPinfo.io does support IPv6, but via the v6 domain - eg. curl v6.ipinfo.ip/ip Feb 7, 2022 at 20:53
  • In Feb 2023: Could not resolve host: v6.ipinfo.ip Feb 25, 2023 at 4:44
  • @DanilaVershinin: v6.ipinfo.ip has only a v6 address (necessarily) thus it will only resolve for a program that handles v6 (i.e. getaddrinfo) on a system which supports v6. What program(s) are you using, with what options, on what system(s), with what networking? Mar 19, 2023 at 1:19

7 Answers 7


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


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


ipinfo.io/ip doesn't support IPv6. You may want to try:

curl -6 https://ifconfig.co/ip


  • 1
    It does, but via the v6 subdomain (eg. curl v6.ipinfo.io) Feb 7, 2022 at 20:52

The IP tools will show IPV6 addresses:

ip addr | grep inet6
  • Thank, Which one to pick scope global or scope link?
    – Houman
    Dec 5, 2020 at 22:58
  • 2
    Scope global is the rough equivalent of a public IP address in IPv4, while scope link is the rough equivalent of a private or APIPA address in IPv4.
    – Davidw
    Dec 6, 2020 at 17:47

ip.sb support both IPv4 and IPv6. To get IPv6 adress,use:

curl -6 ip.sb

And, curl -4 ip.sb for IPv4 adress.

  • I like that URL, very short!
    – guettli
    Apr 9 at 12:00

If you want to find the public IPv6 address you can do this with the dig command and then pipe the result into the sed command to remove the closing quotes.

dig -6 TXT +short o-o.myaddr.l.google.com @ns1.google.com | sed 's|"||g'

Another alternative is using the curl command and pulling the IP address from a URL such as OpenDNS'.

root@ubuntu:~# curl -s -6 "https://myipv6.p1.opendns.com/get_my_ip"
  "ip": "2a00:2345:dead:beef:1234:4567:89ab:cdef"

To print only the value (the IP address) you can specify the -r parameter.

root@ubuntu:~# curl -s -6 "https://myipv6.p1.opendns.com/get_my_ip" | jq -r '.ip'
  • Are you sure this lookup works?
    – Daniel K
    Feb 9, 2022 at 16:02
  • 1
    @DanielK yes I've just tested it on a Fedora server. Feb 10, 2022 at 19:34

This works for "lo" AND "eth0-X", IPv4 and IPv6, respectively:

ip -4 addr
ip -6 addr


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .