[WSL 2] NIC Bridge mode 🖧 (Has TCP Workaround🔨)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
Issue
WSL 2 seems to NAT it's virtual network, instead of making it bridged to the host NIC. My goal is for a service running in Ubuntu in WSL 2 to be accessible from anywhere on my local network.
Issue Details
-
Your Windows build number:
Microsoft Windows [Version 10.0.18917.1000] -
What you're doing and what's happening:
Runningipconfigon my Windows 10 host machine
IPv4 Address. . . . . . . . . . . : 192.168.1.41
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
Running ifconfig in Ubuntu WSL 2
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.18.72.60 netmask 255.255.0.0 broadcast 172.18.255.255
Accessing 172.18.72.60 from my Window host does work, however this IP is not accessible from another system on my network.
-
What's wrong / what should be happening instead:
I would expect toifconfigin Ubuntu WSL 2 to have an IP address in the same network as my host machine. -
Searching the docs:
The only detail I have found about WSL 2 networking is the following that notes that it will have it's own IP and that localhost is something that will be used for WSL 2 in the future.
https://docs.microsoft.com/en-us/windows/wsl/wsl2-ux-changes
This is fine, however I would like the IP WSL 2 is getting to be on my local LAN which means I need to configure the virtual NIC to be bridged.
Workaround
See @edwindijas https://github.com/microsoft/WSL/issues/4150#issuecomment-504209723
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
No source file or test is named; start by reviewing the issue discussion and the linked TCP workaround, then inspect the WSL 2 networking design. Done means a WSL 2 Ubuntu instance receives a bridged address on the host LAN and services are reachable from other local-network systems.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, ubuntu
- Domain
- networking, operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100