Wednesday, August 12, 2009

August 12th 2009 - Debian Netboot server working

Broadcast message from user@localhost

Today (at midnight) I had a working netboot server under my debian installation in my netbook. I followed a couple tutorials ( 'Debian Administration :: Setting up a server for PXE network booting' and 'DebianLive/Howto/Creating a Test environment - Debian Wiki' )

First I had to assign a static ip address to the wired network interface eth0, so I list the necesary setup which most of us already know about.

# cat /etc/network/interfaces
iface eth0 inet static
allow-hotplug eth0
auto eth0

Right after I installed the dhcp3-server and tftpd-hpa
# apt-get install dhcp3-server tftpd-hpa

The booting process goes as follows
  • The host request a ip address using the dhcp protocol.
  • The dhcp server assign an address to the host and sends a boot rom or a list of the available boot roms to let the user pick one. Once picked the kernel boots
With the necessary programs and the (very basic) background I post my sample configuration:
  • The configuration for the dhcp server
# cat /etc/dhcp3/dhcpd.conf
option domain-name "";
default-lease-time 86400;
max-lease-time 604800;

allow booting;
allow bootp;

subnet netmask {
filename "pxelinux.0";
option subnet-mask;
option broadcast-address;
option routers;
  • The configuration for the tftp server
# cat /etc/default/tftpd-hpa
#Defaults for tftpd-hpa
OPTIONS="-l -s /var/lib/tftpboot"

After configuring we must create some files in the tftp root directory (/var/lib/tftpboot in this case)
  • Create the pxelinux directory
mkdir -p /var/lib/tftpboot/pxelinux.cfg
  • Create the default entry
touch /var/lib/tftpboot/pxelinux.cfg/default
  • Create the boot selection text
touch /var/lib/tftpboot/boot.txt
  • * Download a sample pxe boot rom
cd /var/lib/tftpboot/
  • Download a sample kernel and initrd to boot
mkdir -p /var/lib/tftpboot/debian/etch/i386
cd /var/lib/tftpboot/debian/etch/i386
  • Fill the pxelinux.cfg/default file
DISPLAY boot.txt

DEFAULT etch_i386_install

LABEL etch_i386_install
kernel debian/etch/i386/linux
append vga=normal initrd=debian/etch/i386/initrd.gz --
LABEL etch_i386_linux
kernel debian/etch/i386/linux
append vga=normal initrd=debian/etch/i386/initrd.gz --

LABEL etch_i386_expert
kernel debian/etch/i386/linux
append priority=low vga=normal initrd=debian/etch/i386/initrd.gz --

LABEL etch_i386_rescue
kernel debian/etch/i386/linux
append vga=normal initrd=debian/etch/i386/initrd.gz rescue/enable=true --

  • Fill the boot.txt file
- Boot Menu -


The pxelinux syntax us very similar to syslinux/isolinux/extlinux syntax because all these are a family of boot loaders (see for details)

With all the configuration done I proceed to connect the machines. since this is a basic test I kept the connection simple with a crossover cable

After a few tries I restarted three rc scripts and everything worked

# /etc/init.d/networking restart
# /etc/init.d/tftpd-hpa restart
# /etc/init.d/dhcp3-server restart

And the final result (after finding out the correct order to restart the services in order to make this work).

I set my netbook to be dhcp and pxe boot server, with the correct modifications this will work in the lab and on the flisol netinstall event.

init 0 ;

No comments:

Post a Comment