大网数据广告活动
服务器运维问答

Debug DNS: What to do if host name resolution does not work as expected?

· 52CE 我爱测

The current search results for "debug dns" don't reveal a guide-line what to do, if you (as user/client) think there is something wrong with the host name resolution. What steps can I do to narrow down the problem? My particular …

问题原文

原帖链接 · guettli · CC BY-SA 3.0

The current search results for "debug dns" don't reveal a guide-line what to do, if you (as user/client) think there is something wrong with the host name resolution.

What steps can I do to narrow down the problem?

My particular case:

The tool host can resolve the name:

root@mypc# host remotehost.internal-domain.local
remotehost.internal-domain.local has address 10.99.204.11

But the tool nslookup can't:

root@mypc# nslookup host remotehost.internal-domain.local
nslookup: couldn't get address for 'remotehost.internal-domain.local': not found

I am confused.

Solution

In my case I changed this line in /etc/nsswitch.conf:

hosts:          files mdns4_minimal [NOTFOUND=return] dns

to this

hosts:          files dns

Now the .local Domain gets resolved by DNS, not by avahi peer-to-peer stuff.

已采纳解答

原帖链接 · HBruijn · CC BY-SA 3.0

What steps can I do to narrow down the problem?

In general: Many commands come with switches that increase the verbosity and/or the debug level allowing you to troubleshoot more easily. Check the manual page for the exact options, i.e. man host and man nslookup

In the case of DNS issues:

  • a fairly typical problem is the presence of static entries in /etc/hosts
  • your system may use alternative hosts database configured in /etc/nsswitch.conf and when you use tools that only test actual DNS name servers you get different results compared to what your system resolves.
  • your /etc/resolv.conf may contain multiple nameservers and one or more of those responds differently from the other(s), check by querying each specific name server directly

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-03-15)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。