Zero Configuration Networking, also called Zeroconf or [[wikipedia:Bonjour_(software)|Bonjour]] ([http://developer.apple.com/softwarelicensing/agreements/bonjour.html Apple's trademark] for their Zero Configuration Networking implementation) is a suite of related technologies that allow networked devices to interoperate on a local network without requiring explicit configuration.

+

{{Person

−

+

|Full name=Matthew Moses

−

== Requirements ==

+

|Email=moses.matthewl@gmail.com

−

+

|Geoloc=44.5044471, -85.6770138

−

Zero Configuration Networking requires the following things to operate:

+

|Location name=Buckley, Michigan, United States of America

−

+

|Roles={{Role

−

* A valid IP address, obtained either by:

+

|Role type=User

−

** Static assignment

+

|Role desc=Abnormally Average

−

** DHCP

+

|Start date=2008/01/01

−

** Link-local Addressing (part of Zero Configuration Networking)

+

}}

−

* A means to address other devices by name, provided either by:

+

|Maintains=

−

** DNS

+

|Blogs=

−

** multicast DNS (mDNS -- part of Zero Configuration Networking)

+

}}

−

+

−

== Service Discovery ==

+

−

+

−

On top of this, Zero Configuration Networking also provides a means to discover what services are available on each device. This is something that is provided exclusively by Zero Configuration Networking and is called Zeroconf Service Discovery.

+

−

+

−

== Configuration ==

+

−

+

−

In order to get these sort of networking services running, some configuration needs to happen initially.

+

−

+

−

== Link-local Addresses ==

+

−

+

−

{{Fancynote|It's only necessary to use link-local addressing if you have no other means of obtaining a valid IP address on your LAN. Typically, this is the case if you are setting up a small or ad-hoc network where no DHCP server has been configured.}}

Then, use <tt>avahi-autoipd</tt> to discover a valid link-local IP address:

+

−

<console>

+

−

###i## /usr/sbin/avahi-autoipd --daemonize --syslog --wait eth0

+

−

</console>

+

−

+

−

Once a valid link-local IP address is found, eth0 will now have a <tt>169.254.x.x</tt> address that can be used to communicate on the local LAN.

+

−

+

−

As an alternative, you can have dhcpcd built with <code>USE="zeroconf"</code>, and it will provide a link local address if no DHCP server is found.

+

−

+

−

== Multicast DNS ==

+

−

+

−

Multicast DNS, or mDNS, is a means by which individual machines can broadcast their DNS information to machines on the local LAN so that a DNS server is not required to address local devices by name. The ".local" domain is typically used for multicast DNS, so your laptop might be addressable by pinging "mylaptop.local", for example. mDNS is not necessary if you have some other means of addressing machines by name, such as unicast (regular) DNS. But many LANs do not have their own DNS server configured, in which case mDNS can be very handy.

+

−

+

−

=== .local Hostname Suffix ===

+

−

+

−

If you want to configure your Funtoo Linux system to be addressable on your LAN using a <tt>myhostname.local</tt> address, first ensure that you set your system's hostname in <tt>/etc/conf.d/hostname</tt>, and use ''only'' the non-qualified name, so don't add a <tt>.local</tt> yourself. Multicast DNS will automatically use that suffix. Here is a sample <tt>/etc/conf.d/hostname</tt> for a machine on my network that I can ping from other machines as <tt>antec.local</tt>:

+

−

+

−

{{File

+

−

|/etc/conf.d/hostname|<pre>

+

−

hostname="antec"

+

−

</pre>}}

+

−

+

−

== Receiving mDNS ==

+

−

+

−

The package {{Package|sys-auth/nss-mdns}} provides the necessary functionality for your Funtoo/Gentoo Linux machine to receive mDNS broadcasts, so that it can do things like ping mybox.local, or ssh mylaptop.local.

+

−

+

−

From the [http://0pointer.de/lennart/projects/nss-mdns/#overview nss-mdns] home page:

''nss-mdns provides client functionality only, which means that you have to run a mDNS responder daemon seperately from nss-mdns if you want to register the local host name via mDNS. I recommend Avahi.

+

−

+

−

''nss-mdns is very lightweight (9 KByte stripped binary .so compiled with -DNDEBUG=1 -Os on i386, gcc 4.0), has no dependencies besides the glibc and requires only minimal configuration.

+

−

+

−

''By default nss-mdns tries to contact a running avahi-daemon for resolving host names and addresses and making use of its superior record cacheing. Optionally nss-mdns can be compiled with a mini mDNS stack that can be used to resolve host names without a local Avahi installation. Both Avahi support and this mini mDNS stack are optional, however at least one of them needs to be enabled. If both are enabled a connection to Avahi is tried first, and if that fails the mini mDNS stack is used.

+

−

<console>

+

−

###i## emerge -av nss-mdns

+

−

</console>

+

−

+

−

Set up multicast route:

+

−

<console>

+

−

###i## route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0

+

−

</console>

+

−

+

−

Note: Adding <code>multicast="yes"</code> in <code>/etc/conf.d/netif.foo</code> (replace foo with your actual network interface name) will set up the multicast route automatically at startup.

+

−

+

−

Now, it's necessary to modify <tt>/etc/nsswitch.conf</tt> so that your system will use multicast DNS for hostname lookup. In the example, we use the <tt>mdns_minimal</tt> and <tt>mdns</tt> words, which enable multicast DNS for IPv4 and IPv6. If you only want to enable IPv4-based multicast DNS, which is recommended for IPv4-only networks, use <tt>mdns4_minimal</tt> and <tt>mdns4</tt> instead. This will improve hostname lookup performance.

+

−

{{File

+

−

|/etc/nsswitch.conf|<pre>

+

−

hosts: files mdns_minimal [NOTFOUND=return] dns mdns

+

−

</pre>}}

+

−

+

−

== Sending Multicast DNS ==

+

−

+

−

Avahi-daemon handles the task of '''sending''' multicast DNS broadcasts, as well as service discovery broadcasts, on your local LAN. If you want other devices to be able to reach your Funtoo/Gentoo Linux machine via multicast DNS, and Zeroconf Service Discovery, you'll want to enable avahi-daemon. This will also improve the efficiency of performing multicast DNS lookups locally.