0

I have a LAN DNS set up so that I can access LAN hosts by an unqualified name. For the examples below, the domain is 'michigan' and the host is 'acer'.

Notice that I can ping acer but dig acer gets no answer. Only if I give dig the qualified name does dig get an answer.

stephen@home:~$ ping -c1 acer 
64 bytes from 192.168.0.110 (192.168.0.110): icmp_seq=1 ttl=64 time=1.13 ms

stephen@home:~$ dig acer | grep ANSWER:
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

stephen@home:~$ dig acer.michigan | grep ANSWER:
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 3

Is there an error in my configuration or is this expected behavior for dig?

  • Chances are you don't have a search michigan set in your /etc/resolv.conf file. – Terrance Apr 11 '18 at 3:26
  • It's in there twice. I set it once myself through resolvconf's head file then it is is inserted again by some part of the system. Both base and tail files are empty. This mystery process also inserts a second 127.0.0.53 nameserver even after I delete the /etc/resolvconf/resolv.conf file and restart resolvconf. I would like to know what is doing that. – Stephen Boston Apr 11 '18 at 6:21
  • Ah, yes, I believe that you are using Ubuntu 17.10 which has a completely different network setup on it then the previous versions have had. I believe that the search and nameservers are not used in the resolv.conf file. See: askubuntu.com/questions/967695/… – Terrance Apr 11 '18 at 13:29
  • This is in 18.04. I've been using netplan since 17.10 was in beta so my configuration is ok there. I do not use Network Manager and I found that most applications will use the resolv.conf DNS before the netplan DNS. This was a stumble discovery and I haven't explored it thoroughly but had trouble getting my LAN DNS working without a well-defined resolv.conf. Network Manager has its own way of doing things that may produce different results. – Stephen Boston Apr 11 '18 at 22:12
  • Ah yes of course. There could be a bug. I'll update here if there is a change. Thanks. – Stephen Boston Apr 11 '18 at 23:04
1

You figured out the solution yourself:

Only if I give dig the qualified name does dig get an answer.

dig doesn't automatically append your connection's DNS suffix(es) to its queries, unlike other tools. This is expected.

0

Something sounds messed up with your configuration. There shouldn't be a need to type in the domain name if you are on the same domain.

From man dig:

NAME
       dig - DNS lookup utility

DESCRIPTION
       dig (domain information groper) is a flexible tool for interrogating
       DNS name servers. It performs DNS lookups and displays the answers that
       are returned from the name server(s) that were queried. Most DNS
       administrators use dig to troubleshoot DNS problems because of its
       flexibility, ease of use and clarity of output. Other lookup tools tend
       to have less functionality than dig.

       Unless it is told to query a specific name server, dig will try each of
       the servers listed in /etc/resolv.conf. If no usable server addresses
       are found, dig will send the query to the local host.

I have searched the dig man page and I cannot find the word qualified anywhere in it.

Showing my network setup and examples:

terrance@terrance-ubuntu:~$ cat /etc/resolv.conf 
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 10.0.0.1
search local

terrance@terrance-ubuntu:~$ nslookup DD-WRT
Server:     10.0.0.1
Address:    10.0.0.1#53

Name:   DD-WRT.local
Address: 10.0.0.1

terrance@terrance-ubuntu:~$ dig DD-WRT

; <<>> DiG 9.10.3-P4-Ubuntu <<>> DD-WRT
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56329
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;DD-WRT.                IN  A

;; ANSWER SECTION:
DD-WRT.         0   IN  A   10.0.0.1

;; Query time: 0 msec
;; SERVER: 10.0.0.1#53(10.0.0.1)
;; WHEN: Wed Apr 11 18:31:50 MDT 2018
;; MSG SIZE  rcvd: 51


terrance@terrance-ubuntu:~$ dig terrance-ubuntu

; <<>> DiG 9.10.3-P4-Ubuntu <<>> terrance-ubuntu
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4063
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;terrance-ubuntu.       IN  A

;; ANSWER SECTION:
terrance-ubuntu.    0   IN  A   10.0.0.100

;; Query time: 0 msec
;; SERVER: 10.0.0.1#53(10.0.0.1)
;; WHEN: Wed Apr 11 18:32:37 MDT 2018
;; MSG SIZE  rcvd: 60

My conclusion is something in your network setup is not correct.

  • Thanks for all this help, Terrance. How strange... My resolv.conf has a 'domain' entry. ` domain michigan` ` nameserver 192.168.0.110 ` nameserver 127.0.0.53 ` search michigan ` nameserver 127.0.0.53 ` search michigan – Stephen Boston Apr 12 '18 at 3:33
  • I can't get the markdown to work in these comments. Sorry. I'll just keep muddling trhough. Thanks for the heads up. – Stephen Boston Apr 12 '18 at 3:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.