- 
                Notifications
    You must be signed in to change notification settings 
- Fork 21
Description
Hello,
I am developing a virtual lab to test our PXE boot provisioning stack, and I've found socket_vmnet to be a very promising tool as it avoides me to run qemu with sudo. However, I've run into an issue where the DHCP server provided by socket_vmnet (more like by MacOS vmnet framework) conflicts with the custom DHCP server required for my setup.
Use Case
My lab environment consists of:
- 
A "Provisioning" VM: This VM runs dhcpd,tftpd, andnginx. It's configured with two network interfaces:- One on a usertype network for internet access.
- One on a vmnet-hostnetwork, where its DHCP server provides addresses and routing for client VMs.
 
- One on a 
- 
Multiple "Client" VMs: These VMs connect exclusively to the vmnet-hostnetwork and are intended to be provisioned by the main VM.
The Problem
The built-in DHCP server on the vmnet-host network (I believe it's bootp from MacOS) conflicts with the one running on my Provisioning VM. For my use case to work, I need a way to create a vmnet-host network without an active DHCP server.
Comparison with QEMU
I've found that QEMU's native vmnet support handles this scenario perfectly via the net-uuid parameter. As the QEMU help text explains, providing a UUID disables the built-in DHCP server and allows multiple VMs to communicate on an isolated network segment. This is what you find in the qemu-system-* --help:
❯ qemu-system-aarch64 --help | grep vmnet-host -A10
-netdev vmnet-host,id=str[,isolated=on|off][,net-uuid=uuid]
         [,start-address=addr,end-address=addr,subnet-mask=mask]
                configure a vmnet network backend in host mode with ID 'str',
                isolate this interface from others with 'isolated',
                configure the address range and choose a subnet mask,
                specify network UUID 'uuid' to disable DHCP and interact with
                vmnet-host interfaces within this isolated network
This allows me to successfully run my lab with the following QEMU configuration:
Provisioning VM:
net0 is a user network, net1 with net-uuid uses vmnet-host and disables dhcp:
    -device virtio-net-pci,netdev=net0
    -netdev user,id=net0,hostfwd=tcp::2222-:22
    -device virtio-net-pci,netdev=net1,mac=00:00:DE:AD:BE:EF
    -netdev vmnet-host,id=net1,net-uuid=99eddb74-3193-48e3-bafb-b3ca99e949c1Client VM:
the client VM only has the net1 network, wiht net-uuid to disable dhcp:
    -device virtio-net-pci,netdev=net1,mac=12:23:bd:8f:df:2b
    -netdev vmnet-host,id=net1,net-uuid=99eddb74-3193-48e3-bafb-b3ca99e949c1Proposal
I would greatly prefer to use socket_vmnet to avoid the need for sudo and to simplify network management. Would it be possible to add a feature to disable the DHCP server on vmnet-host networks, perhaps by exposing the underlying net-uuid functionality?
We can check how QEMU does this.
Thank you for creating such a useful project and for considering this request!