Using Zero Config and Avahi with the DT78xx

Zeroconf, short for Zero configuration networking technology, automates configuration of network services shared among computers, printers, and other devices connected to a common LAN. With Zeroconf, any host offering a service can advertise its wares to all takers on the LAN, and any computer can easily discover published services and connect to them.

Avahi implements Zeroconf for Linux.

This page describes the following aspects of using Avahi with the DT78xx:

Installing Avahi on the DT78xx

You can use the Avahi service on the DT78xx modules by installing the avahi-daemon package. Note that Avahi expects the firewall to permit multicast traffic for group 224.0.0.251 on port 5353.

To confirm that Avahi is installed on the DT78xx, use the following command:

# dpkg -s avahi-daemon

Checking the Status of the Avahi Daemon

To check the status of the Avahi daemon, enter the following command:

# ps -A x |grep avahi
1864 ? S 0:24 avahi-daemon: running [dt8875.local]
1865 ? S 0:00 avahi-daemon: chroot helper

Starting and Stopping the Avahi Daemon

You can start and stop the Avahi daemon using these commands:

# service avahi-daemon stop
[ ok ] Stopping Avahi mDNS/DNS-SD Daemon: avahi-daemon.
# service avahi-daemon start
[ ok ] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon.

Configuring the Hostname for the DT78xx in Avahi

The configuration file for Avahi is /etc/avahi/avahi-daemon.conf on the DT78xx module.

To change the host name advertised by the DT78xx module, perform the following steps:

  1. Open the file  /etc/avahi/avahi-daemon.conf using an editor of your choosing. The following example uses the vi editor:

#vi /etc/avahi/avahi-daemon.conf

  1. Change the host-name entry. In the following example, the hostname is changed to DT7837-proto:

[server] host-name=DT7837-proto
#domain-name=local

  1. Save the file.

  2. Restart the avahi-daemon by entering the following command:

# service avahi-daemon restart
[ ok ] Restarting Avahi mDNS/DNS-SD Daemon: avahi-daemon.

Registering a New Service in Avahi

The avahi-daemon publishes local services corresponding to .service files under the directory /etc/avahi/services. File /usr/share/avahi/service-types lists service types.

To register a new service, perform the following steps:

  1.  Create a .service file for the new service. For example, to advertise web services of the Apache server in the DT78xx module, create the file /etc/avahi/services/http.service with the following content:

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<!-- This advertises the DT7837 web server -->
<service-group>
 <name replace-wildcards="yes">%h My Web Application </name>
  <service>
   <type>_http._tcp</type>
   <port>80</port>
  </service>
</service-group>

  1. Save the file.

  2. Restart the avahi-daemon by entering the following command:

# service avahi-daemon restart
[ ok ] Restarting Avahi mDNS/DNS-SD Daemon: avahi-daemon.

Note that the default port 80 is for the Apache2 web server that is installed and running by default. To advertise the services of a different web server bind it to a port other than 80, such as 8080, and change the port parameter in the file  /etc/avahi/services/http.service to the same value.

Discovery on the LAN

To browse Zeroconf services available on the LAN, use the utilities installed by the package avahi-utils on any Linux system that is on the same network as the DT78xx module.

The following command discovers the DT78xx identified by the Avahi hostname.

# avahi-resolve-host-name -4 dt7837-proto.local
DT7837-proto.local192.168.1.101
# avahi-resolve-host-name -6 dt7837-proto.local
DT7837-proto.localfe80::caa0:30ff:feab:7150

The following command discovers the web server advertised by the DT78xx Avahi services configuration.

# avahi-browse -t -r -l -a | grep -i dt7837
+  eth0 IPv6 DT7837-proto My Web Application   Web Site  local
+  eth0 IPv4 DT7837-proto My Web Application   Web Site  local
=  eth0 IPv6 DT7837-proto My Web Application   Web Site  local
hostname = [DT7837-proto.local]
=  eth0 IPv4 DT7837-proto My Web Application   Web Site  local
hostname = [DT7837-proto.local]