3

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?

1
  • SOLUTION: sudo apt-get install avahi-daemon Jan 5, 2010 at 20:08

4 Answers 4

5

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.

1
  • 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 Jan 5, 2010 at 20:07
1

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

2
  • 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? Jan 5, 2010 at 20:15
  • This is really a comment, not an answer. With a bit more rep, you will be able to post comments. For the moment I've added the comment for you, and I'm flagging this post for deletion. Aug 8, 2017 at 5:09
1

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

2
  • I have no search line in my resolv.conf, just two nameServer lines. Is that bad? Jan 5, 2010 at 20:13
  • This is really a comment, not an answer. With a bit more rep, you will be able to post comments. For the moment I've added the comment for you, and I'm flagging this post for deletion. Aug 8, 2017 at 5:09
0

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.

2
  • 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 ? Jan 5, 2010 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, 2010 at 9:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .