Ubuntu 20.04 cannot ping local zone

I have a server where ping command cannot resolve a local DNS record. I'm stumped.

Here is my lab setup.

DNS Zone  - mydomain.local

x.x.x.117 - CentOS 8 Primary DNSserver
x.x.x.118 - Ubuntu 20.04 Desktop
x.x.x.119 - Ubuntu 20.04 Server

I created a new zone for mydomain.local

mydomain.local A 192.168.5.118
*.mydomain.local A 192.168.5.118

ISSUE:

When I SSH into .118, I cannot ping mydomain.local. PING command comes up dead and cannot resolve an IP address.

How can I trouble shoot why .118 ping command cannot resolve an IP address for my domain.local? ping: mydomain.local: Name or service not known

I TRIED:

  • When I log into .119, .117, or through a VPN, I can ping mydomain.local with no issues.
  • On .118, I used dig, nslookup all report good responses.
  • On .118, Ping resolves wild card aliases such as www.mydomain.local, anyalias.mydomain.local.
  • on .118, Ping x.x.x.118 and 127.0.0.1 are good.
  • rebooting the server does not work.
  • clearing DNS cache does not work.

This is very strange behavior. Thanks for the help.


Solution 1:

The problem you are describing is not with the ping command itself (nor with traceroute) - it is a name resolution problem: when ping issues gethostbyname() to the name resolution service, it does not get a good answer and aborts.

using dig (or you could have also tried the host command) may not be able to detect the problem as these access the DNS name service directly while the problem is likely not in the DNS service but in the configuration of the kernel name services (libnss).

you might want to check your /etc/nsswitch.conf file and compare the hosts: line to the other server where things are working. Check how libnss resolves names by using getent ahosts mydomain.local and you'd probably find the answer.