Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSL - vSwitch - Internal/Private - Static WSL IP/Subnet #9251

Open
Hyper200 opened this issue Dec 2, 2022 · 7 comments
Open

WSL - vSwitch - Internal/Private - Static WSL IP/Subnet #9251

Hyper200 opened this issue Dec 2, 2022 · 7 comments
Labels

Comments

@Hyper200
Copy link

Hyper200 commented Dec 2, 2022

Is your feature request related to a problem? Please describe.
VPN Ranges clash with randomly assigned WSL IPs, Connectivity to WSL is complicated and difficult at times, Random address make it difficult to send traffic to WSL. Docker ranges will clash occasionally.

Describe the solution you'd like
We would like the ability to use WSL attached to a HyperV swich where we control the subnet and the assigned IP address for vSwitch, and therefor can use init or systemd-network to assign a static ip to the WSL instance.

Describe alternatives you've considered
I have tried the following using a bridged adaptor, and although it works on an external switch, it does not work on an internal switch:
#4150 (comment)
https://github.com/luxzg/WSL2-fixes

The following config:

[wsl2]
networkingMode=bridged
vmSwitch=WSL_external

Doesn't seem to work despite being so close to what we want. eth0 on WSL never comes up on the WSL interface.

Could we have:

[wsl2]
networkingMode=internal
vmSwitch=WSL_internal

or

[wsl2]
networkingMode=private
vmSwitch=WSL_private

Thanks,

@luxzg
Copy link

luxzg commented Dec 4, 2022

Indeed, I tried both Private and Internal vSwitch and they seem to act as if interface is simply disconnected. While External vSwitch works. I don't see why there should be any differentiation between vSwitch types from the WSL side. If you try it with any other VM these switches work exactly the same, it's just "yet another" Ethernet adapter for the OS.

@jikuja jikuja mentioned this issue Dec 13, 2022
2 tasks
@davidshen84
Copy link

Without a static IP for the WSL instance, it is very inconvenient to use microk8s. I have to:

  • update the kube.conf every time to use the new IP
  • update metallb every time for the new IP range

@lm1baker
Copy link

The default range used clashes with the company network at 172.16.0.0/12
There must be a way to reconfigure it.

@Biswa96
Copy link

Biswa96 commented Apr 11, 2023

Newer WSL has some registry keys to configure the static IP address. Please see this discussion #9580

@davidshen84
Copy link

davidshen84 commented Apr 11, 2023 via email

@HKTY569
Copy link

HKTY569 commented May 2, 2023

较新的 WSL 有一些注册表项来配置静态 IP 地址。请参阅此讨论#9580

It seems that the fixed IP cannot be directly modified by modifying the registry, and the ip segment will be reset every time wsl starts

@Biswa96
Copy link

Biswa96 commented May 2, 2023

Did you change all the three registry values - NatIpAddress, NatNetwork and NatGatewayIpAddress ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants