ppggff / vagrant-qemu

Use Vagrant to manage machines using QEMU. Test with Apple Silicon / M1 and CentOS aarch64 image
MIT License
408 stars 32 forks source link

How to setup private network #40

Open Agus-Wei opened 1 year ago

Agus-Wei commented 1 year ago

Is it possible to setup private network through Vagrantfile?

leifliddy commented 1 year ago

There's been a couple issues created on this topic. https://github.com/ppggff/vagrant-qemu/issues/33 https://github.com/ppggff/vagrant-qemu/issues/36

ppggff commented 1 year ago

I have done some research for this problem on MacOS:

But there still have some problem:

Also there is a third party program socket_vmnet from the lima project:

I prefer to use qemu directly, maybe use sudo to handle the root problem. I will try to make it work with vagrant's network config soon.

andronat commented 5 months ago

Any examples on how can we run a qemu VM with (e.g.) vmnet-bridged? Because when I tried to add it on the following args:

    qe.net_device = 'virtio-net-pci'
    qe.extra_netdev_args = 'vmnet-bridged=on,ifname=en0'

I got the following error, which suggests the plugin is pre/appending various other arguments that are not compatible with the vmnet arguments:

Stderr: qemu-system-x86_64: -netdev user,id=net0,hostfwd=tcp::50022-:22,vmnet-bridged=on,ifname=en0: Invalid parameter 'vmnet-bridged'
unixerius commented 5 months ago

@andronat , @ppggff already said this plugin hasn't been adjusted to work with vmnet-* yet.

Like you, I would love to use these solutions, but it's not possible yet.

unixerius commented 5 months ago

With regards to your post of May 8th, I feel that you should wait for Qemu to build in the required support for non-privileged users.

They themselves have already identified that their biggest hurdle is that their software isn't flagged by Apple as being permitted to use the com.apple.vm.networking entitlement. The main reason for this is A) that they haven't requested it and B) that their brew install does a build from source code. source

That seems like something they as project should be able to work on. Until they've done so, I would not recommend that you build in a sudo workaround.