I tried a lot of things to figure out why my SSH gives me the following message (I am using IP and I took out the IP address)
OpenSSH_8.1p1, LibreSSL 2.7.3 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 47: Applying options for * debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxxxxx] port 22. debug1: connect to address xxx.xxx.xxx.xxx port 22: Operation timed out
I can connect to my VM (on the same machine), a server in my intranet (even inside VPN) without any issues.
But, every time I connect to a server on the internet. I got above message.
- The internet server is working. I use another laptop SSH to the internet server (in the same network). It is working fine.
- I do not have any firewall in my Macbook Pro.
Update1: My /etc/ssh/ssh_config has the following settings. (I did not list comments.)
Host * SendEnv LANG LC_*
Update2: After use telnet xxx.xxx.xxx.xxx 22
My failed macbook showed the following:
Trying xxx.xxx.xxx.xxx... telnet: connect to address xxx.xxx.xxx.xxx: Operation timed out telnet: Unable to connect to remote host
And my working macbook showed
Update3: I did two things. (1) I upgraded to Monterey 12.2. The same issue still occurred. (2) I troubleshoot by executing the following commands. I get responses as follows.
telnet xxx.xxx.xxx.xxx 22 Trying xxx.xxx.xxx.xxx...
telnet xxx.xxx.xxx.xxx 23 Trying xxx.xxx.xxx.xxx... telnet: connect to address xxx.xxx.xxx.xxx: Connection refused telnet: Unable to connect to remote host
ssh -vvv [email protected] -p 200 OpenSSH_8.6p1, LibreSSL 2.8.3 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files debug1: /etc/ssh/ssh_config line 54: Applying options for * debug2: resolve_canonicalize: hostname xxx.xxx.xxx.xxx is address debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/Users/hchang/.ssh/known_hosts' debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/Users/hchang/.ssh/known_hosts2' debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling debug3: ssh_connect_direct: entering debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 200. debug3: set_sock_tos: set socket 3 IP_TOS 0x48 debug1: connect to address xxx.xxx.xxx.xxx port 200: Connection refused ssh: connect to host xxx.xxx.xxx.xxx port 200: Connection refused
I strongly think the port 22 is limited by newer MacOS. I also saw similar complaints from some post. I need to figure out how MacOS is doing on it.
Update4: I got findings as follows.
So, I switched my hosting server to listen to port 8822 and then use my failed Macbook to SSH it. It worked on the port 8822.
To summarize my experiences so far - (1) Changing port from 22 to others working fine. (2) Using port 22 to SSH to "intranet" host working fine. (3) It seemed happening in newer MacOS