Related to Why does Cloudflare's name servers return NOERROR rather than NXDOMAIN?
Cloudflare return NOERROR instead of NXDOMAIN for invalid domain. This breaks nslookup
if you have ‘search’ set in the /etc/resolv.conf and the search domain is managed by Cloudflare. It’s easy to demonstrate in both debian:10.4 and alpine:3.11.6(with bind-tools installed) docker images.
# cat /etc/resolv.conf
nameserver 1.1.1.1
search cloudflare.com
options ndots:5
# nslookup google.com
Server: 1.1.1.1
Address: 1.1.1.1#53
Non-authoritative answer:
*** Can't find google.com.cloudflare.com: No answer
If the search domain is not managed by Cloudflare, for example google.com, nslookup
can get the IP correctly.
# cat /etc/resolv.conf
nameserver 1.1.1.1
search google.com
options ndots:5
# nslookup google.com
Server: 1.1.1.1
Address: 1.1.1.1#53
Non-authoritative answer:
Name: google.com
Address: 74.125.200.138
Name: google.com
Address: 74.125.200.100
Name: google.com
Address: 74.125.200.101
Name: google.com
Address: 74.125.200.102
Name: google.com
Address: 74.125.200.139
Name: google.com
Address: 74.125.200.113
Name: google.com
Address: 2404:6800:4003:c02::71
It also breaks some language runtime like node:14-alpine.
/ # cat /etc/resolv.conf
nameserver 1.1.1.1
search cloudflare.com
options ndots:5
/ # node
Welcome to Node.js v14.2.0.
Type ".help" for more information.
> dns.lookup('google.com', {}, (err, addresses) => console.log('addresses: %j', addresses));
GetAddrInfoReqWrap {
callback: [Function (anonymous)],
family: 0,
hostname: 'google.com',
oncomplete: [Function: onlookup]
}
> addresses: undefined
The ndots:5
option is the default settings in Kubernetes cluster. So why Cloudflare return NOERROR instead of NXDOMAIN?