On Linux Debian 9 I am able to resolve a specific local domain e.g. my.sample-domain.local
using some commands like nslookup
or host
, but not with some other commands like ping
or the Postgres client psql
.
I think stuff like Network Manager has setup my DNS resolver correctly (the content of /etc/resolv.conf
), so I am not sure why is this happening?
I checked with a colleague using Windows 10 and they don't have any custom entry in their host file, although in their case the Windows version of ping
and their database UI for Postgres works as expected resolving the domain into an IP address.
Please see below:
$ ping my.sample-domain.local
ping: my.sample-domain.local: Name or service not known
$ host my.sample-domain.local
my.sample-domain.local has address <THE_IP_REPRESENTING_THE_LOCAL_DOMAIN>
$ ping -c 5 <THE_IP_REPRESENTING_THE_LOCAL_DOMAIN>
PING <THE_IP_REPRESENTING_THE_LOCAL_DOMAIN> (<THE_IP_REPRESENTING_THE_LOCAL_DOMAIN>) 56(84) bytes of data.
64 bytes from <THE_IP_REPRESENTING_THE_LOCAL_DOMAIN>: icmp_seq=1 ttl=128 time=1.16 ms
64 bytes from <THE_IP_REPRESENTING_THE_LOCAL_DOMAIN>: icmp_seq=2 ttl=128 time=0.644 ms
64 bytes from <THE_IP_REPRESENTING_THE_LOCAL_DOMAIN>: icmp_seq=3 ttl=128 time=0.758 ms
64 bytes from <THE_IP_REPRESENTING_THE_LOCAL_DOMAIN>: icmp_seq=4 ttl=128 time=0.684 ms
64 bytes from <THE_IP_REPRESENTING_THE_LOCAL_DOMAIN>: icmp_seq=5 ttl=128 time=0.794 ms
--- <THE_IP_REPRESENTING_THE_LOCAL_DOMAIN> ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4056ms
rtt min/avg/max/mdev = 0.644/0.808/1.160/0.183 ms
$ nslookup my.sample-domain.local
Server: <THE_IP_REPRESENTING_THE_NAMESERVER>
Address: <THE_IP_REPRESENTING_THE_NAMESERVER>#53
Non-authoritative answer:
Name: my.sample-domain.local
Address: <THE_IP_REPRESENTING_THE_LOCAL_DOMAIN>
$ cat /etc/resolv.conf
domain <AN_INTERNAL_DOMAIN>
search <AN_INTERNAL_DOMAIN>
nameserver <THE_IP_REPRESENTING_THE_NAMESERVER>
nameserver <ANOTHER_IP_REPRESENTING_THE_NAMESERVER>
EDIT:
Meanwhile I realized there is an Ubuntu 16 Virtual Machine in the same office LAN, so I logged into it and tried the ping
command which is working there.
Also that Ubuntu VM does not have any particular custom setting in /etc/hosts
(the same as my Debian 9 laptop with not customized /etc/hosts
).
Both the /etc/resolv.conf
look similar (some shared domains/IPs, some other IPs for the same domain).
However the file /etc/nsswitch.conf
is different, so I think there is something going on with this mdsn4_minimal
and the order of hosts resolution in there like mdsn4_minimal
coming before dns
:
hosts: files mdns4_minimal [NOTFOUND=return] dns
and on Ubuntu:
hosts: files dns
EDIT 2:
Both the Ubuntu 16 VM and my Debian 9 laptop are able to resolve that .local
domain using the dig
command.
/etc/gai.conf
) or nameserviceswitch (/etc/nsswitch.conf
), but I only know of these, not about.dig @SERVER my.sample-domain.local +short
gives the outputdig: couldn't get address for 'SERVER': failure
on both the machines. I've tried also@$SERVER
(although I think that $ was a typo) and I get:dig: couldn't get address for '': not found