I am seeing very strange behavior with servers running CentOS 6.4 x64.
If I run a ping on a host which clearly doesn't exist:
➜ ~ ping sdafsadfdsadfsasdfasdoi.com
PING sdafsadfdsadfsasdfasdoi.com.mydomain.com (X.X.X.X) 56(84) bytes of data.
64 bytes from web2.mydomain.com (X.X.X.X): icmp_seq=1 ttl=64 time=0.047 ms
Notice that is simply added mydomain.com to the end, and since I have a wildcard DNS entry *.mydomain.com it resolved. This is not the desired behavior. I expect this to return unknown host.
If I run nslookup
:
➜ ~ nslookup sdafsadfdsadfsasdfasdoi.com
Server: 208.67.222.222
Address: 208.67.222.222#53
** server can't find sdafsadfdsadfsasdfasdoi.com: NXDOMAIN
Ok, so nslookup returns what I expect.
Any idea why this is happening, and how to prevent it, and return unknown host from a ping?
UPDATE
doing:
search .
In /etc/resolv.conf
fixed the issue. This feel like a dirty hack though. Is there a more elegant and best practices solution?