Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

If I'm using Ubuntu or Linux Mint (the only two flavours I've tried and know work for sure), I can run something like this:

wayne@myhost$ ssh wayne@otherhost.local

And the name is automagically resolved to whatever the IP of otherhost is on my local network.

I've decided to start branching out into other distros, and I've got Arch running on my laptop - but if I try using the previous command I get Could not resolve hostname otherhost.local: Name or service not known

What does it take to get this sort of automatic name resolution(?) to take place?

share|improve this question
1  
You have to install avahi as well as nss-mdns - for more details have a look at the arch wiki –  Ulrich Dangel Jul 23 '12 at 14:20
add comment

2 Answers 2

Thanks to the pointer to the Arch Wiki article on Avahi from Ulrich Dangel, this is what I did:

  1. Install avahi and nss-mdns $ sudo pacman -S avahi nss-mdns
  2. Add /etc/rc.d/avahi-daemon start to the end of rc.local
  3. Since I'm running dhcpcd, in /etc/dhcpcd.conf I commented out the noipv4ll line.
  4. I also ran $ sudo /usr/sbin/avahi-autopid -D wlan0. Since I don't like restarting, I'm not sure if step 3 was necessary.
  5. In /etc/nsswitch.conf I set the line to read hosts: files mdns4_minimal dns mdns4.
  6. Then I ran $ sudo /etc/rc.d/dbus restart to restart dbus.

After that, simply doing ssh wayne@other.local just worked.

share|improve this answer
    
Regarding your second point: You might as well just add "avahi-daemon" to the DAEMONS line in /etc/rc.conf –  Wieland Jul 23 '12 at 16:31
    
I thought about that, but the wiki indicated that some people had issues with it starting too quick in rc.conf and failing as a result, and that placing it where I did was a fix. –  Wayne Werner Jul 24 '12 at 2:25
add comment

I do not think we need avahi-daemon running to use .local. Here's is what I have for in my startup script. This is much simpler compared to the Arch Wiki's method.

systemctl enable avahi-daemon
avahi-set-host-name $(hostname)
systemctl disable avahi-daemon
share|improve this answer
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.