How can you access WSL 2 distribution from your LAN?

Experience Level: Junior
Tags: WSL

Answer

In WSL 1 distribution, the applications run in WSL could be accessed on your LAN out of the box.

In WSL 2, the virtualized ethernet adapter has its own IP address, so to access an app in WSL 2 from Windows, you need to configure the proxy mapping:

netsh interface portproxy add v4tov4 listenport=1433 listenaddress=0.0.0.0 connectport=1433 connectaddress=192.168.224.1

The connectaddress is the IP of the WSL machine.

Comments

No Comments Yet.
Be the first to tell us what you think.
Windows Subsystem for Linux (WSL)
Windows Subsystem for Linux (WSL)

Are you learning WSL ? Try our test we designed to help you progress faster.

Test yourself