One of the recurring annoyances with WSL 2 is that a Linux service can be working perfectly inside the VM and still not be reachable the way you expect from outside the host.
This note came from the simple case: I wanted SSH access into a WSL 2 environment on Windows 10, and the missing piece was not the Linux service. It was the Windows networking glue around it.
The Basic Idea
The pattern is:
- run SSH inside WSL 2 on a known port
- forward a Windows listening port to the current WSL 2 IP address
- open the Windows firewall for that port
Port Proxy Rule
The core Windows command was:
| |
The important thing to remember is that the connectaddress is the current WSL 2 IP, not some permanent host identity. That means if the WSL 2 address changes, the forwarding rule may need to be updated.
Firewall Rule
Then allow the port through Windows Firewall:
| |
Verify the Rule
To inspect the configured proxy rules:
| |
And if I needed to wipe the forwarding rules and start over:
| |
Why This Note Matters
This is the kind of thing that can feel obvious after you have done it once, but only after. Before that, it is easy to waste time poking at the SSH daemon inside WSL when the real problem is that Windows is not forwarding anything to it yet.
Closing Thought
This is not really an SSH article. It is a reminder that WSL 2 is still a virtualized network boundary. If you want external reachability, you need to account for the Windows side of that boundary too.