go-wsl2-host icon indicating copy to clipboard operation
go-wsl2-host copied to clipboard

Everything works fine... Until router port forwarding

Open ar065 opened this issue 5 years ago • 1 comments

Everything seems to work fine up until port forwarding with my router. I ran the same code hosting a websocket server on port 8443, I could easily access it through the port forwarding from my router when I was just running it on windows, however, when running that same code on ubuntu 20.4 with wsl2, I cannot access to the websocket server on port 8443.

ar065 avatar Jun 03 '20 22:06 ar065

Hate to say it, but this is what I'd have expected to happen. All this is doing is updating the hosts file on your machine, it's not doing any of the routing itself. Windows uses the hosts file to map host names to ip addresses for local requests to external hosts.

To do what you're expecting to happen, you'd need a router on your windows machine that could accept inbound port requests from port 8443 and then forward them to the wsl instance based on the host lookup. Alternatively, you'd need something that published the wsl VM's IP address to your router and then have the router port forward to that address instead.

These are not the droids you're looking for . . .

rakker91 avatar Jun 04 '20 21:06 rakker91