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

win10 + hyperv + multipass + ubuntu #199

Open
gianluca-sabena opened this issue Apr 4, 2023 · 9 comments
Open

win10 + hyperv + multipass + ubuntu #199

gianluca-sabena opened this issue Apr 4, 2023 · 9 comments

Comments

@gianluca-sabena
Copy link

I create a vm with multipass https://multipass.run/ and ubuntu LTS on windows (hyperv) but I cant start ./vm because eth0 is present and I can't remove it. The presence of eth0 give me the error "eth0 prevent this program from run"

How can I run ./vm in my case?

Thank you

@gianluca-sabena
Copy link
Author

OK, I can remove eth by removing network card from hyperv

I can't create a connection between vm and windows. What are the correct parameter to start gvproxy-windows.exe -debug?

@gianluca-sabena
Copy link
Author

Can someone provide the correct parameters to start 'gvproxy-windows.exe' on windows and and './vm' in linux hyperrv vm?

@cfergeau
Copy link
Collaborator

I'm not sure gvproxy-windows.exe works together with vm, I've never used both :-/
You need to configure your hyperv VM to use hvsock, see the first answer to https://stackoverflow.com/questions/60696166/using-the-hyper-v-sockets-between-windows-host-and-linux-guest

@gbraad
Copy link
Member

gbraad commented Apr 12, 2023

Can you provide all the steps you did to set this up. Eg, did you set the registry setting?

@gianluca-sabena
Copy link
Author

@cfergeau What I wolud like to do is the same done by wsl-vpnkit https://github.com/sakai135/wsl-vpnkit but on a plain hyperv vm (without WSL)

I suppose gvproxy-windows.exe works together with vm look at https://github.com/sakai135/wsl-vpnkit/blob/main/distro/alpine.dockerfile

@gbraad I confirm, I set up the registry as described here https://github.com/containers/gvisor-tap-vsock#windows-prerequisites but no connection happen

vpnkit

@cfergeau
Copy link
Collaborator

I would first debug this using an intermediate tool either on the host (https://stackoverflow.com/questions/60696166/using-the-hyper-v-sockets-between-windows-host-and-linux-guest mentions hvc) or on the guest (netcat or socat) to make sure a connection can be established to the other end.
Once you are able to create the vsock/hvsock connection, then you can try to get gvproxy/vm to communicate.

@gianluca-sabena
Copy link
Author

Ok I did a test:

  • on windows use hvc nc -t vsock hyperv-ubuntu-lts 1234 to listen on 1234
  • on linux connect to ncat -l --vsock 1234
  • I can exchange chars in both directions

ncat

@cfergeau
Copy link
Collaborator

Then you can start vm in the VM, and see if it can connect to the host?

@fengxx
Copy link

fengxx commented Mar 19, 2024

I am able to verify windows hyperv setup, it is working
the windows registry in Readme the Rock/blob/main/README.md?plain=1#L69) is critical and it is using port 1024, if you changed to other ports, you need update GUID accordingly

# 1024 hex code is 400, the first part of GUID
$service = New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\GuestCommunicationServices" -Name "00000400-FACB-11E6-BD58-64006A7986D3"
$service.SetValue("ElementName", "gvisor-tap-vsock")

gvproxy-windows.exe -debug -listen "vsock://00000400-FACB-11E6-BD58-64006A7986D3"

On linux

# make sure to restart linux vm after adding registry if they are started alreday
sudo modprobe hv_sock
gvforwarder -stop-if-exist none -url vsock://2:1024/connect #change 1024 to match port in guid
# view forwarded ports
curl http://192.168.127.1/services/forwarder/all
# add port forwarding
curl http://192.168.127.1/services/forwarder/expose -X POST -d'{"local":"127.0.0.2:9022", "remote":":22"}'

On windows

ssh 127.0.0.2 -p 9022

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

No branches or pull requests

4 participants