gPXE with kvm/libvirt

What we want

Start a virtual server with kvm and libvirt without use a cdrom pxe option rom, or send iPXE bt dhcp.

KVM with (standart) pxe

Out of the box libvirt/kvm come with PXE, but it doesn't work wery well (slow interface, buggy)

KVM pxe boot

KVM with iPXE

Why we can not use the gPXE, and we can, for this they are many way to do this:

  • create a boot cdrom with gPXE on it
  • use a lkern gPXE boot (why not, but very bad idea) - gPXE as a boot kernel
  • create an option rom and use it for the KVM system (yeaaaaah :)

the CDROM is interesting, but for every new virtual server we have to use this cdrom and configure to boot on it. I prefer a lazy way, the option rom.

Option ROM for KVM

Compile the option ROM

cd /data/Tools
git clone git://git.ipxe.org/ipxe.git
git pull
cd ipxe/src
make bin/virtio-net.rom bin/e1000.rom bin/rtl8139.rom

virtio-net is for the virtio network module, e1000 for the intel ethernel 1000 driver and rtl8139 for realtek.

I use virtio (for linux and windows virtual images), and only this module, virtio is better than the others.

Use the option ROMs

now put this rom file in the right place.

On debian/ubuntu

dpkg -L kvm-pxe
...
/usr/share/qemu/pxe-rtl8139.bin
/usr/share/qemu/pxe-virtio.bin
/usr/share/qemu/pxe-e1000.bin
...

You have to replace the bin file by the rom file

do the same on Other distribs, you have to find and replace with the valid option rom.

Tittle 3

KVM with iPXE

Kvm with iPXE boot