IPv6 address by hostname

86,388

Solution 1

With nslookup, just query for the AAAA record type used for IPv6 addresses:

nslookup -query=AAAA $hostname

Solution 2

You can also use dig or host:

host -t AAAA www.google.com

dig www.google.com AAAA
Share:
86,388
user44273
Author by

user44273

Programming level: Average Joe

Updated on May 04, 2020

Comments

  • user44273
    user44273 about 4 years

    Is there any command in Linux to get the IPv6 address of a hostname?

    I tried NSLookup, but it doesn't seem to have an option to get the IPv6 address for the specified hostname or perhaps I missed it.

    I have a C program that deals with IPv6 and I want to check if I am getting correct results by using a different method to obtain the IPv6 address of a host.

  • user44273
    user44273 about 11 years
    oops, my bad, thanks anyway
  • Smit Johnth
    Smit Johnth over 7 years
    Works at least on Windows XP too.