You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WSL2 - Access running server from other computer within same network #4523
I have dnsmasq running on my router which points all *.local domains to my Windows 10 machine, which has a fixed DHCP-address like 192.168.1.100.
Previously, when I used Docker for Windows with WSL1 (exposed deamon), I could access a running nginx-server from any device within my wireless network with http://project1.local, etc...
In WSL2 this does not work anymore, even that I've modifed my Windows 10 hosts file to point project1.local to the eth0 address, which is 172.25.21.243 of the WSL2 instance.
So my Windows 10 hosts file looks like this:
172.25.21.243 project1.local project2.local
I can't even access the server via http://192.168.1.100
Any suggestions how to make a server which is running inside WSL2 accessible from any other device on the same network as the Windows 10 machine?
Can use #4150 as the LZ. The localhost feature will help on 127.0.0.1 but does not resolve to non-localhost IP addresses even if you are on the same physical machine. Short story, there is no IP forwarding.
Activity
archilkarchava commentedon Sep 22, 2019
#4150 (comment)
You can use this script to forward ports and then you can just use your
192.168.1.100-like address.ad-on-is commentedon Sep 23, 2019
Archil Karchava (@archilkarchava) I thought this workaround was obsolete since they added "localhost" to WSL 2 in one of the latest releases
archilkarchava commentedon Sep 23, 2019
Adis Durakovic (@ad-on-is) It's not obsolete, since you still have to forward the ports to expose them to your local network.
therealkenc commentedon Sep 28, 2019
Can use #4150 as the LZ. The localhost feature will help on 127.0.0.1 but does not resolve to non-localhost IP addresses even if you are on the same physical machine. Short story, there is no IP forwarding.