Ubuntu – PXE boot server on a xen PV guest

paravirtualizationpxe-bootUbuntuxen

I've set up a Xen hypervisor on ubuntu 14.04 and a PV guest also on ubuntu 14.04.
I want this PV guest to be a PXE boot server. But when I look at the /boot folder I see that it's empty.

I'm a newbie in virtualization. So where am I supposed to:

  1. take a kernel?
  2. run mkinitramfs to prepare initrd for a network boot?

UPDATE
Dear colleagues. I actually need an advice on the workflow of making a custom initrd.img on a PV guest. I know all the stuff regarding setting up a PXE boot server on a host machine. I just want to understand where can I take a kernel image on a PV guest AND what happens to a PV guest when the kernel is updated via apt-get.

Thank you.

Best Answer

If you want to boot systems via network you need 3 things:

  • a dhcp server (for example isc dhcp)
  • a tftp server
  • a location where you can download the preseeding file

DHCP

The DHCP server has to offer the IP and the boot server to the client.

An example configuration for isc dhcp looks like this:

subnet 10.1.20.0 netmask 255.255.252.0 {
   option routers 10.1.20.1;

   next-server 10.1.22.150;
   filename "/pxelinux.0";

   on commit {
        set clip = binary-to-ascii(10, 8, ".", leased-address);
        set clhw = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
        execute("/srv/rexio/middleware/bin/rex_io_pxe_dhcpevent", "commit", clip, clhw);
   }
}

The "next-server" directive tells the client where it finds the tftp server. As you see in the example you can also define a script that gets triggert when a client requests an ip. In this example it calls a script that dynamically creates the pxe boot command file.

TFTP

For this you can use hpa tftpd. You have to place the kernel and initrd (and the pxe boot command file) in the tftp folder.

You can find the files you need for this (for ubuntu 14.04, 64bit) here: http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/

Just download these files and place them in the tftp root folder (i think on ubuntu it is /var/lib/tftpboot).

the preseeding file

To really automate your installation you need a preseeding file. An example for ubuntu can be found here: https://help.ubuntu.com/10.04/installation-guide/example-preseed.txt (this is for 10.04, but i think it won't change much for 14.04)

You can place this file on a http webserver and point the installation to it (via a kernel parameter)

preseed/url=http://ip.of.your.server/preseed.cfg
Related Topic