Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IPv6 address by hostname [closed]

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.

like image 273
user44273 Avatar asked May 09 '13 17:05

user44273


People also ask

What are the 4 types of IPv6 addresses?

IPv6 unicast address assignment consists of the following forms: Aggregate global unicast address. Neutral-interconnect unicast address. NSAP address.

How do I know if a IPv6 address is valid?

An IPv6 normal address must have eight segments; however, a short form notation can be used in the TS4500 management GUI for segments that are zero, or those that have leading zeros. The following are examples of valid IPv6 (normal) addresses: 2001:db8:3333:4444:5555:6666:7777:8888.

Are IPv6 addresses always public?

Both public and private addresses exist in IPv6, but they are totally different in definition and application.

How do I get IPv6 with nslookup?

You can use the nslookup command to display IPv6 name service information. Under your user account, run the nslookup command. The default server name and address appear, followed by the nslookup command's angle bracket prompt. Quit the nslookup command by typing exit .


2 Answers

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

nslookup -query=AAAA $hostname 
like image 114
earl Avatar answered Sep 24 '22 02:09

earl


You can also use dig or host:

host -t AAAA www.google.com  dig www.google.com AAAA 
like image 32
escitalopram Avatar answered Sep 23 '22 02:09

escitalopram