5 ms·
Is it still amazingly complicated to start a server in WSL 2 that is visible on the LAN?
by jahnu 4y ago
Is it still amazingly complicated to start a server in WSL 2 that is visible on the LAN?
- matsemann 4y agoOn localhost it's available by default on Windows side. If you'd like to access it by your machine's IP from a different machine on the LAN, you just need to run a single command to add a proxy for it. netsh interface portproxy add v4tov4 listenport=8001 listenaddress=0.0.0.0 connectport=8001 connectaddress=172.24.75.111 where connectaddress is whatever you get from running ifconfig on wsl side. Edit: Might also use localhost instead of IP as the connectaddress, as the IP might change. Depends on what your server software handles of bindings. Depending on your machine configuration, you might need to open the port in your firewall as well, ala netsh advfirewall firewall add rule name="Allowing connections on 8001" dir=in action=allow protocol=TCP localport=8001
- glitchc 4y agoKudos! This should be an answer to a StackOverflow question somewhere so that a broader audience can find it.
- matsemann 4y agoKudos should go to the SO question that showed me it, then ;) But for some reason hidden under RoR. https://stackoverflow.com/a/66485783/923847 https://stackoverflow.com/a/66485783/923847
- jahnu 4y agoPraise be!
- pram 4y agoYes it’s a huge mess, I pretty much just stick to portproxy.
- CoolCold 4y agoI find it's good in terms of it will hopefully prevent humans to try to run things in _production_ in WSL. I can easily imagine frontend dev guy requesting to have Windows Server in the AWS just to install WSL and run his/her `nodejs` something there cuz it feels familiar to things at local laptop.