在 Linux 中执行 ping google.com
时,如何手动重现 Temporary failure in name resolution
错误?
也许,我可以自己添加一个损坏的DNS服务器并在/etc/resolv.conf
中指定它?
我需要这个来测试我的项目。
最佳答案
您可以在 /etc/nsswitch.conf
中尝试:
hosts: files
那是为 hosts
案例删除所有 dns
服务的痕迹(正常行更像是 hosts: files dns
但是在更改之前先看看你的)。
然后,如果名称/IP 在 /etc/hosts
中,则名称解析有效,如果不在,则它不起作用,因为未咨询 DNS。
关于linux - 重现 `Temporary failure in name resolution`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52896671/