USB Boot and point to custom FOG server IP


  • So I read through the instructions to create a USB bootable disk that uses ipxe.efi, which I assume is preconfigured to point to the FOG server’s main IP, which in my case is 10.0.0.10 which I use for offline imaging over a switch. What I want is to be able to change where the USB boot disk looks for and mounts the NFS share. I have a 2nd interface on my FOG server that is online and I use this for managing FOG and updating Ubuntu Server. I can mount the NFS share through this interface. Would I have to decompile the ipxe.efi file and edit it so it see’s FOGs IP as whatever I set it to?

    EDIT: Had to update my question because we don’t have PXE booting set up on our online/prod network. Guess the ultimate goal is to be able to deploy fog images in other buildings using the USB drive to boot to the fog menu.


  • @sebastian-roth
    I figured such. The usb method on my offline imaging switch is redundant since pxe works fine on that. Just would have been nice to be able to image remotely booting via USB, kind of like Acronis+mapping to an SMB share that stores the images. If only my network team would enable tftp/pxe on their dhcp servers. We have it only on our hq subnet but it is being used by SCCM, and SCCM takes a very, very long time to image a PC. We only use it to get a base Windows 10 image and work on it from there, then capture/upload our custom dept images to the FOG server.

  • Senior Developer

    @brakcounty said in USB Boot and point to custom FOG server IP:

    Do the web files reference 10.0.0.10 or does something else do that? Because I could make two fog sources under /var/www and have each dedicated to the interfaces.

    It’s stored in the database (storage node settings in the web UI). FOG was not made for this and you will have to dig pretty deep even to get unicast to work.

    When machines PXE boot they load a generated iPXE configuration (via URL http://x.x.x.x/fog/service/ipxe/boot.php) and that is build using the values from the database.

    As I said earlier I imagine it might be easier for you to use George’s USB boot method where you manually specify the values using Kernel parameters instead of using the auto-generated iPXE configuration.


  • @Sebastian-Roth
    Single cast is the goal when imaging PCs remotely. This is really for times when we have to reimage a few or a single PC and we need to bring it back to hq to image. I could put fog servers at each site loaded with dept specific images. Do the web files reference 10.0.0.10 or does something else do that? Because I could make two fog sources under /var/www and have each dedicated to the interfaces.


  • @Sebastian-Roth
    I read through this tutorial and others https://www.slashroot.in/how-to-configure-split-horizon-dns-in-bind
    Seems like it isn’t practical since it handles requests coming from specific subnets, which we have a very large number of. I’d have to put each known subnet into the bind config. I want requests coming from the interfaces to be handled the way you described above.

  • Senior Developer

    @brakcounty While a split DNS config will help you to get a few steps ahead it’s as George said, FOG wasn’t made to be used with more than one interface. Not exactly sure if single cast deploy ( over NFS share) will work but I imagine it does. But multicast will definitely not work in both networks without major code changes I am sure.


  • @george1421
    A split horizon DNS config huh? I will investigate this. Thanks!

  • Moderator

    @brakcounty I’m still trying to get my head wrapped around the flow here, but 2 things pop out at me.

    1. If you only have 1 fog server then it isn’t designed to support imaging over 2 different interfaces. Everything will point back to its defined imaging network IP.
    2. Possibly if dns names were being used instead of IP addresses you could create a split horizon DNS configuration where internally fog.server.com would point to the 10.x network and externally fog.server.com would point to the 192.168.x interface. You would need to replace all of the static entries in the fog server web ui with DNS name. But that might be an option too.

  • My guess is that somewhere along the chain, a reference to ${fog-ip} is made that breaks the chain. So I would have to find a spot to fork the process by setting a new ${fog-ip}, duplicating files naming them “whatever_usb” like I’ve been doing so far with success. Does that make sense? I think the fork would have to be at the boot.php part. Since default.ipxe points to the boot.php, I’d have to make a custom boot.php file that points the process to the online interface. I’m looking at boot.php now but don’t see any IP addresses or files being referenced. I also don’t know much about php.


  • @george1421 It is a full FOG server.

    So far I changed the ip address in ipxeconfig.ipxe (embedded into the ipxe.efi image) and default.ipxe to point to the online IP 192.168.1.50. I renamed default.ipxe to default_usb.ipxe and referenced that filename in ipxeconfig.ipxe before I compiled the image.
    FOG Topology.png


  • @george1421
    Let me do that on a digital napkin then I’ll upload it here in a bit 🙂

  • Moderator

    @brakcounty said in USB Boot and point to custom FOG server IP:

    Turns out this might be more complicated than I thought. I got up to boot fog menu, after it tried to download bg.png from the offline

    You may need to draw a picture on a napkin with IP addresses of exactly what you are shooting for. It sounds like you have the basis working, but missing something in your expectations.

  • Moderator

    @brakcounty said in USB Boot and point to custom FOG server IP:

    The USB boot is pulling instructions from the default.ipxe. Maybe I should tell it to pull a custom file from the fog server with the updated IP

    It should be pulling from default.ipxe on the server you defined. Now if that is pointing back to the HQ fog server that’s a different issue.

    Is the wanted FOG server a full fog server or a storage node?


  • @george1421 @Sebastian-Roth
    Turns out this might be more complicated than I thought. I got up to boot fog menu, after it tried to download bg.png from the offline http://url. Tried to deploy an image, logged in, then it tried to load http://10.0.0.10/fog/service/ipxe.boot.php. Before that though, it successfully loaded boot.php from the external ip. Sounds like I will have to comb through all the config files and make new versions to point to external IP but keep the 10.0.0.10 functionality…?


  • So it booted, read from tftp://customip, then tried to load the menu boot.php from http://10.0.0.10, so somewhere in the config is still pointing to the offline ip. I will check the code.

    Just realized something. The USB boot is pulling instructions from the default.ipxe. Maybe I should tell it to pull a custom file from the fog server with the updated IP?


  • I missed the very first step, my bad. I didn’t have the source ipxe code. I’m compiling it now. I’ll test it out usb boot and see if I can deploy an image. Will report back.

  • Moderator

    @brakcounty said in USB Boot and point to custom FOG server IP:

    So I read through the instructions to create a USB bootable disk that uses ipxe.efi, which I assume is preconfigured to point to the FOG server’s main IP, which in my case is 10.0.0.10

    Just to be clear where I’m driving here. What I propose is to build a custom iPXE boot loader. In this custom boot loader we will replace the standard method to locate the FOG server (via dhcp) with a static and unique IP address when booting from the usb flash drive. You will need one of these custom iPXE boot files for each FOG server you want to redirect the client to. The FOG git installer has the needed stuff for the OP to do this hacker’s way to get results.

    In the git installer file (typically /root/fogproject if you followed the standard install method) there is /root/fogproject/src/ipxe/src-efi directory in there are the standard scripts that FOG integrates into the standard FOG iPXE files. All you need to do is edit the ipxescript with the hack I mentioned before pointing the chain call directly to the FOG server of your choice.

    Then change to /root/fogproject/utils/FOGiPXE directory and then run the installer script in /root/fogproject/utils/FOGiPXE called ./buildipxe.sh That will build the modified version of iPXE and drop the files into /root/fogproject/packages/tftp once the compile is done then grab the ipxe.efi file from that directory DO NOT rerun the FOG installer or you will replace your fog server ipxe files with the modified ones. You will want to do a git pull to reset the FOG supplied ipxe files when you are done.

    OK now you have the fixed iPXE files then you can follow the tutorial I provided before: https://forums.fogproject.org/topic/6350/usb-boot-uefi-client-into-fog-menu-easy-way
    This will create a usb bootable version of iPXE with the fog server hard coded into startup script.

  • Senior Developer

    @brakcounty Did you manually download and extract the iPXE code or clone the iPXE github repo? There should be a subdirectory called src. You need to run the make command from within that directory.

    Should be ~/ipxe/src in your case I reckon. Make sure there is no typo in that command.


  • @sebastian-roth
    I do have the installer and followed the instructions, when I run “make bin-x86_64-efi/ipxe.efi EMBED=~/fogproject/src/ipxe/src/ipxescript” I get “make: *** No rule to make target ‘bin-x86_64-efi/ipxe.efi’. Stop.” Which directory should I be running this command from? I tried running it from ~/fogproject/src/ipxe/src and ~/ipxe/src with the same result.

  • Senior Developer

    @brakcounty As posted before there are different ways of booting via USB. You can load iPXE (with modified script as suggested by George) or GRUB from USB to boot into FOG tasks. Not sure what your final aim is.

237
Online

8.4k
Users

15.2k
Topics

142.6k
Posts