tftp booting

Posted by on Jan 14, 2013 in Linux, tftp booting debian | 0 comments

apt-get install tftpd-hpa

#Defaults for tftpd-hpa
RUN_DAEMON=”yes”
OPTIONS=”-l -s /var/lib/tftpboot”
root@itchy:~# mkdir -p /var/lib/tftpboot
root@itchy:~# /etc/init.d/tftpd-hpa start
Starting HPA’s tftpd: in.tftpd.

————————————-

root@itchy:~# apt-get install dhcp3-server

Once installed the server is configured in the file /etc/dhcp3/dhcpd.conf, and there are a lot of available options described there. For our example we’ll use the following configuration:

option domain-name-servers 62.31.64.39, 62.31.112.39;
default-lease-time 86400;
max-lease-time 604800;
authoritative;

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.70 192.168.1.100;
filename “pxelinux.0”;
next-server 192.168.1.50;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
}
—————————

PXE Configuration

Now that we’ve configured the TFTP and DHCP servers we need to go back and complete the configuration. By default when a client boots up it will use its own MAC address to specify which configuration file to read – however after trying several options it will fall back to requesting a default file.

We need to create that that file, which will contain the list of kernels which are available to boot, we’ll firstly need to create a directory to hold it:

root@itchy:~# mkdir /var/lib/tftpboot/pxelinux.cfg

Now save the following as /var/lib/tftpboot/pxelinux.cfg/default:

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

This file instructs the client to display the contents of the file boot.txt so create that too:

– Boot Menu –
=============

etch_i386_install
etch_i386_linux
etch_i386_expert
etch_i386_rescue

The only remaining job is to download the official squeeze installer kernel and associated files and save them in the directories specified in the default file we created:

cd /var/lib/tftpboot/
wget http://ftp.uk.debian.org/debian/dists/etch/main/installer-i386/current/images/netboot/debian-installer/i386/pxelinux.0

mkdir -p /var/lib/tftpboot/debian/squeeze/amd64
cd /var/lib/tftpboot/debian/squeeze/amd64
wget http://ftp.uk.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux
wget http://ftp.uk.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz

When these commands have been completed we’ll have the following structure:

root@itchy:~# tree /var/lib/tftpboot/
/var/lib/tftpboot/
|– boot.txt
|– debian
| `– etch
| `– i386
| |– initrd.gz
| `– linux
|– pxelinux.0
`– pxelinux.cfg
`– default

4 directories, 5 files

Click the Green box to get Ri-Tech Remote help Download