WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Add support to specify VLAN # when using Bridged Network Mode

Open pquiring opened this issue 2 months ago • 6 comments

Trying to use Bridged mode in WSL2 on Windows Server 2025 and need to use a VLAN number. This is a Hyper-V server running several other Windows VMs, each has their Virtual NICs on different VLANs.

Need WSL to use a VLAN on it's virtual NIC that is on the virtual switch like other VMs that are configurable in HyperV Manager.

Maybe something in .wslconfig

[wsl2] 
networkMode=bridged
vmSwitch="VirtualSwitch"
networkBridgedVlan=123

Some AI searches offered some workarounds but nothing works.

Using a native VLAN on the interface would disrupt other VMs already using the VLAN.

Windows Server 2025 does not support mirrored mode.

Thanks,

pquiring avatar Nov 04 '25 02:11 pquiring

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use collect-networking-logs.ps1, following the instructions in Collect WSL logs for networking issues

Once completed please upload the output files to this GitHub issue.

See Collect WSL logs (recommended method).

If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.

github-actions[bot] avatar Nov 04 '25 03:11 github-actions[bot]

There is no error messsage, wsl does start in Bridged mode BUT since it's using the native VLAN, there is no network there.

pquiring avatar Nov 04 '25 03:11 pquiring

/feature

pquiring avatar Nov 04 '25 03:11 pquiring

Diagnostic information
Found '/feature', adding tag 'feature'

github-actions[bot] avatar Nov 04 '25 03:11 github-actions[bot]

Found a workaround.
Assigned a native VLAN to the switch port this interface connects to that is not in use by other VMs.
Not an ideal solution for a VM server.

pquiring avatar Nov 04 '25 14:11 pquiring

Better soln would be to expose the WSL VM in HyperV manager so we could configure it there.

pquiring avatar Nov 04 '25 22:11 pquiring