I use the Firewalla Purple Firewall/Router. I am unsure if that has anything to do with this issue I often face, but I figured I’d mention it. Also, I’d like to mention that the Firewilla Purple is a fantastic device that I highly recommend. I also use VS Code as my primary text editing application on Mac OS. I was a long-time Sublime user, and just like when I resisted the move from Perl to Python – when I finally made the switch, I was glad I did.
VS Code has a really cool SSH integration that allows you to edit files on a remote server as long as that server provides SSH access.
For some reason (feel free to tell me in the comments), VS Code cannot make successful connections to a remote Mac OS server without being forced to do so over IPv4.
The Problem
As you can see in the image below, VS Code is unable to connect.
Taking a look below at the error in VS Code’s Output pane, it looks like SSH has timed out. I have replaced my actual servername with “myservername“.
[08:12:57.726] > local-server-1> Running ssh connection command: ssh -v -T -D 64542 -o ConnectTimeout=15 myservername [08:12:57.726] > local-server-1> Spawned ssh, pid=45060 [08:12:57.743] stderr> OpenSSH_9.4p1, LibreSSL 3.3.6 [08:13:14.641] Terminating local server [08:13:14.650] Resolver error: Error: Connecting with SSH timed out at g.Timeout (/Users/seth/.vscode/extensions/ms-vscode-remote.remote-ssh-0.108.0/out/extension.js:2:460371) at Timeout._onTimeout (/Users/seth/.vscode/extensions/ms-vscode-remote.remote-ssh-0.108.0/out/extension.js:2:525786) at listOnTimeout (node:internal/timers:569:17) at process.processTimers (node:internal/timers:512:7) [08:13:14.660] ------
The Solution
After a bit of googleing, and trying different things, I found something that worked. Again, not totally sure why this makes a difference, and if you know, please do tell me in the comments, but, the solution was to limit the SSH connection, via the ~/.ssh/config file, to only use IPv4.
A copy of my ~/.ssh/config file is below. Again, I have replaced my actual server name with “myservername“.
Host myservername HostName myservername AddressFamily inet
0 Comments