问题原文
原帖链接 · Mirek · CC BY-SA 4.0
In my network I have:
- mikrotik router (
10.0.0.1) with static DNS entries formyhost.mydomain.com->10.0.0.4 - adguard server (
10.0.0.128) that uses10.0.0.1as upstream DNS - DHCP gives
10.0.0.128as 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.)
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
