ssh "Temporary failure in name resolution"

I am attempting to ssh into a lab computer using Ubuntu WSL and a VPN, and I have been receiving this error:

ssh: Could not resolve hostname labname.socsci.uniname.edu: Temporary failure in name resolution (The actual hostname is different from labname.socsci.uniname.edu, and I have changed this for privacy reasons).

I find this strange because 2 months ago, I was able to successfully ssh into this computer via Ubuntu after connecting to a VPN using: ssh . I am lost on why has stopped working even though I am following the same "procedure."

A couple of things I have tried:

  • uninstalling then reinstalling Ubuntu 20.04.4 LTS
  • uninstalling then reinstalling the VPN
  • uninstalling Ubuntu 20.04.4 LTS then installing Ubuntu 18.04.6 LTS

I have also tried restarting my computer to no avail. The only other possibility I can think of is I have been incorrectly typing in the hostname, but this is very improbable given that I have checked that I have the name precisely typed out ~6 times. (As a side note, others have been able to successfully ssh into the lab computer. So, this seems like a problem that is just on my end).

Any help or pointers would be very much appreciated.

My question is very similar to the question that @matigo posted 6 months ago: Temporary failure in name resolution in ssh command, but there doesn't seem to be an answer to this post (and I cannot comment because I currently do not have enough points).

3

1 Answer

There are a few reasons that I can think of why it might have worked in the past, but no longer be working now:

  • First, you might have been using WSL1 before and recently upgraded to WSL2. WSL2 uses a virtual network that is separate (and isolated) from the Windows network. When you connect the VPN in Windows, the WSL2 network is not connected to it. In the worst case, the WSL2 network can be disabled entirely by VPN connections.

  • Second, there could have been a change in the VPN settings to tighten security. Some VPN software lets you continue to access local network resources (like WSL2) when connected. Other VPNs (as mentioned above) disable access to the local network for security and send all traffic through the VPN when connected. Perhaps the network administrators changed that setting. If that's the case, then it's likely that you don't have any control over it.

Recommendation: For the simple use case of ssh, use WSL1. It will typically work while connected via VPN since it shares the same network infrastructure with Windows. You can either set up a new WSL1 instance or convert your existing WSL2 to WSL1.

I prefer keeping both WSL1 and WSL2 around for this reason. There are a few cases where WSL1 is preferred, and those where WSL2 works better.

Whether you create a new WSL1 instance or convert, I recommend starting with:

PowerShell:

wsl -l -v
# Confirm that the WSL distribution name is "Ubuntu". Modify the next line if needed
wsl --export testtest $env:USERPROFILE\Downloads\ubuntu_backup.tar
# You can also modify the output folder and filename, of course

Then, if you want to convert:

wsl --set-version Ubuntu 1

If you want to copy:

Also from PowerShell

# Modify directory and instance name as desired
mkdir -p C:\WSL\instances\UbuntuWSL1
wsl --import UbuntuWSL1 C:\WSL\instances\UbuntuWSL1 $env:USERPROFILE\Downloads\ubuntu_backup.tar --version 1
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like