Wednesday, August 12, 2009

August 12th 2009 - Debian Netboot server working

Broadcast message from user@localhost
hi

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
network 192.168.233.0
address 192.168.233.64
netmask 255.255.255.0
gateway 192.168.233.254
broadcast 192.168.233.255
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 "lidsol.org";
default-lease-time 86400;
max-lease-time 604800;
authoritative;

allow booting;
allow bootp;

subnet 192.168.233.0 netmask 255.255.255.0 {
range 192.168.233.70 192.168.233.100;
filename "pxelinux.0";
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.233.255;
option routers 192.168.233.64;
}
  • The configuration for the tftp server
# cat /etc/default/tftpd-hpa
#Defaults for tftpd-hpa
RUN_DAEMON="yes"
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/
wget http://ftp.mx.debian.org/debian/dists/etch/main/installer-i386/current/images/netboot/debian-installer/i386/pxelinux.0
  • Download a sample kernel and initrd to boot
mkdir -p /var/lib/tftpboot/debian/etch/i386
cd /var/lib/tftpboot/debian/etch/i386
wget http://ftp.mx.debian.org/debian/dists/etch/main/installer-i386/current/images/netboot/debian-installer/i386/linux
wget http://ftp.mx.debian.org/debian/dists/etch/main/installer-i386/current/images/netboot/debian-installer/i386/initrd.gz
  • 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 --

PROMPT 1
TIMEOUT 0
  • Fill the boot.txt file
- Boot Menu -
=============

etch_i386_install
etch_i386_linux
etch_i386_expert
etch_i386_rescue

The pxelinux syntax us very similar to syslinux/isolinux/extlinux syntax because all these are a family of boot loaders (see http://syslinux.zytor.com/wiki/index.php 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