Skip to main content

Accessing a WSL2 Networking Apps From Your LAN

· 2 min read
Xiaohai Huang

When using a WSL 1 distribution, if your computer was set up to be accessed by your LAN, then applications run in WSL could be accessed on your LAN directly.

However, this isn't the default case in WSL2 as it has a virtualized ethernet adapter with its own unique IP address.


This can be useful for making the application available for other devices on the network, which allows us to debug a web app from mobile devices.


Make the App Accept LAN Connections

When using remote IP addresses to connect to your applications, they will be treated as connections from the Local Area Network (LAN). This means that you will need to make sure your application can accept LAN connections.

For example, you may need to bind your application to instead of

In the example of a Next.js app, this can be done with the command: npx next dev -H

Port Proxy

Here's an example PowerShell command to add a port proxy that listens on port 3000 on the host and connects it to port 3000 to the WSL2 VM with IP address

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

When you restart your PC, the IP address of the WSL2 instance will change, you need to delete the old port proxy and run the command above again. Below shows how to delete the old port proxy which listens on port 3000 on the host.

netsh interface portproxy delete v4tov4 listenport=3000 listenaddress=