Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 [email protected] 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 [email protected]). 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
add comment

2 Answers

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

OR

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
add comment

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
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.