sockmuppet.com
Home::HowTo::PXE
I recently purchased a miniITX based PC to act as the home network
router, firewall, mail server, etc. Equipped with a 30Gb 2.5" HDD, this completely fanless machine
(from Lex) is a
functional workstation and file server, whilst costing only a little
more than an appliance router/firewall.
However, the PC is not equipped with a floppy or optical drive, raising
the question of how to install an OS on it. A number of options were
available:
- Boot from a USB CDROM or HDD. Nice idea, but I don't own one, and
the PC only supports USB 1.1, which would be rather slow.
- Put the HDD in another machine, do the install, and replace it.
That would require buying a wiring adapter to put the 2.5" drive in a
desktop machine.
- Use the IDE connector on the motherboard to attach an optical
drive, powered by a separate PSU. I really didn't like the idea of
having a separate PSU hooked up to the machine. Who knows how well
isolated power and data ground are?
- Network boot. Cool :)
I remembered the bizarre wonder I felt when I network booted an old
SparcStation2 a few years back. It's really weird seeing a machine doing
something useful without a local disk. Don't know why. Anyway, I figured
network booting this machine was the way to go. I would then do a
network install of the OS to the local drive. Over 100Mbps ethernet, it
shouldn't be too slow either.
A few downloads to my existing server were required:
Client PC configuration
The PC was initially configured to network boot. The parameters can be
found in the RealTek Boot Agent, which can be configured by pressing
Shift-F10 as indicated as each network interface is initialised when the
machine boots. The required settings are:
- Network Boot Protocol : PXE
- Boot Order: Int19H (this tries a network boot first, then uses
the BIOS boot order)
At this point, it is wise to note the MAC (hardware) address of the
network interface from which the machine will be booting.
DHCP server configuration.
The basic process of PXE network booting is pretty straightforward. The
PC broadcasts for a DHCP server. The server responds and provides the
address of a tftp server, and the file that should be retrieved from the
tftp to act as a boot image.
As I was already running dhcpd on my server, all that was required was
some editing of /etc/dhcpd.conf.
I added the lines:
allow booting;
allow bootp;
group {
next-server 192.168.0.254;
host delirium {
hardware ethernet 00:40:F4:67:3E:24;
filename "/tftpboot/pxelinux.0";
}
}
The address 192.168.0.254
is the IP of the tftp server, which in my case was the same as the dhcp
server. The hardware address is that of the client machine (given the
hostname 'delirium'). This configuration means that the client machine
will attempt to boot from the image /tftpboot/pxelinux.0 loaded from
the tftp server at 192.168.0.254.
Restarting dhcpd and
rebooting the client resulted in the PXE boot ROM complaining that the
tftp server wasn't responding. Fair enough.
tftp server configuration.
Not all tftp servers are born equal, and some just don't work for PXE
booting. I would recommend the tftp-hpa server, linked above. Untar, ./configure, make, make install as usual. Then add
to your inetd. I added
following to /etc/inetd.conf
:
tftp dgram udp wait root /usr/sbin/tcpd in.tftpd
Make sure that you allow connections from the client PC through TCP
wrappers, or whatever security you have on your inetd.
Restarting inetd and
rebooting the client now resulted in a message that the required file (/tftpboot/pxelinux.0) could not
be found.
Next, I created a /tftpboot/
directory, and placed in it the pxelinux.0
from the SYSLINUX package. I then copied the files initrd.img and vmlinuz from the /images/pxeboot/ directory of
the first RedHat CD to /tftpboot/.
I then created a directory /tftpboot/pxelinux.cfg/
and placed in it a file called default
which contained the following text:
default linux
prompt 1
label linux
kernel vmlinuz
append initrd=initrd.img devfs=nomount
This completed the server configuration. Now when the client was
rebooted, it retrieved the pxelinux.0
image, which acts much like lilo
and uses the ./pxelinux.cfg/default
file to present the boot options - in this case 'linux' which uses the
RedHat 9 network install kernel and root disk.
Network installation of RedHat 9.
This was really easy. I installed apache
on my server, and copied the contents of the RedHat directories of the RedHat
CDs into a directory served by the webserver. I then chose http
installation from the options presented after the RedHat installer had
been loaded by the client. Follow the instructions onscreen. Exactly
like doing a local disk installation.
Making the client boot from its own disk.
As the PC had come configured for PXE booting, I hadn't bothered to
play around with the RealTek Boot Agent when I first started the
installation. That meant that when I finished the install, and wanted to
boot from the local HDD, I just changed the BIOS boot order to HDD,
then LAN. This did nothing, and the machine continued to attempt network
booting only. Of course, the answer was to press Shift-F10 as the
network interfaces initialised, and set:
This means that the BIOS controls the boot sequence, and a HDD boot
became possible.
Job done.