Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
SOLUTION: sudo apt-get install avahi-daemon –  privatehuff Jan 5 '10 at 20:08
add comment

4 Answers

up vote 5 down vote accepted

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.

share|improve this answer
    
Excellent! Sure enough, desktop karmic included avahi but the jaunty server did not (I have no idea why!) It was as simple as apt-get install avahi-daemon –  privatehuff Jan 5 '10 at 20:07
add comment

Could you check /etc/nsswitch.conf on both machines and the hosts: setting? Are they both the same?

share|improve this answer
    
The server that does not work has only "files dns" in it, the server that DOES work has "files mdns4_minimal [NOTFOUND=return] dns mdns4". Is that significant? –  privatehuff Jan 5 '10 at 20:15
add comment

Also check the "search" line in /etc/resolv.conf

share|improve this answer
    
I have no search line in my resolv.conf, just two nameServer lines. Is that bad? –  privatehuff Jan 5 '10 at 20:13
add comment

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

192.168.1.200 server2

on server2

192.168.1.100 server1

While avahi and other zeroconf tools are useful they are not always something you want to rely on.

share|improve this answer
    
Would setting up a DNS server and adding that to the top of the each servers DNS lists (and centrally assigning the IP's there) be possible and/or preferable ? –  privatehuff Jan 5 '10 at 23:04
    
If you want to go the extra mile assigning static IPs from the DHCP server and then setting up a DNS server would be a good way. However I'd always suggest static IPs for servers as when your DNS server breaks and they lose their lease you tend to walk into the unknown. –  Antitribu Jan 6 '10 at 9:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.