If I install Windows on a computer, and plug it into my LAN, I can immediately ping it by name from any other computer.

If I install MacOS on a Mac, and plug it into my LAN, I can immediately ping it by name from any other computer.

If I install Linux on a computer, and plug it into my LAN......depending on the particular flavour of Linux, and what phase of the moon we're on, and whether or not I sacrificed a goat in a ceremonial circle at midnight before installing......I may be able to ping it by name, or I may not.

The Internet is full of forum posts asking this exact question. And the Internet is full of answers like "go into your router's settings and add a DNS entry" or "edit the hosts file on every computer and add a line for the new computer".

No. Clearly the mechanism exists for automatic configuration, so I want to use that.

My question is, therefore: What package(s) can I install or configure on Linux – Debian, Alpine, or whatever else I choose to run – that will automatically register the machine's hostname with my router, like happens naturally with Windows and Mac without any user intervention? It must be possible.

Some answers suggest avahi-daemon, but I installed and configured it and it still does not work. My own experiences suggest that samba will do it; but I don't want to open up that security hole. I assume that during the installation of samba it also drags a bunch of other stuff in, one part of which actually does the DNS fix....maybe?


2 Answers 2


Systems communicate with each other with IP-addresses, not with hostnames. So, your computer needs to translate your hostname into an IP address. Three common ways to do this are:

  • host file (/etc/hosts)
  • DNS
  • mDNS (Multicast DNS)

When people tell you to add an entry to your DNS server, you will use DNS. What you seem to want to use is mDNS.

mDNS does a multicast on the network, and all the devices that support mDNS will respond if their name is called-out. For example, a NAS may respond if you ping synology.local. Your resolver then does the translation to an IP address and you can ping that address.

There are a number of specifics with mDNS. It only works on your local subnet. The TLD is always .local. Both client and server must support it.

mDNS on Linux is provided by Avahi. If you installed and configured Avahi, and it still does not work, then you should look at your configuration and/or error-messages in the logs.


Sending a hostname when requesting an IP address with DHCP is an optional extension. For whatever reason a Linux box may have the DHCP client configured not to do this, or even configured to acquire the hostname from DHCP (which only makes sense for servers.)

Usually you can reconfigure this, but you're going to need to know which DHCP client is in use and/or which network management system (like NetworkManager) is set up just to start looking for the right options. And the solution is only going to apply to setups that work the same way.

You must log in to answer this question.

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