Table of Contents
PXE stands for "Pre-execution Environment," an Intel standard for system-setup instructions stored in a ROM chip and executed early in the PC boot process, before loading the Operating System. If your router's Network Interface and BIOS support PXE, you can net-boot your LEAF router using the PXE chip's built-in DHCP and TFTP clients, giving you very quick boot times while removing the requirement for the router to include a disk drive of any kind. PXE is also useful for installing Bering to a single-board computer (SBC) that lacks a floppy interface to boot from initially. Most SBCs on the market that do not have a floppy controller include a PXE ROM for this express purpose.
The following configuration has been tested on a openbrick machine. On this box the PXE compliant NIC is an integrated Realtek 8139C that will be used for the internal network interface whereas the external network interface is provided by an SMC USB to ethernet converter.
The initial work on this package was carried out by W. Cardwell and then improved by J. Nilo. It also borrows some parts of backup scripts modified by E. Titl for scp support.
Comments on this section should be addressed to its maintainer: J.
Nilo <jnilo at users.sourceforge.net>
.
The pxe.lrp package is not a real package in the sense that you cannot save it as you would do for any other LEAF package. Once the pxe.lrp package is loaded it will replace some of the original Bering files from the initrd.lrp and the root.lrp packages in order to make your Bering box PXE bootable. It will also bring to the initrd.lrp package the tftp client that will download the file from your server.
More precisely, the content of the package is as follow:
/var/lib/lrpkg/initrd.list a modified initrd.list in order to save new files in initrd.lrp /var/lib/lrpkg/initrd.conf a modified initrd.conf to be able to edit initrd.pxe.conf /var/lib/lrpkg/initrd.pxe.conf the pxe configuration file /var/lib/lrpkg/root.linuxrc a modified linuxrc using tftp to download the packages /usr/bin/tftp the tftp client from P. Anvin /usr/sbin/lrcfg.back a modified lrcfg.back script to allow backups on tftp server and floppies /usr/sbin/lrcfg.back.script a modified lrcfg.back.script to allow backups on tftp server and floppies
The installation is basically a two steps process:
First you prepare your Bering distro to make it PXE bootable
Second you prepare your server that will contain the distro to be downloaded
Finally you need to adjust the Bering router BIOS to make it PXE bootable
Download a fresh Bering distro and boot it from a floppy drive.
Remove the uncessary packages from the floppy and the unecessary modules
in /lib/modules
since you will need some room (about
30k) to store the new elements brought by the pxe.lrp package.
Take a new formatted floppy. Download on it the modules needed for your PXE NIC (if they are not present on the standard Bering distro) and the pxe.lrp package. Mount that floppy on your Bering machine and install manually the pxe.lrp package:
mount -t msdos /dev/fd0 /mnt lrpkg i /mnt/pxe
Move to /boot/lib/modules
the network cards
modules for your PXE enabled NIC then umount the floppy. In the openbrick
box used for this example this is a Realtek 8139C :
mv /lib/modules/mii.o /boot/lib/modules mv /mnt/8139too.o /boot/lib/modules umount /mnt
Through the configuration package menu, choose initrd and the following menu will appear:
initrd configuration files 1) Readme first 2) Modules to load before any other package 3) PXE configuration file 4) INITRD_SIZE (expert: to save backup root.lrp) q) quit ---------------------------------------------------------------------------- Selection:
Choose entry 2 and declare the name of the modules that need to be loaded at the very early stage of the process. In our example we have:
mii 8139too
Then choose entry 3 and enter the relevant PXE informations. The most important one are the address of the tftp server and the interface through which the tftp client will query the server. In my example the tftp server is at address 192.168.1.7 and I have:
# Declare address of the tftpserver # TFTPSERVER=192.168.1.7:/tftpboot # # Declare interface that will be used by tftp client # INTERFACE=eth0 ADDRESS=192.168.1.254 MASKLEN=24 BROADCAST=192.168.1.255
Finally, configure your Bering floppy as you would do it for a
normal Bering floppy installation (keyboard, interfaces, modules and the
like). In the modules.lrp package only declare the modules that are not
already loaded in /boot/etc/modules
.
Since your internal network interface is now eth0 (Bering default is eth1) you have to modify the following files:
The modules declaration file in the modules.lrp package to declare extra modules needed by your distro. In my example I have, to enable the USB to etherner converter:
usbcore rtl8150
pump configuration file (if you get a dynamic IP from your ISP):
retries 3 script "/etc/pump.shorewall" device eth1 { nodns }
The interfaces file, through the Network configuration menu:
auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.1.254 masklen 24 broadcast 192.168.1.255 auto eth1 iface eth1 inet dhcp
Shorewall Interfaces file [3) Iface]:
#ZONE INTERFACE BROADCAST OPTIONS net eth1 detect dhcp,routefilter,norfc1918 loc eth0 detect #LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE
Shorewall MASQ server configuration file [8) Masq]:
#INTERFACE SUBNET ADDRESS eth1 eth0 #LAST LINE -- ADD YOUR ENTRIES ABOVE THIS LINE -- DO NOT REMOVE
Shorewall rules file (in order to be able to backup your packages on the tftp server) [6) Rules]:
ACCEPT fw loc:192.168.1.7 udp 69 ACCEPT loc:192.168.1.7 fw udp 1024:
Finally backup, IN THIS ORDER, root.lrp then initrd.lrp then all the packages that you have modified.
You will notice that root.lrp becomes smaller. The reason is that
because /lib/libresolv.so.2
, /lib/libresolv-2.7.so
and /sbin/ip
are being moved from root.lrp to
initrd.lrp (we need them to establish the ip link in order to be able to
read the lrp packages from the tftp server).
On the contrary, initrd.lrp will be somewhat bigger due to the fact
it now includes the previous files but also the /usr/bin/tftp
binary brought by the pxe.lrp package.
Check a last time the PXE boot parameters since the floppy you are going to save will, from now on, only be bootable through PXE.
The first step is completed: you now have a floppy that contains all the packages that you will next download on your tftp server.
Your server - a linux host attached to your local network - needs two elements: a dhcp server and a tftp server.
As far as the dhcpd server is concerned the de facto
standard is the one provided by ISC and available in most
Linux distro. As root, you need to configure it through the
dhcpd.conf
file where you will declare your subnet,
your tftp serve and your client. Please refer to the dhcpd
and dhcpd.conf
man pages for further explanations.
In my example I have:
dynamic-bootp-lease-length 604800; max-lease-time 1209600; default-lease-time 21600; allow booting; allow bootp; option subnet-mask 255.255.255.0; option broadcast-address 192.168.1.255; subnet 192.168.1.0 netmask 255.255.255.0 { option routers 192.168.1.254; option domain-name "private-network"; option domain-name-servers 192.168.1.254; range 192.168.1.1 192.168.1.254; } host tftpserver { fixed-address 192.168.1.7; } group { next-server 192.168.1.7; host openbrick { hardware ethernet 00:E0:4C:90:03:65; fixed-address 192.168.1.254; filename "/tftpboot/pxelinux.0"; } }
In this configuration file you declare the address of the tftpserver (192.168.1.7), your Bering machine NIC hardware ID and the address that will be used by your tftp client (192.168.1.254).
Once you have modified your parameters, restart your dhcpd server (/etc/init.d/dhcp3-server
restart
).
We now move to the tftp server. I strongly recommend the tftp-hpa version of this server developped by H.Peter Anvin who also happens to be the author of pxelinux that will be used to boot the Bering linux kernel. Other servers are untested.
For security reasons, the tftp server will be installed on a non
root account. Create - for example - an accound named bering. Login to
that account and create a directory named tftpboot
(its full name is therefore /home/bering/tftpboot
).
On that directory you will then:
copy all the files of the Bering floppy you have just created:
sudo mount -t msdos /dev/fd0u1680 /floppy cd ./tftpboot cp /floppy/* . sudo umount /floppy
In the tftboot
directory copy the
pxelinux.0
file that you can get from any
syslinux package but that you can also download from here.
Finally create a pxelinux.cfg
subdirectory
in which you will copy the syslinux.cfg
file of
your Bering distro under the name default
:
cd ./tftpboot mkdir pxelinux.cfg cd pxelinux.cfg cp ../syslinux.cfg default
Now you need to activate your tftp server. To do that login as root
and insert the following entry in your /etc/inetd.conf
file:
#:BOOT: Tftp service is provided primarily for booting. Most sites # run this only on machines acting as "boot servers." tftp dgram udp wait root /usr/sbin/in.tftpd in.tftpd -c -p -r blksize -u bering -s /home/bering
Finally, restart inetd:
/etc/init.d/inetd restart
Et voila! You should now have a non root tftp server on which you
will be able to backup your LEAF packages. Optionnally you can still back
them up on a floppy if you wish. Adding a new package is as easy as adding
it in the tftpboot
directory and declaring them in
the ./pxelinux.cfg/default
file.
If you want to add a new module to your distro you can do that very easily by modifying the modules.lrp package directly on the server:
cd /home/bering/tftpboot be sure to be in tftpboot directory mkdir modules create a modules subdir cd modules move to that new subdir tar xzvf ../modules.lrp unpack the modules package. Then add to ./lib/modules what is needed tar czvf ../modules.lrp . recreate your modules.lrp package