Select static subnet and pinned IP address for WSL
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
I checked the forum and found multiple requests, which are pending for a while.
WSL is great! But admins and developers need to be able to reliably access services on the WSL instances!
The localhost mapping does not help for all application types -- even just accessing from host to WSL.
It drills down to the following requests
- Keep the selected sub range persistent between boots
- Keep the selected IP persistent between boots
- Allow to change the IP range permanently to resolve conflicts with VPNs, corporate policy, etc
- Allow to assign a static IP from that range that does not change automatically after reboot
You can add another IP today inside the VM and assigning it via /etc/wsl.conf boot command in Win 11 should work. But if the IP range changes, this doesn't help! (e.g. ip a add 172.21.237.111/20 dev eth0)
The hyper-v local only adapter has no configurable IP range as well. And this might be part of the problem ..
If you cannot fix it soon, maybe we can get an valid work around by changing the WSL hyper-v network adapter?
It is not clear how the adapter gets assigned to WSL.
Thanks
Daniel
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by investigating how WSL assigns its Hyper-V network adapter and how /etc/wsl.conf boot commands interact with that configuration. Compare the requested persistent subnet and IP behavior with current networking constraints, including VPN conflicts. Done should mean users can configure a stable subnet and static WSL address that persist across reboots.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux
- Domain
- networking, operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100