Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nslookup reported "can't resolve '(null)': Name does not resolve" though it successfully resolved the DNS names

I am on ubuntu, and I am running a docker default bridge network. I have containerized versions of zookeeper, kafka, and an app that I wrote that talks to kafka.

I do a:

docker exec -it <my-app id> /bin/bash

Then inside my app's container I run nslookup kafka

/go # nslookup schmafka
nslookup: can't resolve '(null)': Name does not resolve

Name:      schmafka
Address 1: 172.20.0.8 docker_kafka_1.docker_default

I do not understand why I get the output "can't resolve '(null)'" and then I get the expected ip address printed out later. I tried to google nslookup and this output message but I cannot figure why this happens.

My /etc/resolv.conf file looks like this:

/go # cat /etc/resolv.conf 
search valhalla.local valhalla v
nameserver 127.0.0.11
options ndots:0
like image 873
smuggledPancakes Avatar asked Sep 27 '17 20:09

smuggledPancakes


1 Answers

This is a bug/oddity in nslookup. The "can't resolve" message is actually about the DNS server in use, not the site you are trying to look up.

For example this query (which tells nslookup to lookup google.com using the 8.8.8.8 DNS server) has no error message:

nslookup google.com 8.8.8.8
Server:    8.8.8.8
Address 1: 8.8.8.8 dns.google

Name:      google.com
Address 1: 172.217.164.110 sfo03s18-in-f14.1e100.net
Address 2: 2607:f8b0:4005:80b::200e sfo03s18-in-x0e.1e100.net

But this query (in which the DNS server is "null") does show the "error":

UAP-AC-LR1-BZ.v4.0.42# nslookup google.com
nslookup: can't resolve '(null)': Name does not resolve

Name:      google.com
Address 1: 172.217.164.110 sfo03s18-in-f14.1e100.net
Address 2: 2607:f8b0:4005:80b::200e sfo03s18-in-x0e.1e100.net

Admittedly this is misleading/confusing, and really should be fixed in nslookup.

like image 55
Sam Avatar answered Oct 18 '22 10:10

Sam