I have two servers and one seems to have configured something "out of the box" to allow "ssh servername.local" to work. I really like this and looked into it, but I don't see any difference in their configurations.
server1: (ssh by name works)
$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 server1
server2: (ssh by name does not work)
$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 server2
server1.local connects fine, server2.local gets this response:
ssh: Could not resolve hostname server2.local: Name or service not known
I have done nothing to set up DNS, and the revolv.conf files of both servers are the same.
server2 is running ubuntu server 9.04 32-bit (jaunty), and server1 is running ubuntu desktop 9.10 64-bit (karmic).
Can anyone tell me where I should look to see what is different, and why it works on one but not the other?
Avahi needs to be running on both machines. Its the daemon that provide mDNS services.
root@rilindo-desktop:~# ps -ef | grep avahi avahi 903 1 0 Jan01 ? 00:00:05 avahi-daemon: registering [rilindo-desktop.local] avahi 904 903 0 Jan01 ? 00:00:00 avahi-daemon: chroot helper root 18206 15276 0 11:23 pts/2 00:00:00 grep avahi
Assuming that port 5353 is not filtered/blocked on the machines, you'll need to validate avahi's configuration.
Could you check /etc/nsswitch.conf on both machines and the hosts: setting? Are they both the same?
Also check the "search" line in /etc/resolv.conf
As not to rely on random agreement of naming can you not set static IPs on the servers and then add their respective entries into the other machines hosts file? eg
on server1
on server2
While avahi and other zeroconf tools are useful they are not always something you want to rely on.