Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
1  
This is expected, it's using the DNS search suffix specified in your interface/resolv.conf which will match your wildcard entry. –  TheFiddlerWins Nov 14 '13 at 21:27
    
How can I prevent this? I want it to fail. –  Justin Nov 14 '13 at 21:32
1  
Stop using wildcard DNS. –  Michael Hampton Nov 14 '13 at 21:36
    
That's not an option, required for the application. –  Justin Nov 14 '13 at 21:37
    
You can remove it if you like, it's there as a helper not required for basic functionality...but some apps/services will expect it to be there and you will need to use FQDNs for any references to local network resources. –  TheFiddlerWins Nov 14 '13 at 21:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.