Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiple ethernet virtual adaptors in WSL2 #8110

Open
OleStauning opened this issue Mar 2, 2022 · 6 comments
Open

Support for multiple ethernet virtual adaptors in WSL2 #8110

OleStauning opened this issue Mar 2, 2022 · 6 comments
Labels

Comments

@OleStauning
Copy link

I want to start my Linux distribution with two ethernet adaptors; eth0 and eth1. AFAIK the eth0 device is connected to the vEternet (WSL) virtual adaptor and I managed to create another vEthernet (WSL-TEST) adaptor through "Virtual Switch Manager" in windows:

Ethernet adapter vEthernet (WSL-TEST):

Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::2479:f92d:8abf:5e96%38
Autoconfiguration IPv4 Address. . : 169.254.94.150
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . :

I have restarted my WSL instance, but lshw and ifconfig does not show the new virtual adaptor. How do I add my newly created "vEthernet (WSL-TEST)" adaptor ?

@Biswa96
Copy link

Biswa96 commented Mar 2, 2022

If you want to manually attach a virtual network interface it is possible with HcsModifyComputeSystem API.

@OleStauning
Copy link
Author

Thank you for your suggestion. So there are no GUI- or command-line support in windows for doing this? - and I have to implement my own command-line tool. Is this correctly understood?

I guess my feature request is then to make an official command-line tool for supporting this.

In the meantime I will try to roll my own tool, thanks.

@OleStauning
Copy link
Author

For future reference. It seems that following C# code can do what I want:

https://github.com/dantmnf/WSLAttachSwitch

@vlv-squid
Copy link

For future reference. It seems that following C# code can do what I want:

https://github.com/dantmnf/WSLAttachSwitch

When I was running this program,it crashed like this. What can I do?

image
image

@micheldiemer
Copy link

For future reference. It seems that following C# code can do what I want:
https://github.com/dantmnf/WSLAttachSwitch

When I was running this program,it crashed like this. What can I do?

image image

Check firewall rules

Set-NetFirewallHyperVVMSetting -Name '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' -DefaultInboundAction Allow
Get-NetFirewallHyperVVMSetting -PolicyStore ActiveStore -Name '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}'

Are you on Windows 11 ? Latest version of WSL ? Did you run sudo apt update && sudo apt upgrade ?
It should not do anything but I would suggest to create a new virtual switch with no spaces in it.

WSLAttachSwitch is a new program, not yet mature. If you are a developer, you could download the source code and try to debug it.

@micheldiemer
Copy link

Here a detailed working procedure on how to use WSLAttachSwitch

Script : #4799 (comment)

Text : #4799 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants