This is an reversal of this question. Strangely I haven't been able to find cases of people wanting to connect to a remote machine from their WSL instance.
In my case, I have a Raspberry Pi whose hostname is rasppi.local
, and I'm trying to SSH into it via my WSL Ubuntu instance, but getting a "Temporary failure in name resolution" issue.
What has been tried so far:
ssh [email protected]
from the Windows machine hosting WSL works fine (Powershell);ssh [email protected]
from WSL in the Windows machine fails (Ubuntu);ssh username@<rasppi IP>
from both the Windows machine and WSL work;ping <rasppi IP>
from the Windows machine and WSL work and all packets are retrieved without any loss;ping superuser.com
from both the Windows machine and WSL work.
Output for ssh [email protected] -vvv
The output for ssh [email protected] -vvv
in WSL is as follows:
OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolving "rasppi.local" port 22
ssh: Could not resolve hostname rasppi.local: Name or service not known
Output for ping superuser.com
In Windows Powershell:
PING superuser.com [151.101.129.69] 32 bytes of data:
Response from 151.101.129.69: bytes=32 time=6ms TTL=54
In WSL:
PING superuser.com (151.101.129.69) 56(84) bytes of data.
64 bytes from 151.101.129.69 (151.101.129.69): icmp_seq=1 ttl=54 time=5.59 ms
Output for ip addr
In WSL:
21: eth0: <> mtu 1500 group default qlen 1
link/ether 02:50:f2:69:1d:00
20: eth1: <> mtu 1500 group default qlen 1
link/ether 34:73:5a:e0:07:3f
inet 169.254.28.69/16 brd 169.254.255.255 scope global dynamic
valid_lft forever preferred_lft forever
inet6 fe80::b2ff:c07f:aa77:2b0b/64 scope link dynamic
valid_lft forever preferred_lft forever
1: lo: <LOOPBACK,UP> mtu 1500 group default qlen 1
link/loopback 00:00:00:00:00:00
inet 127.0.0.1/8 brd 127.255.255.255 scope global dynamic
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host dynamic
valid_lft forever preferred_lft forever
9: wifi0: <BROADCAST,MULTICAST,UP> mtu 1500 group default qlen 1
link/ieee802.11 00:d7:6d:09:8c:7e
inet 192.168.0.22/24 brd 192.168.0.255 scope global dynamic
valid_lft 2853sec preferred_lft 2853sec
inet6 2804:14c:1d9:870e:65ac:2928:291f:6c96/64 scope global dynamic
valid_lft 86283sec preferred_lft 71883sec
inet6 2804:14c:1d9:870e:6415:bdaa:71ef:128e/128 scope global dynamic
valid_lft 86283sec preferred_lft 71883sec
inet6 fe80::7a77:b29:df4a:a9c5/64 scope link dynamic
valid_lft forever preferred_lft forever
11: wifi1: <> mtu 1500 group default qlen 1
link/ieee802.11 00:d7:6d:09:8c:7f
inet 169.254.41.240/16 brd 169.254.255.255 scope global dynamic
valid_lft forever preferred_lft forever
inet6 fe80::d936:f662:1d15:c5ad/64 scope link dynamic
valid_lft forever preferred_lft forever
10: wifi2: <> mtu 1500 group default qlen 1
link/ieee802.11 02:d7:6d:09:8c:7e
inet 169.254.0.167/16 brd 169.254.255.255 scope global dynamic
valid_lft forever preferred_lft forever
inet6 fe80::84fb:86e5:80a3:cf38/64 scope link dynamic
valid_lft forever preferred_lft forever
Output for route
In WSL:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
127.0.0.0 0.0.0.0 255.0.0.0 U 256 0 0 lo
127.0.0.1 0.0.0.0 255.255.255.255 U 256 0 0 lo
127.255.255.255 0.0.0.0 255.255.255.255 U 256 0 0 lo
224.0.0.0 0.0.0.0 240.0.0.0 U 256 0 0 lo
255.255.255.255 0.0.0.0 255.255.255.255 U 256 0 0 lo
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 wifi0
192.168.0.22 0.0.0.0 255.255.255.255 U 256 0 0 wifi0
192.168.0.255 0.0.0.0 255.255.255.255 U 256 0 0 wifi0
224.0.0.0 0.0.0.0 240.0.0.0 U 256 0 0 wifi0
255.255.255.255 199.262.0.1 255.255.255.255 U 0 0 0 wifi0
0.0.0.0 199.262.0.1 255.255.255.255 U 0 0 0 wifi0
Note that pinging the Raspberry Pi IP's directly works in both Powershell and WSL, so it most likely is a SSH configuration within WSL.
What is missing here in order to connect using the hostname rasppi.local
?
In case it's relevant, I'm trying to set up a Taskserver client in the WSL instance, while the server remains in the Raspberry Pi. I could set it a client directly in the Pi and then access via SSH on Powershell, but it seems sub-optimal given that the Pi should be used as a server only. If someone thinks otherwise, I'd appreciate info as this is my first time dealing with networking and servers. 🙂
Temporary failure in name resolution
implies to me that you should try the IP address first, get that working then go to a different problem which would be name resolution. Perhaps I am not understanding the problem properly (wouldn't be the first time).superuser.com
, from WSL? Can you resolverasppi.local
from Windows?ssh.exe
. Try also to specify the port (-p
).ping superuser.com
from WSL. Does it successfully resolve the name to an IP address? (The actual ping is not relevant.) How does the Raspberry Pi get its IP address and name? Static configuration? DHCP? Show the IP address of the Raspberry Pi and the output ofip addr
androute
in WSL.