【发布时间】:2019-03-24 14:23:50
【问题描述】:
在 linux 中执行 ping google.com 时,如何手动重现 Temporary failure in name resolution 错误?
或许,我可以自己添加一个损坏的 DNS 服务器并在 /etc/resolv.conf 中指定它?
我需要这个来测试我的项目。
【问题讨论】:
标签: linux dns dnsmasq networkmanager
在 linux 中执行 ping google.com 时,如何手动重现 Temporary failure in name resolution 错误?
或许,我可以自己添加一个损坏的 DNS 服务器并在 /etc/resolv.conf 中指定它?
我需要这个来测试我的项目。
【问题讨论】:
标签: linux dns dnsmasq networkmanager
你可以在/etc/nsswitch.conf试试这个:
hosts: files
即删除hosts 情况下dns 服务的所有痕迹(普通行更像hosts: files dns,但在更改之前先看看你的)。
然后,如果名称/IP 在/etc/hosts 中,则名称解析有效,如果不是,则由于未咨询 DNS,因此无效。
【讨论】: