iPXE discussion forum
Set fixed ip address to different servers - Printable Version

+- iPXE discussion forum (https://forum.ipxe.org)
+-- Forum: iPXE user forums (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: Set fixed ip address to different servers (/showthread.php?tid=9607)



Set fixed ip address to different servers - rodrigo.lima - 2017-05-06 15:07

Hi all,

I`m using ipxe to deploy kickstart files on my infrastructure. But, I would like to improve it.
I have dozens of servers in different datacenters, and these datacenters do not offer a dhcp service, then I need to set a fixed ip for each server. I would like to know if is possible to create only one iso image and only one menu.ipxe in this case.
Currently, I need to create various menu.ipxe for each server with a fixed address.

Thanks,


RE: Set fixed ip address to different servers - MultimediaMan - 2017-05-09 01:15

I feel your pain.

I use a generic menu script for the Menu UI, then I wrote a script to write an ${uuid)-network.ipxe script on the server from a MasterUUID.csv file.

The Output is something like this (this is for booting into the installer with the intention of installing in an NFS Roots environment via Serial TUI):

Code:
#ipxe
echo ${cls}

#GENERATED BY Build_UUID_network_iPXE.sh or Build_UUID_network_iPXE.cmd

#Filename output is ${uuid}-network.ipxe
#87891122-abab-cdcd-efef-1234abcd5678-network.ipxe

set hostname yourserver
set nfs_nic_one 1
set nfs_nic_two 6
set nfs_nic_order 1-2
set nfs_ip 10.100.1.100
set nfs_netmask 255.255.255.128
set nfs_server 10.100.1.10
set def_gateway 10.100.1.1
set def_menu_opt 2_OpenSuSE-nfs-bond
set dist_opt "OpenSuSE"

chain ${17}/NetBoot/iPXE/ipxelinux.cfg/OEM/SuSE/OpenSuSE_menu.ipxe || echo

chain ${17}/NetBoot/iPXE/ipxelinux.cfg/default/default-efi.ipxe || echo

#END

This could also be put into a PHP script which parses a read-only CSV file or queries a MySQL Database.

The OpenSuSE_menu.ipxe puts the variables set in the above script into parameters for booting the installer... e.g.:

Code:
#!ipxe
echo Booting OpenSuse Installer (AutoYast,ttyS0)...

initrd ${17}/Media-Depot/linux/OpenSuSE/x86_64/loader/initrd || echo
chain ${17}/Media-Depot/linux/OpenSuSE/x86_64/loader/linux initrd=initrd splash=verbose vga=0x314 showopts  install=${17}/Media-Depot/linux/OpenSuSE/x86_64/ autoyast=${17}/NetBoot/iPXE/ipxelinux.cfg/OEM/OpenSuSE/AutoYAST/${uuid}.xml insecure=1 console=ttyS0,115200 static_ips=${nfs_ip}:${nfs_server}:${def_gateway}:${nfs_netmask}:${hostname}:${n​et{nfs_nic_one}}:none:9000 earlycon=uart8250,io,0x3f8,115200n8 || echo

exit