@
@
@Pisht2021-11-26 20:47:30
linux
@Pisht, 2021-11-26 20:47:30

How to access webserver using wsl2?

There is windows 10 + wsl2, Node is installed in it.
On Windows, vs code is installed with the Remote - WSL extension to access files that are in the wsl2 subsystem.
For web development, I use Browsersync, which raises a web server and allows you to test sites on different devices within the same network.
The problem is the following - if I run Browsersync from the wsl2 subsystem, then it gives out two links: one for accessing the site locally (works fine), the other for accessing from other devices, for example: External: 172.17.65.236:3000 - and this link no longer works.
If I run Browsersync directly on Windows (from my node), then there are no problems: both the local and external links work (and the external link is already different: External:192.168.1.199:3000 ).
I'm weak in setting up networks, I just understand that there is a conflict between the two systems, but maybe it's possible to somehow fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WSGlebKavash, 2021-11-26
_

WSL2 is a special Hyper -V virtual machine. Due to the fact that only the Linux kernel is virtualized, and the components are launched natively, it is possible to achieve maximum performance.
However, WSL2 is not visible in Hyper -V and its virtual network adapter cannot yet be configured.
There is a script here. It allows you to forward the port automatically.
Here and here are discussions of this topic.
And here is the description with Docker.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question