This guide explains how to configure WSL2 "Mirror Mode" to allow devices on your local network (like your phone) to access a server running inside WSL2.
Mirror Mode allows WSL to share the same IP address as your Windows host, making networking much simpler.
%USERPROFILE% (usually C:\Users\<YourUser>)..wslconfig.[wsl2]
networkingMode=mirrored
# Ignore virtual or secondary adapters to force WSL to use your primary network
ignoredInterfaces="Ethernet 3"
Note: Replace "Ethernet 3" with the name of any adapter you want WSL to ignore (as seen in ipconfig).
For WSL to read the new configuration, you must restart it:
wsl --shutdown
In your WSL terminal, run:
ip addr show eth0 | grep inet
The IP address should now match your Windows host's physical network IP (e.g., 192.168.1.136).
Even with Mirror Mode, Windows will block incoming traffic from other devices unless you add a rule.
0.0.0.0 (not localhost).http://<YOUR_WINDOWS_IP>:8081
(Example: http://192.168.1.136:8081)--host 0.0.0.0 or equivalent. If it only listens on 127.0.0.1, it will reject external connections.