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

Access to wsl2 #1725

Closed
hodjaev opened this issue Sep 6, 2020 · 10 comments
Closed

Access to wsl2 #1725

hodjaev opened this issue Sep 6, 2020 · 10 comments
Labels

Comments

@hodjaev
Copy link

hodjaev commented Sep 6, 2020

What are you trying to do?
I'd like to have access to multipass vm from wsl2

What's your proposed solution?
Detect if wsl2 is available during multipass installation process. And if so offer an option to have connectivity between the two.

Additional context
image

@Saviq
Copy link
Collaborator

Saviq commented Sep 7, 2020

Hi @hodjaev what makes you say this isn't already possible? Can you not ping Multipass instances from inside WSL?

@Saviq Saviq added question and removed enhancement labels Sep 7, 2020
@hodjaev
Copy link
Author

hodjaev commented Sep 7, 2020

Hi, @Saviq, I tested ping today and it didn't work. But ping works from the host.

image

image

@Saviq
Copy link
Collaborator

Saviq commented Sep 7, 2020

Thanks @hodjaev.

Hey @sirredbeard, could you guys see what might be the cause of this?

@townsend2010
Copy link
Contributor

This is because WSL2-based instances use a virtual switch different than the virtual switch that Hyper-V based instances use and of course, those two NAT'd networks cannot talk to each other by default. I'm not sure if any routing can be set up on the Windows host to allow this. That said, when our bridged networking support lands in Multipass, then I think it would be possible to add an additional interface to Multipass instances that can use the WSL2 virtual switch.

@flying-sausages
Copy link

flying-sausages commented Sep 15, 2020

you can always run multipass.exe from within bash, FYI. If you're just trying to get in and/or pipe things over, this would work.

image

@Saviq
Copy link
Collaborator

Saviq commented Sep 15, 2020

With bridging support upcoming (#118) you should be able to hook up the instances to the WSL2 network as well. Keep an eye out there.

@jamesallen-atx
Copy link

For anyone still needing a workaround for this, I found a workaround in the WSL repo issues.
microsoft/WSL#4288 (comment)

@Saviq
Copy link
Collaborator

Saviq commented Oct 27, 2021

Outside of Multipass's scope, then.

@Saviq Saviq closed this as completed Oct 27, 2021
@Saviq Saviq added invalid and removed question labels Oct 27, 2021
@daviewales
Copy link

daviewales commented Jun 17, 2022

Summary of the solution linked above:

From an Admin PowerShell run:

Set-NetIPInterface -ifAlias "vEthernet (WSL)" -Forwarding Enabled
Set-NetIPInterface -ifAlias "vEthernet (Default Switch)" -Forwarding Enabled

Now you'll be able to connect to MultiPass instances running on Windows from WSL.

EDIT: This doesn't appear to persist across reboots?

@Chim1995
Copy link

Amazing @daviewales thanks

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

7 participants