I set up my Ubuntu WSL instance and am running an SSH server on it. However, when I do ifconfig on the Ubuntu console, my Ipv4 is, which is different from my regular machine's ipv4

While I am able to SSH into my WSL instance using ssh localhost or ssh from the same machine, using ssh doesn't work. When I try to do ssh from another computer on the same network it says that the connection timed out.

How can I SSH into an OpenSSL server running on my WSL instance from another device on the network?

Here is my network information:

enter image description here

enter image description here

  • 3
    Here are instructions to acomplish what you are attempting to do.
    – Ramhound
    Apr 23, 2022 at 22:14
  • @Ramhound It doesn't work. This is basically what I did in the question and it worked only from local machine from windows, but did not work from another machine on the same network. The 172.*.*.* ip wasn't visible from outside the computer. However, when the SSH server was running on Windows and not WSL, it connected successfully, (using the parent computers ipv4), so its not the network issue
    – Victor2748
    Apr 23, 2022 at 22:32
  • 2
    You did read the article completely, right? The second to last section contains what you need.
    – Daniel B
    Apr 23, 2022 at 22:34
  • Oh thank you for noticing @DanielB
    – Victor2748
    Apr 23, 2022 at 23:29
  • 2
    I honestly had no idea that WSL2 wasn't even accessible from the network. I'm spoiled by WSL1 it seems. True kernel integration ftw.
    – Dev
    Apr 25, 2022 at 13:28

3 Answers 3


You need to run the following command:

netsh interface portproxy add v4tov4 listenport=4000 listenaddress= connectport=4000 connectaddress=

Source: Accessing a WSL 2 distribution from your local area network (LAN)

  • @ThorbjørnRavnAndersen - Yes; It's necessary to do so when using the method described in the support article.
    – Ramhound
    Apr 24, 2022 at 21:34

Since your WSL2 address changes on each reboot, the address that you'll need to forward to changes each time. If you use the "forwarding" method described in the Microsoft docs, you will need to:

  • Delete previous forwarding rules on each reboot (best practice, at least, to avoid leaving numerous old forwarding rules in place)
  • Forward to the new WSL2 address after each reboot (or wsl --shutdown)

Update Note: The following will no longer work with recent WSL releases installed from the Microsoft Store. It is left here for historical purposes, and in case the SSH feature is eventually fixed in a newer WSL release.

My preference is to instead run the SSH server in Windows (it's built in to Windows 10 and 11 now anyway -- See the installation instructions). Once you have that configured, you can easily SSH into a WSL session with:

ssh -t "wsl ~"

That also gives you a lot more control, like the ability to log in remotely as root:

ssh -t "wsl ~ -u root"

Or a different distribution with:

ssh -t "wsl ~ -d Debian"

More options (which don't require forwarding) in this answer.


Honestly I had never heard of WSL before but it does from my experience (without reading anything on WSL, but I know a decent amount about Linux and Windows), what you are doing seems like the hard way. Why configure it on the Linux side. I am assuming that you can see the WSL Network driver in Windows, and if so, do two things. 1) bridge that network with your internet connection by holding control and clicking both of them and then right clicking on either and click "Bridge", then 2) try to change the assigned IP address in the driver to one on your subnet for example. At this point, you should be able to ssh directly to I appologize if I have the wrong procedure here it has been a minute since I did all that, but since I did not see the "use Windows to configure" suggestion I thought I would chime in. If anyone knows the procedure better than me please chime in (even if I am wrong I don't mind being told that - it may save me some time doing something in the future :)

  • 1
    That would be nice, but it just won't work. The WSL2 Hyper-V-based virtual machine is "managed" (a.k.a. not user accessible) and that includes the networking. So no, unfortunately you can't see the WSL interface in Windows to bridge it like you would other interfaces. However, there is a beta feature in newer WSL releases that allows you to specify a different Hyper-V switch for WSL that is supposed to be able to be bridged. This blog post is the best write-up I've seen on the topic, but I haven't tried it myself. Oct 8, 2022 at 1:21

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.