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.

On my local machine (Ubuntu) if I were to ping a hostname that is non-existent, the ping command returns

$ ping somefakedomain.com.au
  ping: unknown host somefakedomain.com.au

However the same command on either of my remote centOS servers returns totally different results

$ ping somefakedomain.com.au
  PING texh.net (103.4.16.120) 56(84) bytes of data.
  64 bytes from toph.texh.net (103.4.16.120): icmp_seq=1 ttl=64 time=0.046 ms
  ...

This really has me stumped, I'd love if anyone has any ideas as to why this is. I've tried Googling for it, but all I seem to be able to find is the opposite problem where people are unable to ping valid hosts due to various networking issues.

What I plan to do with this is set up a cron job to ping several servers to check that they're still online, and to gauge network latency between the two, however it seems that if one of the servers pinged was down, then it would simply ping itself and return false positives.

share|improve this question

2 Answers 2

I suspect your trouble is that texh.net is not a fake domain. When I try, it resolves to 103.4.16.120. I get 103.4.16.251 for toph.texh.net but I can't get a reverse lookup for 103.4.16.120 at all. The problem for you is that you are getting an IP address, therefore it's not an "Unknown host".

When choosing a fake domain, make sure it actually doesn't exist.

Also, changing (most of the occurrences of) the domain in your question to somefakedomain.com.au confuses the issue because that one actually doesn't exist. It's only because you missed two of them that I was able to see the real problem.

When testing DNS resolution, dig is the tool you should use, not ping. ping gives you no control over which nameservers you use or which type of records you look up. ping will also look in your hosts file (depending on your nsswitch.conf) which can further confuse the issue.

Note: If you use OpenDNS, they will return an IP address they own when they should return an NXDOMAIN response. You can opt out of this by creating an account on their website and choosing the option in the settings section or by using a different DNS service.

share|improve this answer

Check your /etc/resolv.conf and see you have nameserver enrty to resolve the domain, if we have nameserver entry missing we will also get this error

share|improve this answer
    
Thanks, I think you may be on to something. I had my suspicions that it could be something to do with /etc/resolv.conf not being completely correct. It's original contents were nameserver 8.8.8.8 nameserver 8.8.4.4 I just prepended search toph.texh.net (machines hostname) to the file, and it seems to work as I was expecting originally. Would this be the correct thing to place there, or am I way off? For now it seems to be working okay, just don't want it to come back and bite me in the butt later on. –  Sunny Aug 17 '12 at 5:14

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.