4 ms·
It was a haul and I'm realizing now that I don't have it properly documented in my notes. But, that was a haul over the course of a couple years that had me exp
by pridkett 4y ago
It was a haul and I'm realizing now that I don't have it properly documented in my notes. But, that was a haul over the course of a couple years that had me experimenting with external USB network cards, virtual switches, and more.
It's gotten way easier now.
In your .wslconfig you'll want something like this:
[wsl2]
memory=48GB
localhostforwarding=true
networkingMode=bridged
vmSwitch=WSL_external
The key things are "networkingMode=bridged" and "vmSwitch=WSL_external".
Then, open up Hyper-V manager on Windows, go to "Virtual Switch Manager" and create a new virtual switch using your primary ethernet adapter (I could never get this to work with my USB ethernet adapter). Check the boxed for "External Network" and "Allow management operating system to share this network adapter" and finally call it "WSL_external". That should do it for you.
Incidentally, the port forwarding with WSL2 and Docker, has made this not entirely necessary, but I still like being able to SSH directly into my WSL2 host, not having to manage Windows' firewall rules, and being able to forward UDP for things like Mosh.