【问题标题】:Reproduce `Temporary failure in name resolution`重现`名称解析中的临时失败`
【发布时间】:2019-03-24 14:23:50
【问题描述】:

在 linux 中执行 ping google.com 时,如何手动重现 Temporary failure in name resolution 错误?

或许,我可以自己添加一个损坏的 DNS 服务器并在 /etc/resolv.conf 中指定它?

我需要这个来测试我的项目。

【问题讨论】:

    标签: linux dns dnsmasq networkmanager


    【解决方案1】:

    你可以在/etc/nsswitch.conf试试这个:

    hosts:          files
    

    即删除hosts 情况下dns 服务的所有痕迹(普通行更像hosts: files dns,但在更改之前先看看你的)。

    然后,如果名称/IP 在/etc/hosts 中,则名称解析有效,如果不是,则由于未咨询 DNS,因此无效。

    【讨论】:

      猜你喜欢
      • 2018-09-18
      • 2020-08-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-08
      • 2012-04-18
      • 1970-01-01
      • 2015-08-21
      相关资源
      最近更新 更多