I'm running a VirtualBox on a Mac (Catalina) which listens on 192.168.77.6. Normally "ssh user@192.168.77.6" works. "ssh user@host.domain.com" also works, where "host.domain.com" is defined in /etc/hosts as 192.168.77.6. Now turn off WiFi so there's no internet connectivity. The first command, "ssh user@192.168.77.6" still works. But "ssh user@host.domain.com" fails with the message "ssh: connect to host hostname.domain.com port 22: Undefined error: 0". If I then turn on networking via BlueTooth through an iPhone (172.20.10.5), ssh works again. It feels like a DNS problem: DNS fails, and rather than continuing to use /etc/hosts, it just gives an error. This makes it impossible to use ssh for local networks when the Mac has no internet available.
Please capture the debugging output of a failing ssh execution and attach it to this bug. You can run "ssh -vvv user@host"
$ ssh -vvv user@host.domain.com OpenSSH_8.1p1, LibreSSL 2.7.3 debug1: Reading configuration data /Users/cjames/.ssh/config debug1: /Users/cjames/.ssh/config line 46: Applying options for host.domain.com debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 47: Applying options for * debug1: Connecting to host.domain.com port 22. ssh: connect to host host.domain.com port 22: Undefined error: 0
I can't replicate this with OpenSSH 8.2 or HEAD. It looks like you have some configuration in ~/ssh/config that might be relevant - what is in there?
The relevant entry from my ~/.ssh/config file is: Host v-application.emolecules.com User emi IdentityFile ~/.ssh/vagrant The file ~/.ssh/vagrant is an RSA private key file. The host "v-application.emolecules.com" is defined in my Macintosh /etc/hosts file as: $ grep v-application.emolecules.com /etc/hosts 192.168.77.6 v-application.emolecules.com Hope that helps.
I can't replicate this using OpenSSH 8.3p1 on my available Mac hardware: Darwin djm-mba 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64 However I don't see anything that could have caused this bug to be fixed between 8.1 and 8.3p1. Are you using the OpenSSH that Apple ships or one you've compiled yourself? (manually or via macports/brew etc) If you are using the Apple version, I suggest trying to reproduce the problem using a locally built OpenSSH to exclude any modifications they may have made. Otherwise, I recommend capturing a syscall trace from ssh to see where it is going wrong. See https://stackoverflow.com/questions/31045575/how-to-trace-system-calls-of-a-program-in-mac-os-x for some hints here
I'm not able to reproduce this. Please reopen if you can reproduce this using stock OpenSSH built from source.
closing resolved bugs as of 8.6p1 release