Preboot Execution Environment is an useful way to make machine booting without using a system installed on a physical disk. It is very useful for testing purposes, rescue system or for making “thin clients”.

The services needed to get everything works are:

  • the dhcp server that istruct the clients requesting an ip, where to get files for booting;
  • the tftp server that sent kernel images and initrds.
  • the nfs server that serve the root partition for clients;

DHCP
This is a basic subnet declaration with added lines for pxe:
[sourcecode language='c']subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.51 192.168.1.89;
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
default-lease-time 600;
max-lease-time 7200;
filename “pxelinux.0″;
next-server 192.168.1.10;
}[/sourcecode]

filename specified is the file that the client should request to the tftp server and that it should execute (pxelinux) for proper booting. Next-server must be specified if the tftp server is elsewhere outside the machine serving dhcp: in this example, my dhcp server is on 192.168.1.1, and the tftp server is on 192.168.1.10.

Now, we configure the folder served by tftp (usually /var/lib/tftpboot if you apt-get install tftpd-hpa)
[sourcecode language='c']cd /var/lib/tftpboot
wget http://ftp.debian.org/debian/dists/etch/main/installer-i386/current/images/netboot/pxelinux.0
mkdir pxelinux.cfg
nano -w pxelinux.cfg/default[/sourcecode]
You can get the pxe executable where you want, i am taking the one distributed with the netboot images of debian etch.
pxelinux.cfg is a folder that contains it’s configuration files, that can be different for every machines that is booting from network, based on the mac address of the ethernet card. If you name the configuration file “default”, it will be used by every machine that is netbooting.

[sourcecode language='c']DEFAULT debian

LABEL debian
kernel debian/vmlinux
append vga=normal initrd=debian/initrd.img root=/dev/nfs nfsroot=192.168.1.10:/home/pxe_root rw –

LABEL debian-install
kernel debian-installer/i386/linux
append vga=normal initrd=debian-installer/i386/initrd.gz locale=it —

LABEL sysrescuecd
kernel sysrescuecd/rescuecd
append initrd=sysrescuecd/initram.igz root=/dev/ram0

PROMPT 1
TIMEOUT 100[/sourcecode]

Here there are 3 system: one is a full installed debian, with the root folder server via nfs; the second is a netinst image of debian, which can be used to install debian without using CDs nor Removable Device; the third, is a SystemRescueCD system.

http://ftp.nl.debian.org/debian/dists/testing/main/installer-i386/current/images/netboot/

Here you can find the image of the installer for lenny, named netboot.tar.gz.

For building a debian base system to be served via nfs, you can use the debootstrap utility:
[sourcecode language='c']mkdir /home/pxe_root
debootstrap lenny /home/pxe_root[/sourcecode]
and copy kernel and initrd in /var/lib/tftpboot

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • Slashdot
  • Twitter
  • email
  • LinkedIn