[Solved] DNS failing to resolve local addresses?

This forum is for discussion about general software issues.

[Solved] DNS failing to resolve local addresses?

Postby PeterAOBell » Sun Sep 17, 2017 6:08 pm

I am making a fresh install on a RaspberryPi 2. I have an older install on an original RaspberryPi. The older install will happily resolve local names, such as vigor, while the new install fails to do so when using ping or other commands, although drill returns the correct ip address..

Older system:$this->bbcode_second_pass_code('', '[root@upstairs ~]# uname -a
Linux upstairs 4.4.14-1-ARCH #1 Sun Jun 26 12:18:36 MDT 2016 armv6l GNU/Linux
[root@upstairs ~]# ping vigor
PING vigor (172.22.0.2) 56(84) bytes of data.
64 bytes from vigor.localdomain (172.22.0.2): icmp_seq=1 ttl=255 time=0.403 ms
64 bytes from vigor.localdomain (172.22.0.2): icmp_seq=2 ttl=255 time=0.395 ms
64 bytes from vigor.localdomain (172.22.0.2): icmp_seq=3 ttl=255 time=3.07 ms
^C
--- vigor ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.395/1.292/3.079/1.263 ms
[root@upstairs ~]# ^C
[root@upstairs ~]#')

On the new system:$this->bbcode_second_pass_code('', '[root@alarmpi alarm]# uname -a
Linux alarmpi 4.9.50-1-ARCH #1 SMP Thu Sep 14 01:28:33 UTC 2017 armv7l GNU/Linux
[root@alarmpi alarm]# drill vigor
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 2317
;; flags: qr aa rd ra ; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;; vigor. IN A

;; ANSWER SECTION:
vigor. 0 IN A 172.22.0.2

;; AUTHORITY SECTION:

;; ADDITIONAL SECTION:

;; Query time: 1 msec
;; SERVER: 172.22.0.1
;; WHEN: Sun Sep 17 18:00:38 2017
;; MSG SIZE rcvd: 39
[root@alarmpi alarm]# ping vigor
ping: vigor: Name or service not known
[root@alarmpi alarm]# ping 172.22.0.2
PING 172.22.0.2 (172.22.0.2) 56(84) bytes of data.
64 bytes from 172.22.0.2: icmp_seq=1 ttl=255 time=0.386 ms
64 bytes from 172.22.0.2: icmp_seq=2 ttl=255 time=0.298 ms
^C
--- 172.22.0.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1057ms
rtt min/avg/max/mdev = 0.298/0.342/0.386/0.044 ms
[root@alarmpi alarm]#
')

So drill correctly resolves vigor to 172.22.0.2, but "ping vigor" reports "Name or service not known". Pinging the ip address is successful.

I'm sure that I've forgotten to do something basic, but cannot figure out what. Suggestions please!

EDIT to add:
I should say that ping to a public address (eg http://www.bbc.co.uk) works fine. The behaviour is as if the system is using a public dns server, instead of my local dns server/relay. But why does drill, using the default (my local) dns, manage to resolve local addresses?
Last edited by PeterAOBell on Fri Sep 22, 2017 4:09 pm, edited 1 time in total.
PeterAOBell
 
Posts: 11
Joined: Sat Mar 15, 2014 6:49 am

Re: DNS failing to resolve local addresses?

Postby WarheadsSE » Mon Sep 18, 2017 2:38 pm

Check both machines' `/etc/resolv.conf` for `search` as this controls what domain to search when given only the hostname and not an FQDN
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: DNS failing to resolve local addresses?

Postby PeterAOBell » Tue Sep 19, 2017 1:26 am

Thank you for your assistance.

The resolv.conf files are identical, with only a single line:
nameserver 172.22.0.1
so I'm not sure that it's anything to do with a 'search' configuration.

172.22.0.1 happens to be another RPi running Arch - handling all my dhcp, dns ntp etc. services.
PeterAOBell
 
Posts: 11
Joined: Sat Mar 15, 2014 6:49 am

Re: DNS failing to resolve local addresses?

Postby WarheadsSE » Tue Sep 19, 2017 6:45 pm

Interesting. Well it definitely has to do with the search domain. So to be sure I am right: functional one (armv6l) is also the DHCP/DNS providing host, and the non-functional one is a pure client of that?

If that is the case, the local DNS is probably handling the search domain for you silently, but interesting that it isn't populating that down. Does your DNS layout have something akin to the local domain? E.g. mine is `.home`, to `xu4.home` resolves to my XU4, and because I have a line `search home`, `ping xu4` resolves `xu4` as `xu4.home`

$this->bbcode_second_pass_code('', '
[whse@beast ~]$ ping xu4
PING xu4.home (192.168.11.45) 56(84) bytes of data.
64 bytes from XU4.home (192.168.11.45): icmp_seq=1 ttl=64 time=0.483 ms
^C
--- xu4.home ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.483/0.483/0.483/0.000 ms
')
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: DNS failing to resolve local addresses?

Postby PeterAOBell » Wed Sep 20, 2017 4:30 pm

Thanks again for your reply.

I have four ARMv6l units, all running oldish installs of ArmLinux. One of these is my dhcp/dns/ntp server/relay. All machines on my network are clients of that server, including several x86 boxes running various distros (Slack, Mint, Arch etc). The Slack machine also runs several dockers with Arch and Ubuntu distros. There are also two Pi3s running LibreELEC, one Pi3 running Gentoo, and two Pi2s running another build (not sure whether based on a known distro or not). All of these machines are able to resolve and ping other local hosts, as in "ping vigor". I have little doubt, therefore, that the dhcp/dns service is good.

The machine which I have been citing as the 'functional' machine is not the one hosting the dhcp/dns services, but another of the Pi1 machines which is happily cooperating, over the network, with another 2 identical machines, running a home automation system which I am developing.

The only machine which appears to be unable to resolve local addresses is the new install of Arch (ARMv7) on a Pi2. ... and what really confuses me is that drill on that machine returns the correct ip address, while ping returns "Name or service not known"
$this->bbcode_second_pass_code('', '[alarm@alarmpi ~]$ drill vigor
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 46083
;; flags: qr aa rd ra ; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;; vigor. IN A

;; ANSWER SECTION:
vigor. 0 IN A 172.22.0.2

;; AUTHORITY SECTION:

;; ADDITIONAL SECTION:

;; Query time: 1 msec
;; SERVER: 172.22.0.1
;; WHEN: Thu Sep 21 00:14:04 2017
;; MSG SIZE rcvd: 39
[alarm@alarmpi ~]$ ping vigor
ping: vigor: Name or service not known
[alarm@alarmpi ~]$ ping 172.22.0.2
PING 172.22.0.2 (172.22.0.2) 56(84) bytes of data.
64 bytes from 172.22.0.2: icmp_seq=1 ttl=255 time=0.665 ms
64 bytes from 172.22.0.2: icmp_seq=2 ttl=255 time=0.421 ms
64 bytes from 172.22.0.2: icmp_seq=3 ttl=255 time=0.387 ms
^C
--- 172.22.0.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2099ms
rtt min/avg/max/mdev = 0.387/0.491/0.665/0.123 ms
[alarm@alarmpi ~]$ ')
PeterAOBell
 
Posts: 11
Joined: Sat Mar 15, 2014 6:49 am

Re: DNS failing to resolve local addresses?

Postby WarheadsSE » Thu Sep 21, 2017 12:27 pm

Check the following:

- Is the new system using systemd-resolved where the previous are not?
- Are there any differences in the /etc/nsswitch.conf

What I am looking for at this point is a difference in how the glibc resolver functions are behaving, as obviously a direct dig seems to function.

Are you operating your home network without a domain, and purely hostnames?
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: DNS failing to resolve local addresses?

Postby PeterAOBell » Thu Sep 21, 2017 1:45 pm

Once again - I'm most grateful to you for your continued interest in my problem!

Both systems are using systemd-resolved, but there are slight differences in their status reports:
'Working' system:$this->bbcode_second_pass_code('', '[root@master ~]# systemctl status systemd-resolved
* systemd-resolved.service - Network Name Resolution
Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; enabled; ve
Active: active (running) since Wed 2017-09-20 18:02:54 PHT; 1 day 3h ago
Docs: man:systemd-resolved.service(8)
http://www.freedesktop.org/wiki/Software/systemd/resolved
http://www.freedesktop.org/wiki/Software/systemd/writing-network-conf
http://www.freedesktop.org/wiki/Software/systemd/writing-resolver-cli
Main PID: 207 (systemd-resolve)
Status: "Processing requests..."
CGroup: /system.slice/systemd-resolved.service
`-207 /usr/lib/systemd/systemd-resolved

Sep 20 18:02:53 master systemd[1]: Starting Network Name Resolution...
Sep 20 18:02:54 master systemd-resolved[207]: Positive Trust Anchors:
Sep 20 18:02:54 master systemd-resolved[207]: . IN DS 19036 8 2 49aac11d7b6f6446
Sep 20 18:02:54 master systemd-resolved[207]: Negative trust anchors: 10.in-addr
Sep 20 18:02:54 master systemd-resolved[207]: Using system hostname 'master'.
Sep 20 18:02:54 master systemd[1]: Started Network Name Resolution.
')

'Non-working' system:$this->bbcode_second_pass_code('', '[alarm@alarmpi ~]$ systemctl status systemd-resolved
● systemd-resolved.service - Network Name Resolution
Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; enabled; ve
Active: active (running) since Thu 2017-09-21 19:31:22 +08; 1h 59min ago
Docs: man:systemd-resolved.service(8)
https://www.freedesktop.org/wiki/Software/systemd/resolved
https://www.freedesktop.org/wiki/Software/systemd/writing-network-con
https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-cl
Main PID: 267 (systemd-resolve)
Status: "Processing requests..."
Tasks: 1 (limit: 4915)
CGroup: /system.slice/systemd-resolved.service
└─267 /usr/lib/systemd/systemd-resolved

Sep 21 19:31:21 alarmpi systemd[1]: Starting Network Name Resolution...
Sep 21 19:31:21 alarmpi systemd-resolved[267]: Positive Trust Anchors:
Sep 21 19:31:21 alarmpi systemd-resolved[267]: . IN DS 19036 8 2 49aac11d7b6f644
Sep 21 19:31:21 alarmpi systemd-resolved[267]: . IN DS 20326 8 2 e06d44b80b8f1d3
Sep 21 19:31:21 alarmpi systemd-resolved[267]: Negative trust anchors: 10.in-add
Sep 21 19:31:21 alarmpi systemd-resolved[267]: Using system hostname 'alarmpi'.
Sep 21 19:31:22 alarmpi systemd[1]: Started Network Name Resolution.
')

Specifically, the 'non-working' system has two ". IN" lines. I'm not sure of the significance of this.

Also, there are notable differences in the nsswitch.conf files:
'Working' system:$this->bbcode_second_pass_code('', '[root@master ~]# cat /etc/nsswitch.conf
# Begin /etc/nsswitch.conf

passwd: files
group: files
shadow: files

publickey: files

hosts: files dns myhostname
networks: files

protocols: files
services: files
ethers: files
rpc: files

netgroup: files

# End /etc/nsswitch.conf
')

and the 'non-working' system:$this->bbcode_second_pass_code('', '[alarm@alarmpi ~]$ cat /etc/nsswitch.conf
# Begin /etc/nsswitch.conf

passwd: compat mymachines systemd
group: compat mymachines systemd
shadow: compat

publickey: files

hosts: files mymachines resolve [!UNAVAIL=return] dns myhostname
networks: files

protocols: files
services: files
ethers: files
rpc: files

netgroup: files

# End /etc/nsswitch.conf
')

Again, the significance of the differences passes over my head!

I am running my network using host names alone and no local domain, although I do have vague memories of having tried using a local domain name at some time in the distant past - well before I had any RPis.
PeterAOBell
 
Posts: 11
Joined: Sat Mar 15, 2014 6:49 am

Re: DNS failing to resolve local addresses?

Postby WarheadsSE » Thu Sep 21, 2017 1:57 pm

nsswitch.conf
$this->bbcode_second_pass_code('', '
hosts: files dns myhostname
...
hosts: files mymachines resolve [!UNAVAIL=return] dns myhostname
')

The items above are related to the hostname resolution, and the path the glibc resolver should take to resolve a hostname. These differences are your most likely culprit, but let us check one more things first:

$this->bbcode_second_pass_code('', 'ls -l /etc/resolv.conf ')
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: DNS failing to resolve local addresses?

Postby PeterAOBell » Thu Sep 21, 2017 3:45 pm

ls -l /etc/resolv.conf produces essentially the same details on both machines.

'Working' system:$this->bbcode_second_pass_code('', '[root@master ~]# ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 32 Oct 3 2014 /etc/resolv.conf -> /run/systemd/resolve/resolv.conf
')

"Non-working" system:$this->bbcode_second_pass_code('', '[alarm@alarmpi ~]$ ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 32 Sep 11 01:06 /etc/resolv.conf -> /run/systemd/resolve/resolv.conf
')

Apart from some differences in the comments, the content of the file is identical:$this->bbcode_second_pass_code('', 'nameserver 172.22.0.1
')

So, I guess that we come back to the contents of the nsswitch.conf. Why would the contents of the file be so significantly different - who creates the content of the file?

Edit to add:
Yes, changing the 'hosts' entry to:$this->bbcode_second_pass_code('', 'hosts: files dns myhostname')
results in local host names being correctly resolved. So, the questions remaining in my mind:
Who created the content of nsswitch.conf, and why is it different between the two installations?
Why should there be a 'non-working' configuration on the new install?
Is the simple 'hand' amendment a sensible, permanent, fix?
PeterAOBell
 
Posts: 11
Joined: Sat Mar 15, 2014 6:49 am

Re: DNS failing to resolve local addresses?

Postby WarheadsSE » Fri Sep 22, 2017 3:18 pm

Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Next

Return to General

Who is online

Users browsing this forum: No registered users and 4 guests