It all starts with PXE, but how.....?


#1

As found on the getting started guide, a PXE-server can be used for provisioning systems. However, so far I am not able to get it working. I´m not shure what to put in “Connecting to a PXE Server” (URI, Access URL, PXE Directory etc.) So far, I only will test Linux, so can I leave “Windows Images Directory” empty? What to configure in “Customization Directory” or “Filename” in “PXE Image Menus”…

So much questions. I know my PXE-server works, but it is a bit unclear how to configure one for ManageIQ (and yeah, the documentations looks familiar to the one found on redhat.com…)

Any hint on how to configure a PXE for ManageIQ (Cloudforms) and how to integrate?

Thankz all!


#2

Hi winfried,

To expand on the PXE configuration section of the guide, we support PXE servers running PXELinux or iPXE. Once you enter the information and refresh the PXE server, the PXE images will be discovered and presented in the UI.

  • URI: The base path for the PXE files. On the server from the documentation this is /srv/httpboot/ipxe shared over NFS. We mount this path during refresh and when writing configuration files for VM’s being provisioned.
  • PXE Directory: The relative path to the directory containing the PXE files. When the VM boots, it will look here for a file based on its MAC address. On the server from the documentation this is /srv/httpboot/ipxe/mac.
  • Customization Directory: The relative path to the directory containing the kickstarts. On the server from the documentation this is /srv/httpboot/ipxe/customization.
  • PXE Image Menu Filename: The relative path to the PXE menu. This file will be parsed during the refresh to inventory the available PXE Images. On the server from the documentation this is /srv/httpboot/ipxe/menu.php.
  • Windows Images Directory: The relative path to the directory containing the WIM files that will be discovered for provisioning. (If applicable)
  • Access URL: The HTTP path to the URI. (Read-only)

Hope that helps,

  • Brandon


#3

OK, it should be something like this:

URI Prefix: nfs
URI nfs://pxe.blabla.bla/var/lib/tftpboot (the default tft directory also shared by NFS)
Access URL http://pxe.blabla.bla/pxe/
PXE Directory /var/lib/tftpboot/mac
Windows Images Directory
Customization Directory

Now, /var/lib/tftpboot contains:
[root@pxe conf.d]# ls /var/lib/tftpboot
boot.ipxe ipxe.pxe mac pxelinux.0 undionly.kpxe

/etc/export contains:
/var/lib/tftpboot 192.168.1.0/24(rw)

/var/lib/tftpboot is acually shared trough http://pxe.blabla.bla/pxe (Alias /pxe/ “/var/lib/tftpboot/” etc.)

boot.ipxe contains:
#!ipxe
dhcp net0
chain http://pxe.blabla.bla/pxe/mac/${net0/mac}

OK, TFTP is working, but I gues it is not working due to “PXE Image Menus”. How to create such file, where to put it?

          Last Refreshed On

Creating new VMs through ManageIQ and PXE
#4

My ipxe boot file looks like this:

#!ipxe chain http://${next-server}/ipxe/mac/${net0/mac:hexhyp} || chain http://${next-server}/ipxe/menu.php

So, if the file based on mac address is not found, it will serve a menu file. This menu file has all of the available PXE images listed. In my setup I use menu.php for the PXE Image Menu Filename.


#5

Great, that’s most usefull. Doe you have an example of menu.php? Is dat wirtten in PHP…? Sounds a bit odd…


#6

Here is an example of my menu. It’s not actually written in php, it was just a file that I copied from an example.

#!ipxe

menu ManageIQ iPXE Boot Menu

item --gap -- 		-----My-Images:
item centos63		CentOS 6.3
item rhel63workstation	RHEL 6.3 Workstation

choose --default foreman --timeout 60000 os && goto ${os}

########## My Images ##########

:centos63
kernel http://192.168.252.60/ipxe/sources/centos/6.3/images/pxeboot/vmlinuz ramdisk_size=10000 ks=http://192.168.252.60/ipxe/customization/${net0/mac:hexhyp}.ks.cfg ksdevice=link
initrd http://192.168.252.60/ipxe/sources/centos/6.3/images/pxeboot/initrd.img
boot

:rhel63server
kernel http://192.168.252.60/ipxe/sources/rhel/6.3-server/isolinux/vmlinuz ramdisk_size=10000 ks=http://192.168.252.60/ipxe/customization/rhel_6.3_server.ks.cfg ksdevice=link
initrd http://192.168.252.60/ipxe/sources/rhel/6.3-server/isolinux/initrd.img
boot

#7

Most usefull, thank you. The example “menu.php” is a misleading, it suggests somehow a web menu is involved. Actually the menu is written in “ipxe script language” as found on http://www.ipxe.org/cmd.

I’ll give it a new try, thanks sofar!


#8

Great, this works! ManageIQ is able to find the PXE images found in pxe.blabla.bla/var/lib/tftpboot

Thankz!


#9

Hello,

could you provision new VMs from PXE . can you explain me please how you configure the DHCP with PXE ? you have specified the parameter Boot Server HostName at the DHCP . My problem is, when the VM starts, it retrieves a IP from DHCP but nothing after , no bootable device. Can you help me?

Thanks


#10

Hello,
I understood why the VM don’t boot with file copied by MIQ. The problem is pxe client look for wrong file name (01-MACADDRESS), i don’t know why

Do you have any idea please?

Tanks


#11

Hi @athaifa,

Have any files been written to your PXE server by ManageIQ?

PXELinux should try for several filenames starting with 01-00-01-a4-ad-b5-fc and getting more generic on each try until it finds something. The 01- prefix should be there, I believe it is added because it’s an ethernet interface.

When configuring PXELinux in your environment, you need to set DHCP options dor the tftp boot server and the default filename. There are other DHCP options if you want to use iPXE.

You can provision new VMs via PXE. There is a drop-down in the provision dialog that allows you to select the “Provision Type”.

Hope that helps,
Brandon


#12

Thank you bdunne for your response. yes there is two files written by MIQ on the PXE server ( 00-01-a4-ad-b5-fc and 00-01-a4-ad-b5-fc.ks.cfg), without 01 at the beginning of names. do you know why?


#13

Instead of using iPXE menu format on PXE server, try using PXELinux menu format, e.g.
label superLinuxOS MENU DEFAULT MENU LABEL SuperOS 5.3 kernel linux.c32 path/kernel append initrd=path/initramfs.cgz

I suspect ManageIQ will generate 01-%MAC-ADDRESS% if you’re using PXElinux menu, but will generate %MAC-ADDRESS% config file if you are using iPXE menu.


#14

@alexander.halim Great point.

@athaifa You need to choose whether you are going to use PXELinux or iPXE in the environment. You can’t use an iPXE script when you boot with PXELinux. If you decide to use iPXE, you may need a PXELinux helper script to chain load iPXE for the machines that only have the PXELinux firmware. Do you have PXE working without ManageIQ involved?


#15

Yes, you are right, i was using an iPXE script when i boot with PXELinux.

I found a way around the problem , in the default file called by pxelinux, I call ipxe.

default content file:
default iPXE
LABEL iPXE
Kernel ipxe.lkrn
INITRD boot.ipxe

boot.ipxe content file:
#!ipxe
dhcp
chain http://pxeserver/pxe/mac/${net0/mac:hexhyp} || chain http://pxe-server/pxe/menu.php

It’s work. i will try you solution.

Thank you very much for help.


#16

Hi @bdunne
I use IPXE, and i can provision pxe, but it need manul input, and i can not get anyfiles been written by ManageIQ on my PXE server, i have read Creating new VMs through ManageIQ and PXE, but i still do not not how to solve my problem, i think i have missed something, could you help me?
here is my configuration:

/etc/dhcp/dhcpd.conf:
next-server 172.30.8.172;
subnet 172.30.0.0 netmask 255.255.240.0 {
if exists user-class and option user-class = “iPXE” {
filename “http://${next-server}/ipxe/menu.php”;
} else {
filename “/undionly.kpxe”;

}
range 172.30.9.1 172.30.9.254;
}

my menu.php:
#!ipxe

menu CFME iPXE Boot Menu

item --gap – -----My-Images:
item RHEL7mini RHEL7 mininmal
item CENTOS7mini CENTOS7 minamal

choose --default RHEL7mini --timeout 60000 os && goto ${os}

:RHEL7mini
kernel http://{next-server}/ipxe/image/rhel/7.0/vmlinuz ks=http://{next-server}/ipxe/ks/rhel/minimal.ks.cfg
initrd http://{next-server}/ipxe/image/rhel/7.0/initrd.img boot :CENTOS7mini kernel http://{next-server}/ipxe/image/centos/7/vmlinuz ks=http://{next-server}/ipxe/ks/centos7/centos7_minimal.ks.cfg initrd http://{next-server}/ipxe/image/centos/7/initrd.img
boot

my nfs setting:
/mnt
/var/www/html/ipxe

folder setting:
/var/www/html/ipxe
/var/www/html/ipxe/menu.php
/var/www/html/ipxe/mac
/var/www/html/ipxe/image
/var/www/html/ipxe/ks

thanks verymuch