I have a home-network with several windows and Linux machines which have samba installed.

On Windows I can find each other computer fine via its hostname.

however on a Linux computer I can't find any other computer via its hostname -- only the IP address works.

In fact, it seems that Linux can't even resolve itself:

user@atom:~$ host atom
Host atom not found: 3(NXDOMAIN)

3 Answers 3


Windows uses a different system for hostname resolution to Linux.

Linux uses the /etc/hosts file and/or DNS for name resolution

The /etc/hosts file is simply a list of IP address and names and was once the only way to map names to IP addresses before it was realised that it was getting to big to manage. The solution was DNS (Domain Name System), which is a distributed database which now underpins the whole Internet.

The host command that you used only queries DNS - not /etc/hosts, therefore it cannot find your local computer unless it has a DNS entry.

To access all your Linux machines by name, either create a /etc/hosts file:    localhost.localdomain    localhost  laptop.mydomain.net  laptop  server.mydomain.net  server  printer.mydomain.net printer

and distribute it to all your Linux computer, or install DNS. dnsmasq is a lightweight DNS/DHCP server which is perfect for a small network.

Windows uses it's own NetBIOS Name Resolution where each computer broadcasts a special message on the local area network in order to find out the IP address of a computer with a specific name. This is why Windows machines tend to find each other automatically when they are on the same network. They cache this for future use so that there isn't too much chatter on the network.

An alternative to this broadcast name resolution (for larger deployments) is WINS (Windows Internet Naming Service) which is a central database of computer and/or service names to IP address. Modern versions of Windows now use DNS as it's the de-facto standard for name resolution and is more scalable than WINS.


Windows computers find each other by using NetBIOS. Basically all the nodes on the network elect one computer to be in charge of name resolution, and new nodes can just query this node.

Your host command should be expected to fail if you don't have a DNS server set up. That's the equivalent of nslookup on Windows. If you run nslookup on a Windows computer to another windows computer it will also fail without DNS because that's what you're querying with the command you've chosen.

That said, you should be able to either reference the other machines by IP address, or by adding their IP addresses to /etc/hosts. IIRC Gnome have some Samba integration options for allowing you to navigate an SMB workgroup similar to what you're probably thinking of with windows. I can't remember the package's name off the top of my head, though.


If you don't have a DNS server at home, which is unlikely, there seem to be a couple of options.

  1. Read up on avahi-server (see this thread) to see if that solves your issues. Note the comment about appending ".local" to your hostname. By the way, what do you get when you type "hostname" at command prompt? I also suggest reading the manpage for hostname, esp. the part about THE FQDN.
  2. edit /etc/hosts

EDIT: as the commenter requested, here's some detail from the thread I linked. You can implement zeroconf in your linux machines to advertise their hostnames over the local network. A typical install (for ubuntu) would be "sudo apt-get install avahi-daemon". Avahi implements zeroconf on ubuntu and other linuxes and you only need the daemon installed to advertise hostnames. I read in another thread here (https://superuser.com/questions/491747/how-can-i-resolve-local-addresses-in-windows) that Bonjour, a zeroconf implementation from Apple, can be installed on Windows PC to perform the same function.

  • You can improve this answer by providing more details from the thread you link. If something happens to that link, this answer won't be helpful anymore.
    – drs
    Aug 8, 2014 at 15:19
  • when i type hostname, it correctly gives me the hostname, which is 'atom' in this case. i have now installed avahi-daemon on one of the linux machines only. (do i have to install it on others also?)
    – clamp
    Aug 8, 2014 at 15:48
  • I would verify that it's working on the one linux machine, then install it on all of them.
    – LHWizard
    Aug 8, 2014 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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