Chainloading Simple Next Server ?
-
Reading a lot of Chainloading in the forum, but none seem to point to a simple next server ? Any way from Fog menu to allow a second PXE server ?
Current Fog working well with pfsense handling Fog as first PXE server. Then I would like the option to jump to the next server.
I have read everything from it’s broken, to crazy options “if” Fog has a job for it. Is this a simple edit in Fog menu or can be added to advanced ?
Looking to boot to nextboot.xyz for second server.
-
@Cire3 The short answer is that it’s possible, but it depends on how nextboot.xyz handles dhcp information.
The simples form is to add this to the fog ipxe menu builder parameter block.
chain tftp://192.168.1.12/nextboot.xyz || goto Menu
If nextboot.xyz uses dhcp information (which will point to the fog server unless we alter it.
set newserver:ipv4 192.168.1.12 set newbootfile nextboot.xyz set net0.dhcp/next-server ${newserver} set net0.dhcp/filename ${newbootfile} set proxydhcp/filename ${newbootfile} chain tftp://${newserver}/${newbootfile} || goto Menu
-
Ok, I think I got it close…
My Setup…
PFSense 10.22.24.1
In PFSense next server points to fog (works without issue)
Fog 10.22.24.5 (No DHCP)
netboot = 10.22.24.8This is what I have in Parameters
server:ipv4 10.22.24.8
set newbootfile netboot.xyz.efi
set net0.dhcp/next-server ${newserver}
set net0.dhcp/filename ${newbootfile}
set proxydhcp/filename ${newbootfile}chain tftp://${newserver}/${newbootfile} || goto Menu
With this I now boot from fog menu to iPXE initializing devices.
If I use netboot USB image from netboot.xyz, it boots to the netboot.xyz server without issue ? Not sure how it just “knows” where it’s at. Hopefully this helps ?
//////////////////////////////////////////////////////////////////////////////////////////
So I looked at the autoexec.ipxe file and this is what is in it :
#!ipxe
set esc:hex 1b
set bold ${esc:string}[1m
set boldoff ${esc:string}[22m
set fg_gre ${esc:string}[32m
set fg_cya ${esc:string}[36m
set fg_whi ${esc:string}[37m
set VARS_ERR Local vars file not found… attempting TFTP boot…
set TFTP_ERR Local TFTP failed… attempting remote HTTPS
set V6_ERR IPv6 appears to have failed… attempting IPv4…
set HTTPS_ERR HTTPS appears to have failed… attempting HTTP
set HTTP_ERR HTTP has failed, localbooting…
set site_name netboot.xyz
set boot_domain boot.netboot.xyz
set ipxe_version ${version}
set version 2.x
set conn_type https:start
echo ${bold}${fg_gre}${site_name} - ${fg_whi}v${version}${boldoff}
iseq ${site_name} netboot.xyz || echo ${bold}${fg_whi}Powered by ${fg_gre}netboot.xyz${fg_whi}${boldoff}
prompt --key m --timeout 4000 Hit the ${bold}m${boldoff} key to open failsafe menu… && goto failsafe || goto dhcp:dhcp
echo
dhcp || goto netconfig
isset ${next-server} && isset ${proxydhcp/next-server} && goto choose-tftp || set tftp-server ${next-server} && goto load-custom-ipxe:choose-tftp
Load “proxy settings” from root server
chain tftp://${next-server}/local-vars.ipxe || echo ${VARS_ERR}
Check if the proxy-dhcp-vars script has made any usable command about how to progress with a next-server and a proxy-next-server being set
isset ${use_proxydhcp_settings} && iseq ${use_proxydhcp_settings} true && goto set-next-server ||
prompt --key p --timeout 4000 DHCP proxy detected, press ${bold}p${boldoff} to boot from ${proxydhcp/next-server}… && set use_proxydhcp_settings true || set use_proxydhcp_settings false
goto set-next-server:set-next-server
iseq ${use_proxydhcp_settings} true && set tftp-server ${proxydhcp/next-server} || set tftp-server ${next-server}
goto load-custom-ipxe:load-custom-ipxe
isset ${tftp-server} && iseq ${filename} netboot.xyz.kpxe && goto tftpmenu ||
isset ${tftp-server} && iseq ${filename} netboot.xyz-undionly.kpxe && goto tftpmenu ||
isset ${tftp-server} && iseq ${filename} netboot.xyz.efi && goto tftpmenu ||
isset ${tftp-server} && iseq ${filename} netboot.xyz-snp.efi && goto tftpmenu ||
isset ${tftp-server} && iseq ${filename} netboot.xyz-snponly.efi && goto tftpmenu ||
isset ${tftp-server} && iseq ${filename} netboot.xyz-arm64.efi && goto tftpmenu ||
goto menu:failsafe
menu ${boot_domain} Failsafe Menu
item localboot Boot to local drive
item netconfig Manual network configuration
item vlan Manual VLAN configuration
item retry Retry boot
item debug iPXE Debug Shell
item reboot Reboot System
choose failsafe_choice || exit
goto ${failsafe_choice}:netconfig
echo Network Configuration:
echo Available interfaces…
ifstat
imgfree
echo -n Set network interface number [0 for net0, defaults to 0]: ${} && read net
isset ${net} || set net 0
echo -n IP: && read net${net}/ip
echo -n Subnet mask: && read net${net}/netmask
echo -n Gateway: && read net${net}/gateway
echo -n DNS: && read dns
ifopen net${net}
echo Attempting chainload of ${boot_domain}…
goto menu || goto failsafe:vlan
echo VLAN Configuration:
echo Available interfaces…
ifstat
imgfree
echo -n Set network interface number [0 for net0, defaults to 0]: ${} && read net
isset ${net} || set net 0
echo -n Set VLAN 802.1Q tag [0 to 4094]: ${} && read vlan
vcreate --tag ${vlan} net${net}
ifconf --configurator dhcp net${net}-${vlan} || echo DHCP failed trying manual && goto netvlan
echo Attempting chainload of ${boot_domain}…
goto menu || goto failsafe:netvlan
echo -n IP: && read net${net}-${vlan}/ip
echo -n Subnet mask: && read net${net}-${vlan}/netmask
echo -n Gateway: && read net${net}-${vlan}/gateway
echo -n DNS: && read dns
ifopen net${net}-${vlan}
echo Attempting chainload of ${boot_domain}…
goto menu || goto failsafe:tftpmenu
chain tftp://${tftp-server}/local-vars.ipxe || echo ${VARS_ERR}
isset ${hostname} && chain --autofree tftp://${tftp-server}/HOSTNAME-${hostname}.ipxe || echo Custom boot by Hostname not found trying MAC…
chain --autofree tftp://${tftp-server}/MAC-${mac:hexraw}.ipxe || echo Custom boot by MAC not found booting default…
chain --autofree tftp://${tftp-server}/menu.ipxe || echo ${TFTP_ERR} && goto menu:menu
:menu_https
set conn_type https
goto menu_start:menu_http
set conn_type http
goto menu_start:menu_start
isset ${netX/dns6} && goto menu_v6 || goto menu_v4
:menu_v6
isset ${netX/dns6_bak} && set netX/dns6 ${netX/dns6_bak} ||
set netX/dns6_bak ${netX/dns6}
echo Attempting ${conn_type} boot over IPv6…
chain --autofree ${conn_type}://${boot_domain}/menu.ipxe || echo ${conn_type} IPv6 failed… attempting IPv4…
clear netX/dns6
:menu_v4
echo Attempting ${conn_type} boot over IPv4…
chain --autofree ${conn_type}://${boot_domain}/menu.ipxe || echo ${conn_type} IPv4 failed…
iseq ${conn_type} https && goto menu_http || goto localboot:localboot
exit:retry
goto start:reboot
reboot
goto start:debug
echo Type “exit” to return to menu
shell
goto failsafe//////////////////////////////////////////////////////////////////////////
Huge thanks in advance ! You guys have ALWAYS been awesome helping with Fog (And non related issues as such)
-
@Cire3 said in Chainloading Simple Next Server ?:
server:ipv4 10.22.24.8
set newbootfile netboot.xyz.efi
set net0.dhcp/next-server ${newserver}You are missing the word set in the first line.
So I looked at the autoexec.ipxe file and this is what is in it :
OK then it looks like netboot.xyz uses ipxe (because of your autoexec.ipxe script)
So you might not need all of those set commands. Because FOG used iPXE as its boot loader AND netboot.xyz also uses iPXE, AND iPXE is already running in memory, all you should need to do is call that autoexec.ipxe script.
This is all that should be needed in the parameter block of the fog menu.
chain tftp://192.168.1.1/autoexec.ipxe || goto Menu
Where
192.168.1.1
is the ip address of your netboot.xyz boot server. There is a 50/50% chance of this not working because if they compiled custom stuff in iPXE that might be dependent.