On my Debian server, the hostname is set to "debian." When I tried to ping debian from another Linux machine, it says "ping: cannot resolve debian: Unknown host." When trying to ping to any other servers, it's able to resolve for ip and ping successfully. What's wrong?

  • How is it supposed to work? By what method are you expecting the other servers to resolve the IP? (If you don't have any idea why it should work, then you shouldn't expect it to work and probably it shouldn't work. If you can an idea why it should work, that will be the first big clue that tells you what to investigate.) Jun 9, 2012 at 1:27
  • All of my servers are joined together by a router. This should make it work. When I ping server1, it should ask the router for an ip address ( and forwards it to the client. But it's not working in this case.
    – superuser
    Jun 9, 2012 at 1:34
  • Are you saying your router is supposed to provide a name to IP address mapping service of some kind? Is this dynamic DNS? Or is the mDNS or Bonjour? Is the router the DNS server? (You won't be able to figure out why it's not working without first fully understanding how it is supposed to work.) Jun 9, 2012 at 1:59
  • Right, my router is acting as a DNS server inside my work network. Please correct me if I'm wrong... When a computer registers on my router's network, it tells the router what its hostname is and assigns the computer an IP address, right? So, if I go on another PC on the same network and try to ping that computer using its hostname instead of its IP, the router should know what IP to point the request to. However, this doesn't seem to be working on this computer only, other in the same network works! I'm thinking it might be a fqdn issue, but I'm not 100% sure how to fix it.
    – superuser
    Jun 9, 2012 at 2:15
  • If that's true on your LAN, that would be unusual and you would have to have specifically configured it. If that's the case, I'd check your configuration. If it's based on the client registering in the DNS, make sure the client is set to do that. If it's based on the router/server registering in the DNS, check the router/server's configuration. I should stress that this is an unusual setup, and if you have it, it's because you (or someone else) specifically configured this. Jun 9, 2012 at 2:17

1 Answer 1


Windows networking has kind of spoiled people on how networks are supposed to work.

Windows machines all run (by default, anyway) a name resolution service as part of SMB. This starts to be a confusion when non-windows components are added to the network, and they "don't act predictably".

Additionally some components, being designed with the knowledge that some things won't act windowsy (for lack of a better word) include "features" to "encourage things to just work". These features just make more ambiguous how the network is actually working.

There are a couple solutions:

  1. Install/activate the Samba service on the Debian box. This will enable the name resolution service, so the box can be seen by-name from windows machines. Be aware any other Linux machines on the network will probably still not see the machine by-name, since Linux machines generally don't use SMB level name resolution for network lookups.
  2. Use custom host files so all the known machines on the network can reference each other by name without having to use a resolution service. This is my preferred method, but can get complicated with networks that grow larger than 10 machines or so.
  3. Some routers that can handle DNS locally will reverse-include machines that get their IP by DHCP from them. But, this relies on all the machines on the network using the router as the primary DNS provider, and not an ISP or other external DNS provider (like OpenDNS). For routers I've used that had this feature, success was kind of a hit or miss kind of thing, but also had the problem of any machine with a static IP (not getting IP by DHCP), was not in the DNS table on the router, so had to be manually dealt with anyway.

Basically, it all comes down to knowing and mastering your local network. Windows made a little too much of network administration too easy for too long, and it has unfortunately led to a lot of incorrect assumptions about how networks work.

  • Your solution #3 gave me an idea to manually add the host to a list of "static leases" on the router since the Debian server didn't obtain its IP from DHCP. After a reboot, it worked like a charm. Thanks everyone for your helpful inputs!
    – superuser
    Jun 10, 2012 at 19:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .