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:
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
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
#
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.
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:
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
Change the host-name entry. In the following example, the hostname is changed to DT7837-proto:
[server]
host-name=DT7837-proto
#domain-name=local
Save the file.
Restart the avahi-daemon by entering the following command:
#
service avahi-daemon restart
[ ok ] Restarting Avahi mDNS/DNS-SD Daemon: avahi-daemon.
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:
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>
Save the file.
Restart the avahi-daemon by entering the following command:
#
service avahi-daemon restart
[ ok ] Restarting Avahi mDNS/DNS-SD Daemon: avahi-daemon.
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]