microsoft / microsoft/WSL

Multiple network interfaces, one of them bridged

Open
#9,113 3 comments 4 reactions 0 assignees View on GitHub
feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

**Is your feature request related to a problem? Please describe.**
I would like to use WSL in a private local network with a bridged adapter as well as retaining the orginal network inteface for internet access over the host.

**Describe the solution you'd like**
1. First connect the host to two network.
a. Using inteface0 to connect to a network with a router that allows internet access, also used for the host.
b. Using inteface1 to connect to a private network with its own dhcp server and no connection to other networks.
2. Create a special hyper-v switch that is using the external mode connected to interface1.
3. Configure WSL to use both the default switch with nat and the special switch in bridged mode preferably distribution specific in `/etc/wsl.conf` instead of a global setting in `.wslconf`.
4. Both Networks are accessible through eth0 and eth1 respectively within WSL.

**Describe alternatives you've considered**
Currently only access to one network is possible through the setting `[wsl2]
networkingMode = bridged
vmSwitch= SPECIAL_SWITCH` in the global `.wslconf` Commenting it out when the default networking setup for internetaccess is required which in turn requires a restard of WSL as a whole.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the existing [wsl2] networkingMode and vmSwitch settings in the global .wslconfig, along with the proposed distribution-specific /etc/wsl.conf location. Trace how the default NAT switch and an external Hyper-V switch are selected. Done means one WSL distribution can expose both networks as separate eth0 and eth1 interfaces without restarting the whole WSL environment.

Written by the indexing model from the issue text.

Assessment

Domain
networking, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.