How to set up local domain names with Zeroconf
This page describes how to set up a local network where each machine has a resolvable host name, without requiring a single server to be present. This is useful when for example only laptops are used in a home network, but none of them are always present. It can be done by setting up Avahi on each machine, which implements Zeroconf, and using the nss-mdns system to resolve hostnames using the Zeroconf multicast dns setup.
See AvahiAndUnicastDotLocal for a generic description of how this works; this is just a guide to setting this up on Fedora.
Fedora setup
Install the following packages using yum:
- avahi, avahi-tools, nss-mdns
The package adjusts /etc/nsswitch.conf
so that the hosts line looks as follows:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
This allows failure on domains ending with .local
without checking DNS servers, but will only use mdns for non-.local
domains if DNS fails.
Then you can edit /etc/avahi/avahi-daemon.conf
and set the host-name
to your desired hostname. This will combine with the domain
which is set by default to .local
(e.g. mytoaster.local
. If the name was set before this step should not be necessary as the machine name is used instead.
Finally run /etc/init.d/avahi-daemon restart
to restart the avahi service. You should then be able to resolve hostnames whenever machines are present on the network. You can also browse local services and hosts by running avahi-browse -d local -a