I'm supporting a coworker who recently upgraded his MacBook Pro to High Sierra from Sierra. He's trying to connect to one of our boxes in the field via ssh. The box in question has an IPv6 address.

The ~/.ssh/config file is empty and the ssh keys haven't changed. The /etc/ssh/ssh_config file is the default installed on the MBP. Dig works just fine and reports the proper IPv6 address of the box. Ping6 also works as expected. He can connect to our in-house git server, which is published via DNS with an IPv4 address, and push/pull without issue.

When I get him to ssh to the box, like so:

ssh user@hostname

The connection fails with:

ssh: Could not resolve hostname [hostname]: nodename nor servname provided, or not known

Adding -vvvv to ssh produces the following output:

ssh -vvvv [hostname]
OpenSSH_7.6p1, LibreSSL 2.6.2
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to [hostname] port 22.
ssh: Could not resolve hostname [hostname]: nodename nor servname provided, or not known

If he connects to the appliance using the IPv6 address, the connection succeeds and he can login.

Our DNS servers are properly configured and serving addresses as expected. I'm on an MBP with Sierra and I'm having no issues connecting. Also, our group all uses Macbooks of various vintages and OS flavors (no other High Sierra users) and, so far, he's the only one experiencing this issue.

EDIT: We tried the solution presented here. But, Apple's System Integrity Protection got in the way. I'm not about to turn it off at this point. I'd like to leave that as a last resort.

  • Without knowing more about the unresolvable hostname, it's really hard to tell what might be the problem. Is it in /etc/hosts, is it in DNS (global or local), is it a .local (Bonjour) name, should it resolve to an IPv4 or IPv6 address or both... – Gordon Davisson Dec 22 '17 at 20:56
  • The hostname, let's call it appliance1 (eg. appliance1.example.com), should resolve to an IPv6 address only (AAAA record). There are no A records (IPv4) on this particular network segment. It's not in /etc/hosts on the MBP (which should only contain localhost entries). The host entry is in a BIND-style dns file that is pushed to AWS and three geographically separated dns servers on our network and served via nsd3. It is not a .local name, as it's part of a larger, routable network that contains multiple hosts. – jrogers63 Dec 22 '17 at 21:03
  • I should also mention that the issue, per my answer below, seems to be confined to Apple's implementation of ssh, as openssh installed via brew is unaffected. At some point in the future (time permitting), I plan on doing a tcpdump to see if I can find any network oddities with Apple's ssh implementation. – jrogers63 Dec 22 '17 at 21:04

Here's a work around that helped in this case:

# install openssh from brew
brew install openssh

# /usr/local/sbin shouldn't be writable on High Sierra (by default), 
# so brew will fail to link the ssh binary

brew unlink openssh
ln -s /usr/local/Cellar/openssh/<version of openssh>/bin/ssh /usr/local/bin/ssh

That linked a version of ssh that's usable. My coworker is now able to connect as expected. Since there are now two versions of ssh on his mac, it's important to make sure that the openssh version installed via brew is found on the PATH first, eg.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.