Thursday, June 14, 2012

Doing PXE with libvirt / virt-manager

pxe_01 by Elijah Porter


Installing hosts using PXE is a well known thing.
Why not do it within libvirt? Or: How do I do this in libvirt?
Do I need to setup my own dhcp server to pass the bootp option? Nope.
Just use libvirts default dnsmasq and add the bootp dhcp option.

All you need to do is editing the default network configuration using virsh (no way o do it from virt-manager).

# virsh net-destroy default
# virsh net-edit
  Now add "<bootp file='/pxelinux.0' server='$PXESERVERIP' />" under /network/ip/dhcp
# virsh net-start default

All done.
Just have a look at the definition here to read about more features.

4 comments:

  1. missing / at the end of make me try it 3 times before i see whats wrong :)

    ReplyDelete
    Replies
    1. A missing / at the end of the tag, so < ... /> ?

      Delete
  2. Thanks for this. I reused your tip in a longer post which includes setting up the whole boot server on Ubuntu to build CentOS hosts. It's at http://blog.jwilford.co.uk/post/33434278827/pxe-booting-centos-with-libvirt-and-dnsmasq-on-ubuntu

    ReplyDelete
    Replies
    1. Hey James, that's a nice wrap-up and walk-through. Very nice. And thanks for the credits - in such an easy-copy-n-paste-world-wide-web.

      Delete