Booting VM-s with IPXE

PMoxSudo

New Member
Jan 27, 2016
21
0
1
I wonder if you can boot VM-s on Proxmox so that they enter a command(eg linux) from the ipxe boot menu.

I got kickstart and netbooting working in my lab and so far it's automated after a new VM starts up.

Currently this step where I enter "linux" which is the default boot entry:

https://s10.postimg.io/4kfpewo5l/centos7_ipxe_boot_network.png

Can this be automated so VM-s enter "linux" themselves?

The syslinux menu is this:
Code:
default vesamenu.c32
prompt 1
timeout 600

display boot.msg

label linux
  menu label ^Install system
  menu default
  kernel vmlinuz
  append initrd=initrd.img ip=dhcp inst.repo=nfs:172.22.23.3:/c7pub inst.ks=http://172.22.23.3/ks.cfg
label vesa
  menu label Install system with ^basic video driver
  kernel vmlinuz
  append initrd=initrd.img ip=dhcp inst.xdriver=vesa nomodeset inst.repo=nfs:172.22.23.3:/c7pub inst.ks=http://172.22.23.3/ks.cfg
label rescue
  menu label ^Rescue installed system
  kernel vmlinuz
  append initrd=initrd.img rescue
label local
  menu label Boot from ^local drive
  localboot 0xffff
 
The server runs nginx, dhcp, nfs and tftp in its own /24 subnet. Here's the dhcp config file if relevant:

I've used the RHEL 7 docs as base.

Code:
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example
#   see dhcpd.conf(5) man page
#
option space pxelinux;
option pxelinux.magic code 208 = string;
option pxelinux.configfile code 209 = text;
option pxelinux.pathprefix code 210 = text;
option pxelinux.reboottime code 211 = unsigned integer 32;
option architecture-type code 93 = unsigned integer 16;

subnet 172.22.23.0 netmask 255.255.255.0 {
  option routers 172.22.23.254;
  range 172.22.23.10 172.22.23.253;

  class "pxeclients" {
      match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
      next-server 172.22.23.3;

      if option architecture-type = 00:07 {
        filename "uefi/shim.efi";
      } else {
        filename "pxelinux/pxelinux.0";
      }
  }
}
 
I've realized you can set the default vesamenu.c32 to default linux and lower the timeout(eg 5), so it does look automated after a boot.
 
Thanks for info, I will try to make iPXE work in a few days to automate provisioning of CoreOS cluster on Hetzner
 
For better automatic setup, you can have a default entry per MAC address such that you can spin up special machines without changing anything on you infrastructure. If you have a sql or ldap backed dhcp server, this could be easily automated.