Using Avahi
Few people know how much useful avahi could be. You can forget to run ifconfig on the target machines/devices to know the IP, you don’t need a static Ip anymore for those…
You can give to any machine that runs an avahi-server the possibilty to have a DNS like machinename.local.
Installing avahi is quite simple; you just need to run apt-get install avahi-daemon.
After that you can reach that machine over the net using its new domain name.
You can discover them with:
gnuton@joshua:~$ avahi-browse -a
+ vmnet8 IPv4 WOPR [00:50:56:c0:00:08] Workstation local
+ vmnet1 IPv4 WOPR [00:50:56:c0:00:01] Workstation local
+ eth1 IPv4 WOPR [00:1e:c2:be:4e:f6] Workstation local
+ eth1 IPv4 key [00:0d:60:5e:35:ab] Workstation local
In my case I have some virtual nets belong to VMWare and one wireless net on eth1.
These interfaces are using the same domain name: WOPR.local
You can see also that there is another workstation in my net.
Its domain name is key.local. That’s my home server…
What more? Avahi can also publish some services so that they are discoverable in the net.
Use case:
- I want to transfer files with Dolphin for KDE4 using ssh/scp. The target machine doesn’t have a static Ip on my net.
I can get the files that I need just opening Dolphin, clicking on the “Network” icon in the sidebar and then “Network services”.
To make discoverable the ssh service you have to:
copy the config ssh service file in the avahi configuration directory with:
cp /usr/share/doc/avahi-daemon/examples/ssh.service /etc/avahi/services/
and then you have to restart the avahi service with
/etc/init.d/avahi-daemon restart
Then you can check that everything goes okay with avahi-browse-domain utility:
root@key:/etc/avahi# avahi-browse-domains -a
+ eth0 IPv4 joshua [00:1e:c2:be:4e:f6] Workstation local
+ eth0 IPv4 key [00:0d:60:5e:35:ab] Workstation local
+ eth0 IPv4 key SSH Remote Terminal local
Here we are! The new service is in the last line!
Avahi is also available for the Meemo devices. You can install it on your N810/N800 just
running apt-get install avahi-daemon.
Note: An old post says about some problem with at the startup that have been solved.
On your linux box now you have something like this:
root@joshua:/etc/avahi# avahi-browse-domains -a
+ vmnet8 IPv4 joshua [00:50:56:c0:00:08] Workstation local
+ vmnet1 IPv4 joshua [00:50:56:c0:00:01] Workstation local
+ eth1 IPv4 joshua [00:1e:c2:be:4e:f6] Workstation local
+ eth1 IPv4 key [00:0d:60:5e:35:ab] Workstation local
+ eth1 IPv4 key SSH Remote Terminal local
+ eth1 IPv4 Nokia-N810-43-7 [00:1d:6e:9c:00:e8] Workstation local
- eth1 IPv4 Nokia-N810-43-7 [00:1d:6e:9c:00:e8] Workstation local
+ eth1 IPv4 Nokia-N810-43-7 [00:1d:6e:9c:00:e8] Workstation local
- eth1 IPv4 Nokia-N810-43-7 [00:1d:6e:9c:00:e8] Workstation local
+ eth1 IPv4 freaky [00:1d:6e:9c:00:e8] Workstation local
In this report you can see that I restarted 2 times my avahi daemon on the N810 and
the last time I changed the hostname editing /etc/avahi/avahi-daemon.conf
Note: the avahi utils are in a separate package: avahi-utils