Unable to resolve hosts supplied by local DNS server
I have run into a very annoying DNS problem in our company:
We have a pfSense box providing DHCP and DNS to the client macbooks. The DNS server hands out the ip addresses of local machines, so that users that connect can be reached by their hostname (i.e. "ping jwoelper" (my machine) should work).
It turns out that many hosts do not resolve. The problematic thing is: it is very hard to diagnose. Take for instance this:
(the DNS server has a manual mapping of 192.168.1.66 to "server")
on any linux or windows box, "ping server" works and resolves to 192.168.1.66.
On Yosemite, ping server replies with "ping: cannot resolve server: Unknown host".
Now the really strange thing:
When I run dig server
<<>> DiG 9.8.3-P1 <<>> server
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54680
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;server. IN A
;; ANSWER SECTION:
server. 3600 IN A 192.168.1.66
;; Query time: 3 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Tue Jan 6 11:01:32 2015
;; MSG SIZE rcvd: 40
dig correctly resolves "server" to 192.168.1.66.
When i run nslookup server it resolves correctly, too:
Server: 192.168.1.1
Address: 192.168.1.1#53
Name: server
Address: 192.168.1.66
If I append a dot to the hostname, ping does work:
ping server.
PING server (192.168.1.66): 56 data bytes
64 bytes from 192.168.1.66: icmp_seq=0 ttl=64 time=2.592 ms
64 bytes from 192.168.1.66: icmp_seq=1 ttl=64 time=1.611 ms
Before you ask: This happens on all macbooks (about 10) in all sorts of configurations. Windows and Linux DHCP clients resolve these hostnames just fine.
Needless to say, pointing a browser to "http://server" does not work. "http://server." does.
my /etc/hosts file is untouched:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
my resolv.conf, as passed to the client by my DHCP server (192.168.1.1 is DNS and DHCP server)
#
# Mac OS X Notice
#
# This file is not used by the host name and address resolution
# or the DNS query routing mechanisms used by most processes on
# this Mac OS X system.
#
# This file is automatically generated.
#
domain mydomain
nameserver 192.168.1.1
nameserver 8.8.4.4
It would be great if somebody could shed some light on this. The most annoying thing is that OSX does not handle DNS consistently. This makes administrating it very hard if standard diagnose tools (dig, nslookup) can not be relied on.
Thanks in advance everyone!
MacBook Pro with Retina display, OS X Yosemite (10.10.1), null