0

I’m trying to connect two Machintosh computers using SSH via their hostname. Both computers are running Mac OS X Yosemite 10.10.2. And both computers connected via a Telus branded Actiontec T1200H ADSL Wi-Fi router (PDF of the manual available here).

When running this SSH command with the computer hostname:

ssh macbookpro.local 

I am get the following message:

ssh: Could not resolve hostname macbookpro.local: nodename nor servname provided, or not known 

But if I run an SSH command with the computer’s IP address:

ssh 10.10.1.12 

It works.

And I’ve found out so far that it’s a firewall issue; if I switch firewall off on both computers SSH connection works. But how can I establish SSH connection using computer hostnames while having the firewall enabled? And is it possible at all?

0

2 Answers 2

1

How are these two Macintosh computers connected? Via a router? The way hostnames like macbookpro.local work is they are broadcast on the network via Bonjour which is simply Apple’s fancy name for broadcast/multicast network services:

Bonjour, also known as zero-configuration networking, enables automatic discovery of devices and services on a local network using industry standard IP protocols.

So if these two Macintosh computers are on the same network sharing the same router, if that router is blocking broadcast/multicast network services then the hostname macbookpro.local will not be able to be found since it will be blocked from the router.

The first think I would recommend is that you login to your router—whatever model it might be—and tool around the menus to see of a broadcast/multicast option is set to filter or block broadcast/multicast traffic. But looking at the details on your router—Actiontec T1200H ADSL Wi-Fi router (PDF of the manual available here)—it does not seem there is even a way to block broadcast/multicast network traffic. So my next idea would be to see if somehow there are firewall settings in the Macintosh’s themselves getting in the way of Bonjour not working? Might be worth it to disable the firewall to at least test the theory for now.

Looking at the firewall options I have in my Mac OS X 10.9.5 (Mavericks) install, it seems that unchecking the “Block all incoming connections” checkbox while the firewall is enabled will allow your firewall to be active while still allowing Bonjour services to be passed through to the system.

When the firewall is on click on the “Firewall Options…” button and you will see this screen with that “Block all incoming connections” checkbox:

enter image description here

On a related note, you can debug this stuff—as explained in this answer I posted here—by testing the network with arp and dns-sd from the Mac OS X “Terminal” like this. For example, to use arp to see what devices are on the network just type in this command and hit return:

arp -a 

The output returned if broadcast/multicast traffic is being sent to your computer would be something like this:

computer-name.local (123.456.789.0) at 00:aa:bb:cc:dd:ee on en0 ifscope [ethernet] ? (192.168.2.2) at bb:88:99:cc:77:aa on bridge100 ifscope [bridge] 

That shows me that computer-name.local has an IP address of 123.456.789.0 and the bridged connection used by the ad-hoc network where I am sharing my Ethernet connection via Wi-Fi is 192.168.2.2.

And you can also use dns-sd (Multicast DNS (mDNS) & DNS Service Discovery (DNS-SD) Test Tool) from the “Terminal” like this to see if your computer is picking up the hostname of the other machine:

dns-sd -q [name of computer].local 

This assumes you know the name of the computer already and broadcast/multicast is working; replace [name of computer].local with that computer name. Then the output would be something like this; note the 123.456.789.0 is a fake IP address for example’s sake:

 Timestamp A/R Flags if Name Type Class Rdata 19:56:22.856 Add 2 4 [name of computer].local. Addr IN 123.456.789.0 
7
  • Hi! Thank you very much for your reply! Computers are connected via wi-fi router which also gives me internet (If I understand it right))) arp -a gives me no computer names - only ? and IPs.. and dns-sd -q macbookpro.local gives me : DATE: ---Fri 27 Feb 2015--- 20:28:58.319 ...STARTING... So I think you are right! But it's kinda not clear what's wrong with router settings Commented Feb 28, 2015 at 4:34
  • the router I've got from Telus. Actiontec model: T1200H. I've logged in but there is no "broadcast/multicast traffic" option. Commented Feb 28, 2015 at 4:58
  • It says: Firewall - NAT only (no clue what does that mean), Blocking/Filtering - Disabled; UPnP (WTF?) - Enabled Commented Feb 28, 2015 at 5:15
  • I also have another device connected to router - to give me 5G speed (As I understand there are no routers so far which can give 5G without this additional device - not sure how does it called), but there is no such an option in it neither...((( Commented Feb 28, 2015 at 5:24
  • 1
    Well - I've tried to disable firewalls on both machines and now it works!!! But wait - wth???? It worked before even with firewall switched on! Should I disable it any time before I want to use ssh??? It's not normal.. Commented Feb 28, 2015 at 5:34
0

macbookpro.local is probably your LocalHostName; 1 of the 3 computer names used by Mac OS X (HostName, LocalHostName and ComputerName). If I remember correctly, it’s used for either Bonjour or AFP.

ssh on the other hand uses the IP protocol and is not Mac OS X specific. It will attempt to resolve your “hostname” with DNS. You can find your hostame by using the following command:

scutil --get HostName 

or simply:

hostname 

Conversely, you can also use localhost if you're connecting back to your own computer.

1
  • thank you for reply but it's kinda useless... I know this: ComputerName -- User-friendly name for the system (in System Preferences -> Sharing -> Computer Name) LocalHostName -- The local (Bonjour) host name (in System Preferences -> Sharing -> press 'Edit') HostName -- Can see it in Terminal prompt (\h or \H) Associated with hostname and gethostname. And you are wrong -- Local Host Name is the one you need to use with ssh Commented Feb 28, 2015 at 4:19

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.