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
Code: Select all
sudo service avahi-daemon start
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
Code: Select all
sudo apt-get install avahi-discover
Code: Select all
avahi-discover
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
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>
[3b] Samba Shares
Once you set up Samba shares create a samba.service file:
Code: Select all
gksu gedit /etc/avahi/services/samba.service
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>
What about Windows?
EDIT: Windows 10 now has a partial implementation of this protocol. Please see: http://forums.linuxmint.com/viewtopic.php?f=42&t=199907
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
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.
That particular utility is used to discover avahi/Bonjour enabled printers but it includes the back-ends that enable it to access and be accessed by hostname.local queries. You cannot browse to or be browsed for services in Windows but what you can do for example is:
From Linux connect to a Windows SMB server and then Bookmark that location:
Code: Select all
nemo smb://windows-host-name.local
Code: Select all
\\linux-host-name.local
OSX has it installed by default and it would appear that all iOS based apple products have it installed by default.
Updated to expand the Windows section.