PXE in a VM for Baremetal

One of the main reasons for a strategy of “go virtual first” is the ease of checkpointing and restoring key pieces of infrastructure. When running a PXE provisioning system, the PXE server itself is a piece of key infrastructure, and thus is a viable candidate for running in a Virtual Machine. How did I set up the network to make that possible? macvtap.

The MacVTap device type allows us to allocate a single physical NIC on the Hypervisor to be used by the virtual machines. When creating the virtual machine to use as a PXE server, I created the network device as type MacVTap, and told it to communicate directly with em1. This essentially creates all off the required Linux Kernel abstractions to allow the virtual machine to access the NIC directly. It does not allocate the NIC to the VM (direct passthrough) so it can still be shared between multiple virtual machines on the same hypervisor.

This Generates a fragment of the domain XML file that looks like this:

<interface type='direct'>
      <mac address='52:54:00:bb:7f:49'/>
      <source dev='em1' mode='vepa'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</interface>

I set mine up using VEPA. However, since I potentially want multiple VMs on this host o be able talk to each other efficiently, I might change this to Bridged in the future.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.