Setting up PXE

From WTFwiki
Jump to navigation Jump to search

Setting up a PXE boot server

Introduction

Some brief documentation has been requested on setting up PXE boot, and for
simplicity, I'll do it with a FreeBSD server, booting OpenBSD/i386, tested with
a soekris machine.

My netboot server (running dhcpd and tftpd) is '10.50.0.50' in a /24 net.

ISC dhcpd

Install dhcpd per normal procedures (ports, packages, whatever) and setup your
configuration like this:

 ...
 allow booting;
 ...
 subnet 10.50.0.0 netmask 255.255.255.0 {
   ...
   option tftp-server-name "10.50.0.50";
   next-server 10.50.0.50;
   filename "openbsd-i386-pxe";
   ...
 }

Make sure to reload your configuration after you change it..

tftpd

Edit '/etc/inetd.conf' and uncomment the 'tftp' line for IPv4, it should look like this:

 tftp    dgram   udp wait    root    /usr/libexec/tftpd  tftpd -l -s /tftpboot

Then reload your inetd config (killall -1 inetd, or similar).

/tftpboot

For ease of maintenance, I recommend verbose filenames for everything in /tftpboot
with symlinks to the more convenient shortened names, like this:

 $ ls -l
 lrwxr-xr-x  1 root    wheel       15 Dec  3 12:14 bsd.rd -> bsd.rd-4.6-i386
 -rw-r--r--  1 jontow  staff  6059175 Jul 10 15:03 bsd.rd-4.6-i386
 lrwxr-xr-x  1 root    wheel       24 Oct 19 11:09 openbsd-i386-pxe -> openbsd-4.6-i386-pxeboot
 -rw-r--r--  1 jontow  staff    53532 Jul 10 15:03 openbsd-4.6-i386-pxeboot

'openbsd-4.6-i386-pxeboot' is actually this file.
'bsd.rd-4.6-i386' is actually this file.

Client Example: Soekris net4801

With the above configuration in place and all daemons reloaded and operating correctly,
if you 'boot f0' it will DHCP an address, then get the "next-server"/"filename" parameters
and tftp download "filename" from "next-server": which is an OpenBSD loader in our example.
That loader is a simple shell prompt where you can then type "boot bsd.rd" or anything else
that loads a kernel and boots it.