Linux 主机名的 IPv6 地址
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16467765/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
IPv6 address by hostname
提问by user44273
Is there any command in Linux to get the IPv6 address of a hostname?
Linux 中是否有任何命令可以获取主机名的 IPv6 地址?
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.
我试过了NSLookup
,但它似乎没有获取指定主机名的 IPv6 地址的选项,或者我可能错过了它。
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.
我有一个处理 IPv6 的 C 程序,我想通过使用不同的方法获取主机的 IPv6 地址来检查我是否得到了正确的结果。
采纳答案by earl
With nslookup
, just query for the AAAA
record type used for IPv6 addresses:
使用nslookup
,只需查询AAAA
用于 IPv6 地址的记录类型:
nslookup -query=AAAA $hostname