It is useful in the home network if you don't have a LAN side dns server or your router does not provide that service automatically. The same functionality is provided by Bonjour for Apple products.
Note: This is different than Netbios Name resolution which Samba handles automatically by default.
Preliminaries
Make sure avahi is running:
- Code: Select all
sudo service avahi-daemon status
If it's not running start it:
- Code: Select all
sudo service avahi-daemon start
Note: avahi requires that port 5353/udp is open.
So what can you do with this?
[1] Direct access to another machine by name.
For all machines that have avahi installed you are no longer dependent on LAN side dns servers to resolve host names so one can access another machine though an mDNS qualified ( *.local ) host name everywhere you would normally use the hostname alone or have been forced to use an ip address instead. For example:
ping hostname.local PINGING
nautilus smb://hostname.local SAMBA
nautilus ssh://hostname.local SSH
ipp://hostname.local:631/printers/printer_name REMOTE PRINTER
[2] You can scan the LAN for published services:
** From the terminal:
- Code: Select all
avahi-browse -at | grep IPv4
** Using a GUI:
- Code: Select all
sudo apt-get install avahi-discover
Then in a terminal run:
- Code: Select all
avahi-discover
Once installed avahi-discover will show up in the menu:
XFCE: Menu > System > Avahi Zeroconf Browser
Mint-Gnome: Menu > System Tools > Avahi Zeroconf Browser
[3] You can create your own avahi published services.
Services are published by creating an *.service config file in the /etc/avahi/services directory and they will now appear as a separate item when browsing the network through Nautilus / Thunar. Examples:
[3a] SSH
Once you set up openssh-server create an ssh.service file:
- Code: Select all
gksu gedit /etc/avahi/services/ssh.service
With this content:
- Code: Select all
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h SSH</name>
<service>
<type>_sftp-ssh._tcp</type>
<port>22</port>
</service>
</service-group>
Make sure the first line starts on the first column of the file. It must not have any spaces in front of it.
[3b] Samba Shares
Once you set up Samba shares create a samba.service file:
- Code: Select all
gksu gedit /etc/avahi/services/samba.service
With this content:
- Code: Select all
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h SMB</name> ## Display Name
<service>
<type>_smb._tcp</type>
<port>445</port>
</service>
</service-group>
Make sure the first line starts on the first column of the file. It must not have any spaces in front of it.
Note: In the case of samba it would be better to use the standard samba method and resolve any discovery issues with this HowTo: Samba Browsing Problems Checklist. The samba client is using resources to find the shares anyway so you might as well use it. An avahi announcement of those shares will make it appear faster in nautilus however.
What about Windows?
First, you may already have the capability if you are running applications such as iTunes and Adobe Photoshop on Windows because Bonjour is bundled with it. If not then there is a partial implementation of it available to Windows in the form of the following utility from Apple: Bonjour Print Services for Windows: http://support.apple.com/kb/DL999
That particular utility is used to discover avahi/Bonjour enabled printers but it includes the backends that make avahi announcements and discovery possible. It will run the following service on Windows: Bonjour Service - mDNSResponder.exe. Installing a non native networking application on a Windows box may not be something you want to do but I thought I'd point out that it is available.
And Apple?
OSX has it installed by default and it would appear that all iOS based apple products have it installed by default.

