Saturday, January 8, 2011

Setting up my PXE boot server

This is basically a summary for my own records of my PXE boot configuration in case I want to rebuild it. It is quite specific to the distributions I want to access via PXE and to my configuration, so other guides will probably be more useful for readers.

Structure:
.
|-- debian
|   `-- testing
|       `-- amd64
|           |-- initrd.gz
|           `-- linux
|-- menu.c32
|-- pxelinux.0
|-- pxelinux.cfg
|   |-- default
|   `-- trinity
`-- trinity
    |-- ...lots of files...

With files sourced from:

The folder structure is mounted (or directly in) /var/lib/tftpboot, and it is exported using NFS (for TRK) by the following configuration line in /etc/exports:

/var/lib/tftpboot/trinity *(ro,no_root_squash,no_subtree_check)

The folder structure is also exposed using tftpd-hpa (not tftpd) and the DHCP server is using Tomato on my router with the following configuration line in Advanced -> DHCP / DNS -> Dnsmasq custom configuration:

dhcp-boot=pxelinux.0,,192.168.1.13

There is some duplication between the two files, but I was happy enough to get them working as I wanted. If I had more time, I would look into MENU INCLUDE.

This is the configuration file called default.
default menu.c32
prompt 0

menu title Welcome to My Network Boot Menu
menu color tabmsg 37;40      #80ffffff #00000000
menu color hotsel 30;47      #40000000 #20ffffff
menu color sel 30;47      #40000000 #20ffffff
menu color scrollbar 30;47      #40000000 #20ffffff

MENU WIDTH 75
MENU MARGIN 5
MENU PASSWORDMARGIN 3
MENU ROWS 18
MENU TABMSGROW 22
MENU CMDLINEROW 22
MENU ENDROW 24
MENU PASSWORDROW 11
MENU TIMEOUTROW 23

label 1
menu label Debian Install
kernel debian/testing/amd64/linux
append vga=normal initrd=debian/testing/amd64/initrd.gz  --

label 2
menu label Debian Expert Install
kernel debian/testing/amd64/linux
append priority=low vga=normal initrd=debian/testing/amd64/initrd.gz  --

label 3
menu label Debian Rescue
kernel debian/testing/amd64/linux
append vga=normal initrd=debian/testing/amd64/initrd.gz rescue/enable=true --

label 4
menu label Trinity
kernel menu.c32
append pxelinux.cfg/trinity

The following configuration file was generated by trk3/mkpxelinux in the TRK, but I modified it to find kernel.trk and initrd.trk in the trinity sub-folder, then renamed it to trinity:

VIM commands:
:%s/kernel\.trk/trinity\/kernel.trk/g
:%s/initrd\.trk/trinity\/initrd.trk/g
:%s/vesamenu\.c32/menu.c32/g

This is the configuration file called trinity.
default menu.c32
prompt 0

menu title     build 367
menu color tabmsg 37;40      #80ffffff #00000000
menu color hotsel 30;47      #40000000 #20ffffff
menu color sel 30;47      #40000000 #20ffffff
menu color scrollbar 30;47      #40000000 #20ffffff

MENU WIDTH 75
MENU MARGIN 5
MENU PASSWORDMARGIN 3
MENU ROWS 18
MENU TABMSGROW 22
MENU CMDLINEROW 22
MENU ENDROW 24
MENU PASSWORDROW 11
MENU TIMEOUTROW 23


label trk3
menu label  Run ^Trinity Rescue Kit 3.4 (default mode, with text menu)
kernel trinity/kernel.trk
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp  splash=verbose pci=conf1 trkmenu
timeout 100

label 1
menu label ^1 : TRK 3.4 in failsafe mode (No menu, VGA, noacpi, noapic)
kernel trinity/kernel.trk
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose acpi=off noapic pci=conf1 vga=1

label 2
menu label ^2 : TRK 3.4 running from RAM (best >= 512mb, 256mb min)
kernel trinity/kernel.trk
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose pci=conf1 trkinmem trkmenu

label 3
menu label ^3 : TRK 3.4 - Run 'mclone' in client mode (!)
kernel trinity/kernel.trk
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose pci=conf1 mclone

label 4
menu label ^4 : TRK 3.4 in simple VGA mode (debugging of kernel output)
kernel trinity/kernel.trk
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=1 pci=conf1 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=off trkmenu

label 5
kernel trinity/kernel.trk
menu label ^5 : TRK 3.4 with Belgian keyboard (use menu for other)
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose pci=conf1 keyb_be trkmenu

label 6
kernel trinity/kernel.trk
menu label ^6 : TRK 3.4 - Virusscan all drives (Clamav, non interactive)
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose pci=conf1 virusscan

label 7
kernel trinity/kernel.trk
menu label ^7 : TRK 3.4 - Try more pcmcia and usb nics (when not detected)
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose pci=conf1 pcmcia trkmenu

label 8
kernel trinity/kernel.trk
menu label ^8 : TRK 3.4 - Try more SCSI drivers (when disks not detected)
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose pci=conf1 scsidrv trkmenu

label 9
kernel trinity/kernel.trk
menu label ^9 : TRK 3.4 with a secure shell server enabled
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose pci=conf1 sshd

label 10
kernel trinity/kernel.trk
menu label 10: TRK 3.4 - E^xecute local scripts on harddrive of PC
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose pci=conf1 locscr

label 11
menu label 11: TRK 3.4 as bootserve^r to boot other TRK clients
kernel trinity/kernel.trk
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose pci=conf1 trkbootnet trkmenu

label 12
kernel trinity/kernel.trk
menu label 12: TRK 3.4 - Fileshare all drives as ^guest, no security
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose pci=conf1 smbguest trkmenu

label 0
kernel trinity/kernel.trk
menu label 13: TRK 3.4 - ^Single user mode (no menu)
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose pci=conf1 runlevel 1

label noacpi
kernel trinity/kernel.trk
menu label 14: TRK 3.4 - Acpi=off, noapic  PCI=^bios (Alternate boot 1)
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose acpi=off noapic pci=bios trkmenu

label pcinormal
kernel trinity/kernel.trk
menu label 15: TRK 3.4 - ^Acpi=off, noapic PCI=any (Alternate boot 2)
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose acpi=off noapic trkmenu

label pciconf1
kernel trinity/kernel.trk
menu label 16: TRK 3.4 - ^PCI=conf2 (Alternate boot 3)
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose pci=conf2 trkmenu

label debug
menu label 17: TRK 3.4 - ^Verbose startup for debugging (no menu)
kernel trinity/kernel.trk
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose pci=conf1 debugging

label 18
menu label 18: TRK 3.4 - SSH, boot- and guest ^fileserver, run from RAM
kernel trinity/kernel.trk
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose pci=conf1 sshd trkinmem smbguest trkbootnet trkmenu

label 19
menu label 19: TRK 3.4 - Run from RAM, run m^clone as client
kernel trinity/kernel.trk
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose pci=conf1 trkinmem mclone

label 20
menu label 20: TRK 3.4 with prox^yserver support enabled
kernel trinity/kernel.trk
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose pci=conf1 proxy trkmenu

label 21
menu label 21: TRK 3.4 - All devices set to read-only
kernel trinity/kernel.trk
append initrd=trinity/initrd.trk ramdisk_size=65536 root=/dev/ram0 vga=788 trknfs=192.168.1.13:/var/lib/tftpboot/trinity ip=::::::dhcp splash=verbose pci=conf1 allro

label t
menu label 22: ^Memory tester: Memtest86+ v1.65
kernel memtest.x86

0 comments:

Post a Comment