【问题标题】:Linux hostname resolution on a machine with multiple running interfaces具有多个运行接口的机器上的 Linux 主机名解析
【发布时间】:2011-02-15 10:17:46
【问题描述】:

我的 Linux 机器上有 4 个正在运行的 eth 端口(eth0 到 eth3)。那么如果我给出命令host <hostname>,会返回哪个eth 端口的ipaddress? linux如何决定返回哪个eth端口的ip地址?

谢谢, LinuxPenseur

【问题讨论】:

  • 请引导我查看文档以支持答案。谢谢

标签: linux interface ethernet hostname


【解决方案1】:

host 不会查看您的本地 IP,它会根据 /etc/nsswitch.conf 中指定的规则查找主机名

在 nsswitch.conf 中你通常会有这个条目:

hosts: files dns

这意味着解析器将首先检查 /etc/hosts,如果在其中找不到任何内容,它将检查 /etc/resolv.conf 并向指定的 DNS 服务器询问 IP,可选择附加“搜索”和“ resolv.conf 中指定的域”后缀

http://www.faqs.org/docs/linux_network/x-087-2-resolv.library.html

【讨论】:

    【解决方案2】:

    您的“主要”界面是什么?那个是用的。

    http://ubuntuforums.org/archive/index.php/t-1120370.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-10-06
      • 1970-01-01
      • 2013-12-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多