Zero Configuration Networking
Contents |
Zero Configuration Networking (Zeroconf)
Introduction
Zero Configuration Networking, also called Zeroconf or Bonjour (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.
Requirements
Zero Configuration Networking requires the following things to operate:
- A valid IP address, obtained either by:
- Static assignment
- DHCP
- Link-local Addressing (part of Zero Configuration Networking)
- A means to address other devices by name, provided either by:
- DNS
- 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
Link-local Addresses
To use link-local addressing, first set up the proper routes:
route add default dev eth0 metric 99 route add -net 169.254.0.0 netmask 255.255.0.0 dev eth0 metric 99
Then, use avahi-autoipd to discover a valid link-local IP address:
/usr/sbin/avahi-autoipd --daemonize --syslog --wait eth0
Once a valid link-local IP address is found, eth0 will now have a 169.254.x.x address that can be used to communicate on the local LAN.
Multicast DNS
receiving mDNS
emerge nss-mdns
Set up multicast route:
route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
/etc/nsswitch.conf:
hosts: files mdns_minimal [NOTFOUND=return] dns mdns
Test:
ninja1 ~ # ping daniel-pc.local PING daniel-pc.local (10.0.1.11) 56(84) bytes of data. 64 bytes from Daniel-PC.local (10.0.1.11): icmp_req=1 ttl=128 time=3.73 ms 64 bytes from Daniel-PC.local (10.0.1.11): icmp_req=2 ttl=128 time=0.905 ms 64 bytes from Daniel-PC.local (10.0.1.11): icmp_req=3 ttl=128 time=0.922 ms 64 bytes from Daniel-PC.local (10.0.1.11): icmp_req=4 ttl=128 time=0.827 ms
Sending mDNS/DNS-sd
rc-update add avahi-daemon default rc
Service Discovery
Get a list of services on the LAN:
ninja1 ~ # avahi-browse -ac