Add support to specify VLAN # when using Bridged Network Mode
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,
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'.
There is no error messsage, wsl does start in Bridged mode BUT since it's using the native VLAN, there is no network there.
/feature
Diagnostic information
Found '/feature', adding tag 'feature'
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.
Better soln would be to expose the WSL VM in HyperV manager so we could configure it there.