Ubuntu – How to reach a host in the same network by hostname


I have a network which connects a couple of hosts.
I would like to be able to reach other hosts from one of them using the hostname.
I just discovered the ".local" domain, which is available through avahi and /etc/nsswitch.conf.
But it's not set up this way on my servers.
And I don't want to create an entry in my dns server.
Is there an other way to do so ?

Best Answer

  • Your /etc/nsswitch.conf should already have this for mDNS (avahi):

    hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4

    Just install avahi-daemon on the machines you want talking to eachother, and you should be set to use HOSTNAME.local like this:

    ssh yourmachine.local