Add a second PXE Boot Option

  • Hi,

    i am searching for a “best-practice” way to add a second PXE Boot option.

    My scenario:

    I have a FOG Server ( Running Version 1.3.5-RC-10 ) and a external DHCP. Now i have a second service in the network running or booting over PXE. I can not change the DHCP options so i would like to add sth. to FOG.

    I found this:

    But there i have to select the option and use the BootMenu. At the moment the Bootmenu is hidden and i do not use it.

    I am searching for a “default exit” option with i can set for each client.

    So i found this:

    In my mind i am thinking about sth like:

    1 --> Client Power on
    2 --> Network Boot via DHCP
    3 --> PXE Boot via FOG
    4 --> Checking for a Task via FOG and running it
    5 --> Or starting from my other PXE Server

    I think the “Host Bios Exit Type” Option could work for this. But before i starting editing some php files i would like to know if there is a better way for it.

    Any ideas? - Please let me know! Thank you 😉

  • Nice! Thank you @Junkhacker and @george1421

    I just changed it to work with the clients MAC address and it seems to work like a charm!

    So now, i have this config:

    iseq ${net0/mac} XX:XX:XX:XX:XX:XX && goto chainboot ||
    goto fog.local
    set pxeserver:ipv4 XXX.XX.XXX.XXX
    set next-server ${pxeserver}
    chain tftp://${pxeserver}/pxelinux.0

    I will do some testing but i am verry optimistic 😉


  • Developer

    @george1421 yuck, you’re right about the line wrap. it would look better and work just as well to make that:

    set net0/next-server <otherPXEbootServerIP> 
    set filename <whateverFile> 
    chain tftp://<otherPXEbootServerIP>/<whateverFile> ||
  • Moderator

    @Junkhacker This is exactly what I was thinking when I had to pause earlier.

    At the top you will have a major test for hardware inclusuion in this group

    iseq ${serial} <labSerial1> &&  goto chainboot ||
    iseq ${serial} <labSerial2> &&  goto chainboot ||
    iseq ${serial} <labSerial64> &&  goto chainboot ||

    If there isn’t a match then the original (old default) menu is selected.

    goto fog.local

    If there is a match then the flow jumps down to the label


    Sets the next server (dhcp option 66) and boot filename (dhcp option 67) to the new values required for OpenSLX and then chain boots (fwiw that should be on one line, its a bit deceiving because of the line wrap, that is all one line) into the new environment.

    @Junkhacker Simply Brillant!!

  • Developer

    @Junkhacker to clarify, your new “default” menu item would contain something like this:

    iseq ${serial} <labSerial1> &&  goto chainboot ||
    iseq ${serial} <labSerial2> &&  goto chainboot ||
    goto fog.local
    set net0/next-server <otherPXEbootServerIP> && set filename <whateverFile> && chain 
    tftp://<otherPXEbootServerIP>/<whateverFile> ||
  • Developer

    any reason you don’t want to set it for “hide menu” and a 1 second timeout?
    your custom default menu item (which will be chosen even if the user doesn’t see it) can have a collection of conditions to test against to only make the relevant hosts boot to the OpenSLX server

  • @FritzBox360 said in Add a second PXE Boot Option:

    For example: Room B has 64 Clients - if i would like to boot into OpenSLX i need to boot manually each client into the FOG BootMenu to start OpenSLX. If i select the “default” option as @Wayne-Workman mentioned - all other clients - e.g. room A - would be affected.

    As I already said:

    @Wayne-Workman said in Add a second PXE Boot Option:

    This would apply to everything though.

    I don’t think FOG is the tool you should be using for this, I think you would do better with syslinux.

  • Moderator

    @FritzBox360 said in Add a second PXE Boot Option:

    s a PXE boot too. So i thought there could be a way to use both.

    Thank you for your detailed information. I do see a path forward from here with a few potential failures.

    FOG uses a number of other technologies to allow their magic to work. One of those technologies is from the iPXE project. iPXE gives fog the dynamic pxe boot capabilities. The FOG management code can build the iPXE boot menus and actions dynamically based on what the client should be doing at a specific point in time. While FOG can create iPXE menus dynamically, iPXE can’t directly interact with FOG so there is no way for the iPXE kernel (undionly.kpxe or ipxe.efi) to know what FOG knows about the target computers. The iPXE kernel can only know about what it finds out about via dhcp or what its been told by FOG creating the iPXE menu in a certain way.

    Now to the issue.
    From your post you have 2 rooms of computers. Both rooms (sets) of computers will be managed by FOG. One should boot through to the local hard drive and the second room should booth through to OpenSLX via an iPXE chain command. These computers are on the same subnet. During the iPXE mode, iPXE doesn’t know how to interact with FOG.

    So the question is how can iPXE know which set a pxe booting computer belongs in? Remember we are dealing with computers so intrinsic knowledge is not possible. iPXE only has these commands avaialble:

    The one answer I can think of is by the device’s mac address. You would have to maintain a list of mac addresses that a pxe booting computer would be tested against to identify which group the target computer falls in. If a mac address match is found then the pxe booting computer then could be redirected to OpenSLX.

    <I need to pause here for a while>

  • @george1421 okay, no problem i will explain 😉

    We have here two rooms ( A and B ) on the same subnet with the same DHCP settings.

    Both rooms are managed via one FOG-Server and have a local WIN7 image.

    Now, we would like to use room B for OpenSLX virtualization. Therefore we need another next-server entry via DHCP. But this is not cool because we have to decide between FOG and OpenSLX. As a fact, OpenSLX uses a PXE boot too. So i thought there could be a way to use both.

    Sure, i could add a new image to FOG with boots to OpenSLX but therefore i need to re-image the room all the time if someone needs WIN7.

    I am thinking of managing both rooms via FOG and be able to start OpenSLX individually on a client.

    Thanks to @george1421 i could add an option to the BootMenu. But the problem is, we are not using this menue at the time and it is not individually for the clients.

    For example: Room B has 64 Clients - if i would like to boot into OpenSLX i need to boot manually each client into the FOG BootMenu to start OpenSLX. If i select the “default” option as @Wayne-Workman mentioned - all other clients - e.g. room A - would be affected.

    So i was lokking for an option - sth. like a flag " Boot OpenSLX " - for each client and i found the “Host Bios Exit Type” option with is nearly what i need. But i do not need grub, i need sth. like a PXE boot to another IP.

    I am new to the whole PXE Grub boot topic. As @Sebastian-Roth mentioned there is a way to edit the /var/www/html/fog/lib/fog/bootmenu.class.php for “other” grub commands.

    So i am stuck at the point to connect grub to load from another server. I am not sure if booting into grub.exe is a step to far because i did not found a working way to connect grub to pxe. Something like @george1421 mentioned to chainload from another IP would be great. But i am not familar with that topic.

    Would be nice if someone could help here. If there are any kind of questions feel free to ask!

    Thanks a lot!

  • Moderator

    @FritzBox360 I’m not sure I understand. If there is nothing for fog to do, it should chain load to your other pxe server. Its not clear where an exit mode would come into play here.

  • @george1421 you code works fine 😉 I added a new menu entry! But now i have still the problem with the different rooms/clients. I will try to check if i can change the GRUB_FIRST_HDD option.

  • Thank you for your replies!

    Not sure, but if i select a option for “Menu Show with:” i cannot select a group of hosts?
    The Problem here is i have different Computer-Rooms in one room i would like so start OpenSLX via PXE but the othe room should not be affected.

    I think this could work if i add a new Menu Entry for my PXE Boot - but then, i need to activate the menu and select it - or? If i select the “Default Item:” then it will be applied to all clients - right?

    What do you think? This method from @Sebastian-Roth seems to be the right way. I will check if i can chainload my PXE over it.

  • @george1421 Yep, every time.

  • Moderator

    @Wayne-Workman Ok just for clarity then, if the OP turned off the boot from hard disk as the default option and created a new menu entry and set that as default, it would boot through to the second pxe server (assuming my chain command is correct)?

  • @FritzBox360 The Boot Menu Configuration area allows you to choose a default. Also, any new item you make you could set as default. This would apply to everything though. pictured below.

    0_1488810667415_Default boot item.png

  • Moderator

    @FritzBox360 This is an interesting issue here. One part I’m not sure how FOG handles the default action when the FOG iPXE menu isn’t visible.

    If it was visible I might create a new fog menu and set it as the default menu.

    Inside that menu I might place this code.

    set pxeserver:ipv4 <ip_addr_pxe_server>
    set next-server ${pxeserver}
    chain tftp://${pxeserver}/pxelinux.0

  • The second PXE Server is for virtualization via OpenSLX ( ) - It is for running VMs over the network.

  • Moderator

    While I don’t have an answer yet for you, what is your second pxe boot server? What function is it performing?