PXE Booting from NSLU2
Wouldn't it be great if you could boot up a machine entirely from the network! This is particular useful if you wish to
- Run diskless Plop Linux
- Perform a Symantec GHOST backup
I will show the basics of how setup PXE, DHCP, a DOS network boot image and PloP linux.
Our Setup
This is the configuration of our environment:
- We're working with a small network 192.168.1.0/24
- We'll allow all local machines to boot and get an IP address via DHCP from the range 196.168.1.100 - 192.168.1.150
- Our “boot-server” is the host “herman” with default IP address 192.168.1.77
- Our “dhcp-server” is a linksys WRT54g running DD-WRT v23 sp2
Software install
Install the following software (once again, an internet connection is required):
ipkg install xinetd ipkg install tftp-hpa (the tfptd server)
Check that /opt/etc/xinetd.conf has the following:
defaults { only_from = localhost 192.168.1.0/24 instances = 60 log_type = SYSLOG authpriv info log_on_success = HOST PID log_on_failure = HOST cps = 25 30 } includedir /opt/etc/xinetd.d
Also check that /opt/etc/xinetd.d/tftp looks like this:
service tftp { flags = REUSE socket_type = dgram protocol = udp instances = 30 wait = yes user = root server = /opt/sbin/in.tftpd server_args = -vt 30 -c -s /opt/tftpboot cps = 100 2 log_on_success = HOST PID log_on_failure = HOST disable = no }
At first, the default setup only allows overwriting existing files so the -c option has to be added to server_args as shown above. The last server_args option (-s /opt/tftpboot) in the tftp file insures that all files will be deposited on the /opt/tftpboot directory so you don't have to specify where to put your files or remember which directory you put them in later.
Setting up the TFTPBOOT area
We will now setup the /opt/tftpboot directory. The finish product will look like this:
-bash-3.2# cd /opt/tftpboot -bash-3.2# ls -lR -rw-r--r-- 1 root root 269 Apr 13 09:02 display.msg -rw-r--r-- 1 root root 23540 Aug 16 2004 memdisk -rw-r--r-- 1 root root 94356 Nov 11 2004 memtest -rw-r--r-- 1 root root 14646 Apr 10 10:30 pxelinux.0 -rw-r--r-- 1 root root 1474560 Apr 12 19:46 unet.img pxelinux.cfg: total 4 -rw-r--r-- 1 root root 580 Apr 13 09:06 default
First we will create the PXE boot directory pxelinux.cfg
-bash-3.2# mkdir pxelinux.cfg -bash-3.2# chmod 755 pxelinux.cfg
Into this directory will be place the following contents named default
timeout 0 prompt 1 display display.msg label localdisk localboot 0 label unet KERNEL memdisk APPEND initrd=unet.img keeppxe label memtest KERNEL memtest
The keeppxe option allows the usage of the 3com UNDI driver.
Make sure you take note of the permission that these file have. If they are not others and group readable TFTP will not be able to access them.
Create the following display text
***** PXE Boot Menu ***** localdisk - Normal boot from local disk unet - PCDOS7 Universal Network boot memtest - Memory test
Take the entire contents here including the trailing <CR/LF> sequences. We do this so that the boot: prompt will appear several lines down from our display text.
Into the /opt/tftpboot directory place the following images:
- pxelinux.0 - from the SYSLINUX distribution
- unet.img - prebuilt PCDOS 7 Universal TCP/IP network boot disk
You can take a peek inside these .IMG files on the NSLU by doing the following. You'll need two additional modules if these are not already installed.
ipkg install kernel-module-isofs ipkg install kernel-module-loop mkdir floppy mount -o loop unet.img floppy
Universal TCP/IP Boot disk
If you want to build your own Universal TCP/IP boot disk then I suggest you start by creating a PCDOS7 floppy in a Virtual floppy drive and go from there.
- pcdos700.zip - PC DOS creation
- vfd21-080206.zip - Virtual floppy drive
- WinImage - may also come in handy.
DHCP
Personally I use the dnsmasq package to provide DHCP services upon my LAN, since this is small and simple and provides other useful abilities, setting up PXE booting with dnsmasq just requires the addition of the following line. This done via the “Administration (Level 1 TAB) > Services (Level 2 TAB)” and entering the following into the “Additional DNS Options” textbox.
dhcp-boot=pxelinux.0,herman,192.168.1.77
(Again we've setup the filename along with the name and IP address of the TFTP server which is “herman” / 192.168.1.77 in this example)
BOOTING UNET
The PXE boot process. The PXE boot menu has purposely not been display by making sure we have the wrong attributes on the display.msg file.
PXE Boot message. A Ctrl-L at the beginning of the file ensure the screen is blanked before display. The Colour has been added by wrapping field like so:
^L^O0e ***** PXE Boot Menu *****^O07 ^O0elocaldisk^O07 - Normal boot from local disk ^O0eunet^O07 - PCDOS7 Universal Network boot
Booting the unet.img image
GHOST
So now we have DOS being remotely transfer via PXE firing up ghost is easy. We create a new network share an on this share we put a copy of ghost.
N:\> NET USE G: \\192.168.1.77\backup N:\> G: G:\> GHOST
Given the G: drive is visible to GHOST we can now perform network backup and restores.
Plop Linux
Installing and configuring PLOP Linux requires only a few changes to what we already have in place.
Construct a new PXE menu boot up screen: /opt/tftpboot/display.msg
^L^O0e ***** PXE Boot Menu *****^O07 ^O0elocaldisk^O07 - Normal boot from local disk ^O0eunet^O07 - PCDOS7 Universal Network boot ^O0memtest^O07 - Memory test ^O0plop^O07 - PloP Linux
An additional entry in our PXE linux configuration file /opt/tpftpboot/pxelinux.cfg/default
label plop kernel ploplinux/bzimage append initrd=ploplinux/initrfs.gz vga=0 nfsmount=192.168.1.77:/opt/tftpboot/ploplinux
Into the /opt/tftpboot directory we expand the ploplinux.tgz archive.
# cd /opt/tftpboot # tar zxf ploplinux.tgz
Make sure we have NFS installed on the NSLU
# ipkg install nfs-utils
Modify the /etc/exports file to make the /opt/tftpboot/ploplinux directory available
/opt/tftpboot/ploplinux 192.168.1.0/255.255.255.0(ro,no_subtree_check)
After making this change make it current
# exportfs -a # showmount -e Export list for herman: /opt/tftpboot/ploplinux 192.168.1.0/255.255.255.0
BOOT IT UP