From Bob Brandt's Projects Site

Linux: Setting up a PXE Boot Server

For a recent SLED (SuSE Linux Enterprise Desktop) rollout, I created a PXE Boot server. PXE (or Pre-eXecution Environment) Booting is where a machine BIOS uses DHCP and TFTP information to boot into an environment independent of the media on the server

To create a PXE Boot Server you need four things:

  1. A properly configured DHCP server.
  2. A properly configured TFTP server.
  3. A PXELINUX install properly setup.
  4. A Local Network Repository?

Creating a properly configured DHCP server.

So, the first thing that needs to be done is to create a properly configured DHCP server for PXE booting. This is normally not too hard, however for PXE booting, you need to make sure that in addition to the normal IP information you also send the PXE boot information to the workstation as well. To do this using a Netware DHCP server, following the steps below:

  1. On the Subnet Options Tab of the Subnet object property page, check the "Set Boot Parameter Option"
  2. Add the IP Address and Server Name of the TFTP server
  3. Add the filename of the PXELINUX.0 configuration file

On a Linux DHCP server you need to add three options to the dhcpd.conf file (either through YaST or manually). I recently found myself in a position where I needed to setup a PXEBoot Server on a client site where use of DHCP was forbidden. Fun! So in order to solve this problem I needed to create a DHCP server that would only respond to PXE requests but not normal DHCP requests. Below is the dhcpd.conf file I used:

# Custom dhcpd.conf file
#
# This configuration will only respond to PXE requests

default-lease-time 14400;
max-lease-time 7200;
ddns-update-style none;
ddns-updates off;
allow booting;
option domain-name "domain.name";
option domain-name-servers 192.168.99.40, 192.168.99.41;
option routers 192.168.0.1;

# Define rules to identify DHCP Requests from PXE devices
class "pxe" {
  match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
}

subnet 192.168.0.0 netmask 255.255.0.0 {
  pool {
    default-lease-time 180;      # no long lease time required for booting
    max-lease-time 360;          # booted system does its own dhcp request
    server-name "repository.domain.name";
    next-server repository.;     # in case your local DNS only handles
                                 # unqualified domains keep trailing '.'
    filename "pxelinux.0";
    allow members of "pxe";      # only allow pxe class
    range 192.168.99.30 192.168.99.39;
  }
}

Creating a properly configured TFTP server.

Once you have a DHCP server that is providing the PXE Boot information, you need to insure that the specified server is responding to TFTP (Trivial FTP) requests. Setting up a TFTP server on SLES10 is almost too simple!

  1. Make sure you have the TFTP package installed:
yast2 -i tftp
  1. Configure the server
yast2 tftp-server
  1. Make sure that the service is Enabled and that the "Boot Image Directory" is /tftpboot. The default is /srv/ftp.

Setting up a PXELINUX install properly.

PXELinux is a package include in the SYSLinux suite. (The web documentation can be found at http://syslinux.zytor.com/.) PXELINUX is a SYSLINUX derivative, for booting Linux off a network server, using a network ROM conforming to the Intel PXE specification. The process of installing SYSLinux and configuring it to work with the TFTP server we setup above is detailed below:

  1. Make sure that you have the SYSLINUX package installed
yast2 -i syslinux
  1. Copy the default PXE files to the Boot Image Directory specified above
cp /usr/share/syslinux/pxelinux.0 /tftpboot
  1. Copy the kernel and initrd files from your SLED10 installation media to the Boot Image Directory directory:
cp /(path to SLED10 media)/boot/i386/loader/linux /tftpboot/sled10.linux
cp /(path to SLED10 media)/boot/i386/loader/initrd /tftpboot/sled10.initrd
cp /(path to SLED10 media)/boot/i386/loader/memtest /tftpboot/memtest
  1. Create a pxelinux.cfg subdirectory under the tftp directory:
mkdir /tftpboot/pxelinux.cfg
  1. Copy the isolinux.cfg file from the installation media to this subdirectory and renaming it to default:
cp /(path to media)/boot/i386/loader/isolinux.cfg /tftpboot/pxelinux.cfg/default
  1. Copy the message file from the installation media to the pxelinux.cfg directory:
cp /(path to media)/boot/i386/loader/message /tftpboot/boot.msg

The isolinux.cfg and message files were copied over so we can use them as a template, but since we have renamed some of the files while they were copied across it is necessary to modify these new files.

gedit /tftpboot/pxelinux.cfg/default /tftpboot/boot.msg &

When editing the /tftpboot/pxelinux.cfg/default be sure to make the following changes:

  1. Modify the display line to reflect the new message filename boot.msg
  2. Modify all the kernel lines to reflect the new linux filename sled10.linux
  3. Modify all the append lines to reflect the new initrd filename sled10.initrd
  4. Comment out the gfxboot line. This command is part of a SuSE patch to the ISOLinux package. It is not part of the normal suite and is not available within PXELinux. If leave it in you get an error.
  5. You can also create/modify new sections as you please.

However if you change or add any of the labels within the default file, be sure to modify the boot.msg file as well.

The benefit of renaming the files allows you to copy additional kernels and make then available for booting. For instance, I created a PXE Boot server that allowed booting of the SLED and SLES installation programs (even thought they really aren't that different), Windows OS installations as well as a DSL (Damn Small Linux) distribution. The DSL distribution allows administrators to boot a machine directly into DSL much as they would with a Live CD. Allowing them to perform maintenance on the machine without booting the physical hard drive. How I created my machine was:

  1. Follow the directions above.
  2. Copy the linux and initrd files from the SLES10 installation media.
  3. Download Unattended and follow the instructions The step-by-step guide is very well written. (Note: I have not been able to get the windows virtual boot disks to run without the use of DHCP)
  4. Obtain and copy the DSL linux24 and minirt24.gz from the current dsl initrd.iso (This version has Knoppix pre-loaded into the minirt24.gz file). While there are many mirrors which can be found at http://www.damnsmalllinux.org/download.html I downloaded my iso from http://ftp.belnet.be/packages/damnsmalllinux/current/dsl-3.4-initrd.iso
  5. Create/modify custom default and boot.msg files using the documentation found at http://syslinux.zytor.com/faq.php.

Below are my custom files:

/tftpboot/pxelinux.cfg/default
# Custom default file for PXELinux

default harddisk
implicit	1
#gfxboot	bootlogo
display		boot.msg
f1		boot.msg
f2		f2.msg
f3		f3.msg
f4		f4.msg
f5		f5.msg
f6		f6.msg
prompt		1
timeout		400



# Boot to the local disk
label harddisk
  localboot 0x80

# Boot the SLED10 Desktop Linux install program
label desktop
  kernel sled10.linux
  append initrd=sled10.initrd splash=silent showopts instmode=http

label sled10
  kernel sled10.linux
  append initrd=sled10.initrd splash=silent showopts install=http://repository.opw.ie/SLED10sp1-DVD autoyast=http://repository.opw.ie/autoyast/linux.xml

label sled10ip
  kernel sled10.linux
  append initrd=sled10.initrd splash=silent showopts install=http://repository.opw.ie/SLED10sp1-DVD autoyast=http://repository.opw.ie/autoyast/linux.xml hostip=19.200.99.60/16 nameserver=19.200.99.40 gateway=19.200.1.0 

label sled10dual
  kernel sled10.linux
  append initrd=sled10.initrd splash=silent showopts install=http://repository.opw.ie/SLED10sp1-DVD autoyast=http://repository.opw.ie/autoyast/dualboot.xml

label sled10ipdual
  kernel sled10.linux
  append initrd=sled10.initrd splash=silent showopts install=http://repository.opw.ie/SLED10sp1-DVD autoyast=http://repository.opw.ie/autoyast/dualboot.xml hostip=19.200.99.60/16 nameserver=19.200.99.40 gateway=19.200.1.0 

label noacpi
  kernel sled10.linux
  append initrd=sled10.initrd splash=silent showopts acpi=off

label nolapic
  kernel sled10.linux
  append initrd=sled10.initrd splash=silent showopts nolapic

label failsafe
  kernel sled10.linux
  append initrd=sled10.initrd splash=silent showopts apm=off acpi=off mce=off barrier=off ide=nodma idewait=50 i8042.nomux psmouse.proto=bare irqpoll pci=nommconf

label sled10rescue
  kernel sled10.linux
  append initrd=sled10.initrd splash=silent rescue=1 showopts



# Boot the SLES10 Server Linux install program
label server
  kernel sles10.linux
  append initrd=sles10.initrd splash=silent showopts instmode=http

label sles10
  kernel sles10.linux
  append initrd=sles10.initrd splash=silent showopts install=http://repository.opw.ie/SLES10sp1-DVD

label sles10ip
  kernel sles10.linux
  append initrd=sles10.initrd splash=silent showopts install=http://repository.opw.ie/SLES10sp1-DVD hostip=19.200.99.60/16 nameserver=19.200.99.40 gateway=19.200.1.0

label sles10rescue
  kernel sles10.linux
  append initrd=sles10.initrd splash=silent rescue=1 showopts


# Boot Damn Small Linux
label dsl
  kernel dsl.linux24
  append ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=dsl.minirt24.gz nomce noapic quiet BOOT_IMAGE=knoppix


# Boot unattended Windows Install - Linux Boot Disk

label windows

  kernel unattended.bzImage

# Add options (z_user=..., z_path=..., etc.) to this line.

  append initrd=unattended.initrd z_path==//repository.opw.ie/Windows




# Boot unattended Windows Install - Dos Boot Disk


label dos
  kernel unattended.dos/memdisk
  append initrd=unattended.dos/undis3c.imz keeppxe

label undis3c
  kernel unattended.dos/memdisk
  append initrd=unattended.dos/undis3c.imz keeppxe

label b44
  kernel unattended.dos/memdisk
  append initrd=unattended.dos/b44.imz

label b57
  kernel unattended.dos/memdisk
  append initrd=unattended.dos/b57.imz

label dc21x4
  kernel unattended.dos/memdisk
  append initrd=unattended.dos/dc21x4.imz

label dp83815
  kernel unattended.dos/memdisk
  append initrd=unattended.dos/dp83815.imz

label e100b
  kernel unattended.dos/memdisk
  append initrd=unattended.dos/e100b.imz

label e1000
  kernel unattended.dos/memdisk
  append initrd=unattended.dos/e1000.imz

label elpc575
  kernel unattended.dos/memdisk
  append initrd=unattended.dos/elpc575.imz

label el556
  kernel unattended.dos/memdisk
  append initrd=unattended.dos/el556.imz

label el90x
  kernel unattended.dos/memdisk
  append initrd=unattended.dos/el90x.imz

label el94x
  kernel unattended.dos/memdisk
  append initrd=unattended.dos/el94x.imz

label fetnd
  kernel unattended.dos/memdisk
  append initrd=unattended.dos/fetnd.imz

label ngrpci
  kernel unattended.dos/memdisk
  append initrd=unattended.dos/ngrpci.imz

label pcntnd
  kernel unattended.dos/memdisk
  append initrd=unattended.dos/pcntnd.imz

label rtsnd
  kernel unattended.dos/memdisk
  append initrd=unattended.dos/rtsnd.imz

label rtgbnd
  kernel unattended.dos/memdisk
  append initrd=unattended.dos/rtgbnd.imz

label sis900
  kernel unattended.dos/memdisk
  append initrd=unattended.dos/sis900.imz



# Memory Test
label memtest
  kernel memtest

/tftpboot/boot.msg

                             09OPW PXE Installations:07

0aAvailable Options:07
 harddisk     - Boot from Harddisk (this is default)                           

 desktop      - Boot the standard desktop linux install                        
 sled10       - OPW Desktop Installation                                       
 sled10ip     - OPW Desktop Installation (19.200.99.60)                        
 sled10dual   - Dualboot Desktop Installation                                  
 sled10ipdual - Dualboot Desktop Installation (19.200.99.60)                   
 server       - Boot the standard server linux install                         
 sles10       - OPW Server Installation                                        
 sles10ip     - OPW Server Installation (19.200.99.60)                         

 dsl          - DSL Live Distribution (will not affect current installation)   

 windows      - Install Windows Operating Systems (z_path=//myserver/myshare)  
 dos          - Install Windows Operating Systems using DOS Boot Disk          

 memtest      - Memory Test                                                    


05[F1-Main] [F2-SuSE Options] [F3/F4-DOS Options] [F5/F6-DSL Options]07
/tftpboot/f2.msg (provides information on how to modify the SLE installation kernel)

                              09SuSE Linux Enterprise07

0aSuSE Linux Enterprise 10 accept the following options:07
 kernel can be {desktop | sled10 | server | sles10}

 desktop is the basic desktop kernel without options                           
 sled10  is desktop with install and autoyast options already set              
 server  is the basic server kernel without options                            
 sles10  is server with install and autoyast options already set               

 kernel hostip=xxx.xxx.xxx.xxx/yy       IP Address and Mask                    
 kernel netmask=xxx.xxx.xxx.xxx         Mask if not specified above            
 kernel gateway=xxx.xxx.xxx.xxx         Default Route                          
 kernel nameserver=xxx.xxx.xxx.xxx      Domain Name Server                     
 kernel insmod=                         Additional Kernel modules to load      
 kernel install=http://server/folder    Network Repository                     
 kernel instmode=http                   Installation Mode if install is missing
 kernel autoyast=http://server/xml      Autoyast control file                  

 noacpi or nolapic                      based on the desktop kernel            
 failsafe                               (Almost) no hardware-detection         

05[F1-Main] [F2-SuSE Options] [F3/F4-DOS Options] [F5/F6-DSL Options]07
/tftpboot/f3.msg (Just a slightly modified version of the unattended DOS f2 file)

                         09Additional DOS Network Drivers07

0aThese are additional network drivers that you can choose:07
 undis3c  Universial DOS driver
 b44      Broadcom BCM440x family
 b57      Broadcom BCM57xx "Tigon3" family
 dc21x4   DEC/Intel 2104x/2114x "Tulip" family
 dp83815  Natsemi 83815 "MacPHYTER" family (e.g., Netgear FA311/FA312)
 e100b    Intel Pro/100 family of PCI and CardBus adapters
 e1000    Intel Pro/1000 family of gigabit adapters
 elpc575  3com 3c575 family of CardBus adapters
 el556    3com 3c556 family of mini-PCI adapters
 el90x    3com 3c59x/3c90x family of PCI and CardBus adapters
 el94x    3com 3c94x/3c2000 family of gigabit adapters
 fetnd    VIA VT86C100A/6102/6105 "Rhine" family (e.g., D-Link DFE-530TX)
 ngrpci   Netgear FA310
 pcntnd   AMD PCNet family (also VMWare)
 rtsnd    Realtek RTL8139 family (e.g., D-Link DFE-530TX+)
 rtgbnd   Realtek RTL8169/8110S Gigabit family
 sis900   SiS 900 family


05[F1-Main] [F2-SuSE Options] [F3/F4-DOS Options] [F5/F6-DSL Options]07
/tftpboot/f4.msg (Just a renamed version of the unattended DOS f3 file)

                             09General DOS Information07

This is a system for fully automating the installation of Windows 2000,
Windows XP, and Windows Server 2003.

Features include:

  * Automated install of OS, hotfixes, and applications
  * Full documentation and source code
  * Support for floppy, CD-ROM, and "nothing but net" installs
  * True unattended installation, 0cnot07 disk imaging
  * No Windows servers required; use your Unix servers instead
  * No Unix servers required; use your Windows servers after all
  * Completely free 

When you are finished setting up Unattended, you will be able to boot
any PC from a floppy, from a CD-ROM, or directly from the network,
answer a few questions, and come back an hour or two later to a
fully-installed Windows workstation.



05[F1-Main] [F2-SuSE Options] [F3/F4-DOS Options] [F5/F6-DSL Options]07
/tftpboot/f5.msg (Just a renamed version of the DSL f2 file)

                                   09DSL Options07

0aDSL accepts the following boot time options:07
 fb1280x1024 | fb1024x768 | fb800x600     Framebuffer mode (for notebooks)     
 dsl vga=normal                           Safest video mode (see F6 for more)  
 dsl xsetup                               Prompt user for X setup              
 dsl noicons                              If booting to X use plain desktop    
 dsl mydsl={hda1|sda1}                    Restore myDSL apps (default to cdrom)
 dsl base                                 Skip myDSL load only the base system 
 dsl norestore                            Turn off the automatic restore       
 dsl restore={hda1|sda1|floppy}           Specify saved configuration location 
 dsl toram                                Load CD into RAM and run (128+ MB)   
 dsl tohd=/dev/hda1                       Copy CD to HD partition and run      
 dsl fromhd=/dev/hda1                     Boot from previously copied CD-Image 
 dsl {ssh|lpd|cron|fuse|nfs|syslog|monkey|ftp} Start various daemons at boot   
 dsl lang=us (cs da de es fr nl it pl ru sk ...)     Choose Language/Keyboard  
 dsl no{scsi|pcmcia|usb|agp|swap|apm|apic|mce|ddc}   Disable HW-detection      
 dsl dma                                  Turn on DMA accel. for all drives    
 dsl 2                                    Runlevel 2, Textmode only            
 failsafe                                 (Almost) no hardware-detection       
 expert                                   Interactive startup/setup            

05[F1-Main] [F2-SuSE Options] [F3/F4-DOS Options] [F5/F6-DSL Options]07
/tftpboot/f6.msg (Just a renamed version of the DSL f3 file)

                                   09DSL Options07

0aDSL accepts the following boot time vga options:07
 Color            640x480     800x600      1024x768     1280x1024              
   256    8 bit     769         771           773          775                 
 32000   15 bit     784         787           790          793                 
 65000   16 bit     785         788           791          794                 
 16.7M   24 bit     786         789           792          795                 

 dsl vga=7xx                              7xx from table above                 
 dsl secure                               Prompt for root and dsl passwords    
 dsl protect                              Password encrypted backup            
 dsl host=xxxx                            Set hostname to xxxx                 
 dsl minimal                              Starts X with Minimal theme          
 dsl desktop={fluxbox|jwm}                Starts with fluxbox or Joe's WM      
 dsl waitusb                              Waits for slow USB devices           
 dsl legacy                               Boots without unionfs                
 dsl dosswapfile{=hda1}                   Scan or Specify dosswapfile          
 dsl checkfs                              fscks unmounted filesystems          
 lowram             Starts X, Minimal, noicons, nousb, noscsi, noideraid, etc. 
 install            No X, CLI installation menu for hard drive, frugal, floppy.

05[F1-Main] [F2-SuSE Options] [F3/F4-DOS Options] [F5/F6-DSL Options]07

References:

Retrieved from /projects/pmwiki.php?n=Linux.PXEBoot
Page last modified on November 04, 2007, at 09:22 PM