Code-Hex / vz

Create virtual machines and run Linux-based operating systems in Go using Apple Virtualization.framework.

Home Page:https://pkg.go.dev/github.com/Code-Hex/vz/v3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bridged Networking

bdwyertech opened this issue · comments

Is your feature request related to a problem? Please describe.
Bridged networking support. It looks like this is partially implemented, but I cannot find an example using NewBridgedNetworkDeviceAttachment.

@bdwyertech Hi 👋
I don't think we couldn't use BridgedNetwork because this is required permission for vmnet:

https://developer.apple.com/forums/thread/710763

OK, that makes sense. Looks like that is some kind of special entitlement that only a VMware or Parallels could get.

@Code-Hex quick question, I see in the examples a way to create a unix socket which translates to a port in the guest machine -- is it possible to share a Unix socket between the host and the guest? I can do this with Hyperkit, trying to figure out how to achieve same with this lib.

Thanks,
Brian

@Code-Hex quick question, I see in the examples a way to create a unix socket which translates to a port in the guest machine -- is it possible to share a Unix socket between the host and the guest? I can do this with Hyperkit, trying to figure out how to achieve same with this lib.

This is getting off-topic for this issue (not a problem, just pointing out we could have this discussion elsewhere ;)

Unix socket sharing is not directly supported by Code-Hex/vz nor by Apple Virtualization Framework, but can be implemented on top of it. When you have a VM running with Code-Hex/vz, you can create a unix-unix tunnel in a variety of ways. One possibility is using virtio-vsock as suggested by Kei. You'd need code in the guest to do vsock <-> unix.

podman implements this over SSH, this removes the need for dedicated guest code, and is also hypervisor-agnostic. The code can be found in https://github.com/containers/gvisor-tap-vsock/tree/main/pkg/sshclient

OK, that makes sense. Looks like that is some kind of special entitlement that only a VMware or Parallels could get.

Some discussion related to bridge networking happened in #61 (comment)
Apparently it might be possible to workaround the entitlement if you use sudo.