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

nslookup finds IP address, but still claims NXDOMAIN

· 52CE 我爱测

In my network I have: mikrotik router ( 10.0.0.1 ) with static DNS entries for myhost.mydomain.com -> 10.0.0.4 adguard server ( 10.0.0.128 ) that uses 10.0.0.1 as upstream DNS DHCP gives 10.0.0.128 as primary DNS. I have really w…

问题原文

原帖链接 · Mirek · CC BY-SA 4.0

In my network I have:

  • mikrotik router (10.0.0.1) with static DNS entries for myhost.mydomain.com -> 10.0.0.4
  • adguard server (10.0.0.128) that uses 10.0.0.1 as upstream DNS
  • DHCP gives 10.0.0.128 as primary DNS.

I have really weird situation with DNS resolution on ubuntu machines:

[21:22:18][root@ubuntu]:~# nslookup myhost.mydomain.com
Server:     127.0.0.53
Address:    127.0.0.53#53

Non-authoritative answer:
Name:   myhost.mydomain.com
Address: 10.0.0.4
** server can't find myhost.mydomain.com: NXDOMAIN

So - the name resolved into 10.0.0.4, but somehow it still says NXDOMAIN - what's up with that?

What's even weirder, when I logged in to my domain registrar and added a CNAME entry for *.mydomain.com that points to mydomain.com (which resolves to IP of my hosting provider) - here's what I see:

[21:58:04][root@ubuntu]:~# nslookup myhost.mydomain.com
Server:     127.0.0.53
Address:    127.0.0.53#53

Non-authoritative answer:
Name:   myhost.mydomain.com
Address: 10.0.0.4
myhost.mydomain.com    canonical name = mydomain.com.

However, from my daily driver (macOS) I'm not getting this issue:

[20:46:57][shalak@shalak-mac]:~$ nslookup myhost.mydomain.com
Server:     10.0.0.128
Address:    10.0.0.128#53

Non-authoritative answer:
Name:   myhost.mydomain.com
Address: 10.0.0.4

What's going on here?

已采纳解答

原帖链接 · u1686_grawity · CC BY-SA 4.0

So - the name resolved into 10.0.0.4, but somehow it still says NXDOMAIN - what's up with that?

nslookup makes two queries: one for A records and another for AAAA records (IPv6 addresses). Normally, both queries should either succeed or fail equally (regardless of what kind of addresses the domain has – no IPv6 addresses just means an empty successful answer).

But some resolvers (and in particular, some ad blockers) misunderstand the DNS protocol and reply with NXDOMAIN whenever the requested record type doesn't exist, even though the name exists in general. (In fact, I think I remember Adguard doing so deliberately, in order to "block IPv6 leaks" or something.)

Use nslookup -q=A and nslookup -q=AAAA to compare the results.

Use a packet capture tool to verify whether Adguard is receiving the NXDOMAIN from upstream (i.e. from Mikrotik) or whether it's inventing the response on its own decision. (If it's the Mikrotik, make sure you're running the latest firmware.)

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

资料来源与适用范围

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

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

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