USB Boot and point to custom FOG server IP
-
@brakcounty OK I think you have a few things twisted up, but we CAN get to where you want to be.
How it works today is if you PXE boot the ipxe.efi file is transferred from the FOG server to the target computer into memory and then its booted. (delivery method via pxe or usb the process is the same the file is loaded into memory then executed). Now the FOG iPXE files are special in that they have… kind of a batch file built in that tells iPXE what to do. That script is here: https://github.com/FOGProject/fogproject/blob/master/src/ipxe/src-efi/ipxescript (remember this because you will need it to build your own). That script sets up the network adapter, sends a dhcp request and then finds the fog server via the dhcp request, dhcp option 66. You will notice in the second line from the bottom it chains back to the fog server but this time load default.ipxe (yet another batch file) to do more things on the fog server.
Now in your custom ipxe boot file you might update the script from this
:netboot chain tftp://${next-server}/default.ipxe
to this
:netboot chain tftp://192.168.146.15/default.ipxe
To point to a specific fog server, ignoring anything provided by the dhcp server.
The fog installer has the tools needed to build a custom ipxe.efi file. I think Sebastian knows the command off the top of his head (or use rom-o-match). But you will take that custom ipxe.efi with the customized script and load that onto a usb flash drive and boot it from there.
-
@george1421
Found this link
https://forums.fogproject.org/topic/12121/compiling-ipxe-boot-kernels?lang=en-US
Should I follow this? -
I’m wondering if this will work, because the script is still calling for tftp which isn’t enabled on my prod network, as stated in the OP.
-
@brakcounty If you have the git fog installer package then you have everything you need to build a custom iPXE boot loader. What you will need to do is replace the build in script with one of your own. We are taking about the the same thing . you just need to adjust the file before you compile it. I’m in the office today so I can touch my fog server. Let me see what exactly needs to be done for this.
-
@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.
-
@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. -
@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.
-
@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 theipxescript
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 directoryDO 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. -
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.
-
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?
-
@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…? -
@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?
-
@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.
-
@george1421
Let me do that on a digital napkin then I’ll upload it here in a bit -
@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.
-
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.
-
@brakcounty I’m still trying to get my head wrapped around the flow here, but 2 things pop out at me.
- 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.
- 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.
-
@george1421
A split horizon DNS config huh? I will investigate this. Thanks! -
@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.
-
@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.