It seems my default (router) DNS server returns different results depending on the tool used to query it.
$ dig @192.168.1.2 test.example.com ; <<>> DiG 9.16.8-Debian <<>> @192.168.1.2 test.example.com ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 58608 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 512 ;; QUESTION SECTION: ;test.example.com. IN A ;; ANSWER SECTION: test.example.com. 41 IN CNAME 126.96.36.199. ;; AUTHORITY SECTION: . 3357 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2020112400 1800 900 604800 86400 ;; Query time: 0 msec ;; SERVER: 192.168.1.2#53(192.168.1.2) ;; WHEN: Tue Nov 24 10:12:40 CET 2020 ;; MSG SIZE rcvd: 148
As you can see, it successfully finds the IP address of
test.example.com, which is
188.8.131.52. However, the following two tools do not.
$ host test.example.com 192.168.1.2 Using domain server: Name: 192.168.1.2 Address: 192.168.1.2#53 Aliases: Host test.example.com not found: 3(NXDOMAIN)
$ nslookup test.example.com 192.168.1.2 Server: 192.168.1.2 Address: 192.168.1.2#53 ** server can't find test.example.com: NXDOMAIN
What is going on here? Why is there a difference between the results of
nslookup? Don't they all perform the same DNS queries under the hood?
Edit: as the accepted answer points out, I incorrectly used a
CNAME instead of an
A record. I have since updated the DNS entry and now the domain name resolves correctly.
Edit2: domain and IPs are fake