S
S
Sergei Iamskoi2020-12-19 14:05:08
Computer networks
Sergei Iamskoi, 2020-12-19 14:05:08

How to make a service in WSL2 available on the local network?

Windows 10, WSL2 Debian. It launched Nginx at 0.0.0.0:8080. From Windows on localhost:8080 is available. How to make it accessible from the entire local network? I climbed into the Windows firewall, allowed TCP on the 8080th port for the entire network - no hello. What else is required to set up?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aelliari, 2020-12-19
@syamskoy

In my opinion, wsl2 is not so simple with access to the local network, try setting up external port forwarding to the local port of the machine. Something like that

netsh interface portproxy add v4tov4 listenport=<локальный порт на котором ожидается соединение> listenaddress=<локальный адрес на котором ожидается соединение, или 0.0.0.0 для всех адресов> connectport=<порт назначения, на котором болтается твой сервер> connectaddress=<адрес назначения, на котором болтается твой сервер>

Keep in mind that the destination address should not be 127.0.0.1, it should be visible through ip a which address was assigned to wsl
Another option is to try the bridge mode between the network adapter and the wsl2 virtual switch, if the network is via wifi - never do this because there will be pain and suffering, but if ethernet then why not

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question