Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to connect from my server to my macbook thru ssh but I cannot find its hostname on the network. I enabled Remote Login in System Preferences > Sharing and my mac claims that:

Computers on your local network can access your computer at: macbook.local

Yet when I try to connect via ssh wdkrnls@macbook.local it tells me:

ssh: Could not resolve hostname macbook.local: Name or service not known

But I can ssh into it when I type in the given IP address (ie. ssh wdkrnls@ The trouble is that this IP address changes and I want to add a remote git repository over ssh, so this won't do. What am I missing?

share|improve this question
up vote 3 down vote accepted

What OS is your server? If it's not Mac OS X then you need to install Avahi and set the following in /etc/nsswitch.conf

hosts:    files dns mdns


hosts:    files mdns_minimal [NOTFOUND=return] dns mdns 
share|improve this answer
I'm using Archlinux on my server and I added the lines from the Arch wiki entry for avahi into /etc/nsswitch.conf and it worked! Thanks a bunch! – wdkrnls Jan 29 '11 at 20:37

What operating system is your server running? It needs to support Bonjour aka mDNS, the technology that powers the .local hostname. You can find out more about mDNS here. There are a variety of mDNS implementations for UNIX, Linux, and Windows. I recommend both Apple's mDNSResponder and the open-source Avahi deamon for Unix-like systems.

If you already have mDNS on your server, then I'd recommend looking at your network setup. mDNS cannot be used across certain VPN systems including L2TP/IPsec, nor can it he used across different subnets. The mDNS homepage has configuration directions to set up Wide-Area mDNS, which requires the use of a nameserver, but I have not succeeded with such efforts.

A simpler and easier approach might be to give your MacBook a static IP address. Most routers allow you to assign static IPs using either DHCP client IDs or the interface's MAC address.

I've been wrangling a few mDNS issues recently myself.

share|improve this answer

You must log in to answer this question.

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