主机名到ip是一对一的映射吗?
主机名到ip是一对一的映射吗?一个主机名怎么能有多个IP地址呢? 根据 Java 的 getAllByName,它返回主机名的 ip 列表,但其文档似乎另有说明,或者至少没有解释一对多映射:
The host name can either be a machine name, such as "java.sun.com", or a textual representation of its IP address.
is host name to ip a one-to-one mapping? how can a host name have multiple ip addresses?
according to Java's getAllByName, it returns a list of ips for a hostName, but its documentation seems to suggest otherwise or at least not explaining the one to many mapping:
The host name can either be a machine name, such as "java.sun.com", or a textual representation of its IP address.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
实际上,一台机器的 IP 取决于该机器所使用的网络接口卡 (NIC) 的数量。因此,如果一台机器安装了 3 个 NIC,则该机器将有 1 个主机名,但有 3 个不同的 IP。
Actually the IP's for a machine depends upon the number of Network Interface Cards(NIC) which are being used for that box. So if a machine has 3 NIC's installed, there will be 1 hostname for that box but 3 different IP's.
不,一个主机名可能有多个 A 记录,在这种情况下,解析器将以列表的形式返回所有 IP 地址。您几乎可以在每个大型网站上查看它:
No, a hostname may have several A records and in this case resolvers will return all IP addresses as a list. You can check it on almost every large web site:
不可以,每个主机名可以有多个指向不同 IP 的 DNS A 记录。这通常用于高级负载平衡。您可以在
google.com
上进行检查:No, every host name can have multiple DNS A records pointing to different IPs. This is often used for high-level load balancing. You can check that for example on
google.com
: