The PXE environment allows you to boot a computer with SystemRescueCd even if this computer has no CDRom drive or USB socket. It allows you to boot SystemRescueCd from the network, and then it’s faster to troubleshoot computers on your network once a PXE-boot-server is installed. It’s also useful if you want to boot a computer that has no optical drive (CD or DVD) or to troubleshoot a remote computer to which you have no physical access to insert the disc.
The PXE boot server is made of three stages:
These three parts can be installed either on a single machine or on several
computers. SystemRescueCd provides a full PXE-boot-server out of the box that
you can run on a single computer. The pxebootsrv service manages
these three services for you.
You may need to understand what happens when you boot SystemRescueCd from the network. You will need this knowledge for troubleshooting in case of problems. Here are the most important steps of the PXE boot process:
pxelinux) and the
text files displayed on the screen by pxelinux.rescue64 + initram.igz) to the client/init scripts that
come with the initramfs.ip=dhcp kernel boot parameters. Indeed the kernel does not know
the IP address used by the computer at the pxelinux stage.sysrcd.dat file. If you use HTTP or TFTP for
the third stage, then sysrcd.dat will be downloaded into RAM so
the client has to have enough memory (estimated requirement: 1GB). If you
use either NFSv3 or NBD then you don’t have this memory requirement and the
client will make permanent requests to the server each time it needs a file
from the root filesystem.sysrcd.dat and it can now complete the boot
process.In SystemRescueCd the PXE server setup is done with a single service named
pxebootsrv. This service is charged with preparing the server
configuration and running the three worker services involved in the PXE boot
process. If you run the pxebootsrv with /etc/init.d/pxebootsrv
start this service analyses its configuration settings located in
/etc/conf.d/pxebootsrv then it prepares the configuration files of
the other services and the files in /tftpboot and then it starts
these worker services.
The pxebootsrv service was written to make the pxe boot process
easier to use. The end user just needs to configure pxebootsrv
instead of three separate services. But in case you are not happy with this
situation, you are free to configure these services (DHCP + TFTP +
HTTP/TFTP/NFSv3/NBD) by hand.
These sections explain how to setup a SystemRescueCd PXE boot server with all the services running on a single machine. It means that the DHCP server and the TFTP server and the HTTP server run on a single machine of your network. If you want to run these services on separate computers, please read the next section.
You just have to start a SystemRescueCd from the CD/USB/HDD and configure it to act as a PXE boot server on your local network. HTTP will be used for the third stage. The configuration is very simple, you just have to write your settings in a config file and start the pxebootsrv service and that’s it. You can then boot other computers from the network via PXE.
ipconfig and route. Here is a typical example:
ifconfig eth0 192.168.1.5/24route add default gw 192.168.1.254/etc/conf.d/pxebootsrv/etc/init.d/pxebootsrv start. In case of
errors, check the /var/log/messages file for more details.Here is a copy of a typical /etc/conf.d/pxebootsrv configuration file:
# ------------------------ CONFIGURATION -------------------------------
# By default the current systems act as DHCP and TFTP and HTTP server
# If you want another machine on your network to act as one of those
# you will have to turn the appropriate option to "no"
# Set to "yes" if you want this machine to act as a DHCP server
PXEBOOTSRV_DODHCPD="yes"
# Set to "yes" if you want this machine to act as a TFTP server
PXEBOOTSRV_DOTFTPD="yes"
# Set to "yes" if you want this machine to act as an HTTP server
PXEBOOTSRV_DOHTTPD="yes"
# Here is a typical PXE-Boot configuration --> update with your settings
PXEBOOTSRV_SUBNET="192.168.1.0"
PXEBOOTSRV_NETMASK="255.255.255.0"
PXEBOOTSRV_DEFROUTE="192.168.1.254"
PXEBOOTSRV_DNS="192.168.1.254"
PXEBOOTSRV_DHCPRANGE="192.168.1.100 192.168.1.150"
PXEBOOTSRV_LOCALIP="192.168.1.5"
# Keep these values to $PXEBOOTSRV_LOCALIP if the current computer
# acts as TFTP server and HTTP server as well as DHCP server
PXEBOOTSRV_TFTPSERVER="$PXEBOOTSRV_LOCALIP" # IP address of the TFTP server
PXEBOOTSRV_HTTPSERVER="http://$PXEBOOTSRV_LOCALIP/sysrcd.dat" # download URL
In this section you will learn how to install a PXE-boot environment with the three services (DHCP, TFTP, HTTP/TFTP/NFSv4/NBD) running on different machines. Make sure you understand how the PXE boot process works before you install the PXE boot server with a configuration different from the typical case.
You may configure the pxebootsrv service to provide only those requirements
which you need. For example, if you already have a DHCP server running on your
network you may not want to install another DHCP. In that case you can configure
SystemRescueCd pxebootsrv to provide only the TFTP/HTTP servers. You just have
to turn off the PXEBOOTSRV_DODHCPD option in /etc/conf.d/pxebootsrv:
# ------------------------ CONFIGURATION -------------------------------
# By default the current system acts as DHCP and TFTP and HTTP server
# If you want another machine on your network to act as one of those
# you will have to turn the appropriate option to "no"
# Set to "yes" if you want this machine to act as a DHCP server
PXEBOOTSRV_DODHCPD="no"
# Set to "yes" if you want this machine to act as a TFTP server
PXEBOOTSRV_DOTFTPD="yes"
# Set to "yes" if you want this machine to act as an HTTP server
PXEBOOTSRV_DOHTTPD="yes"
If you use another DHCP server, you will have to update the
next-server option in the DHCP settings to make sure that the DCHP
service sends the IP address of the TFTP server to the client. Here is an
example of how to use that option with the ISC DHCPD server:
next-server 192.168.1.5; # IP addr of the TFTP server
Here is an example of a typical subnet configuration that you can add to the end
of your dhcpd.conf:
subnet 192.168.1.0 netmask 255.255.255.0
{
range 192.168.1.200 192.168.1.210;
range dynamic-bootp 192.168.1.211 192.168.1.220;
next-server 192.168.1.5;
filename "pxelinux.0";
}
The PXE server is made of several services. In the second stage, the server uses
TFTP to send multiple things to the client: boot loader (pxelinux.0), kernel
image (rescue32/rescue64/altker32/altker64), initramfs (initram.igz). The boot
loader is pxelinux.0 and it comes with a configuration file which
is sent to the client. This configuration file contains the boot command line
which will be used by the client to start the linux kernel. This command line is
important since it contains the SystemRescueCd boot options that are required to
run the third stage. The boot command line can be used to specify the network
settings and the method that the PXE client will use in the third stage of the
PXE boot process. Here are two examples of valid command lines for PXE boot:
In the first example the client will use a static IP address (192.168.157.100)
and it will connect to an HTTP server to download sysrcd.dat in the
third stage of the PXE boot process.
label mybootentry1
kernel rescue32
append initrd=initram.igz ethx=192.168.157.100 netboot=http://192.168.157.1:8080/sysrcd.dat
Here is another example where the client runs a 64bit kernel. It uses a dynamic IP address and connects to an NBD server (192.168.157.1:2000) in the third stage:
label mybootentry2
kernel rescue64
append initrd=initram.igz dodhcp netboot=nbd://192.168.157.1:2000
In the previous sections, the client uses an HTTP/TFTP server to download the root filesystem (which is stored in sysrcd.dat)ยท This file is stored in memory on the client machine, and then it can only work if the client computer has enough memory (1GB or more in general).
With SystemRescueCd you can use either NFS (Network File System) or NBD (Network Block Device) as a replacement for HTTP/TFTP. You will still need DHCP and TFTP for the early stages anyway. NFS or NBD are only used to retrieve the root filesystem. In other words these alternatives are used for steps 9, 10, 11 in the PXE boot process described in the previous sections, and steps 1 to 8 are still based on DHCP/TFTP.
NFS is more popular than NBD but NBD is much easier to configure since it only uses a single TCP port to work. In both cases the root filesystem will be mounted through the network. It means the client will have to be connected until you shut it down. If the connection breaks then it will stop working.
Here are the two boot options introduced in SystemRescueCd-1.4.0:
NBD (Network Block Device)
provides a standard block device (called /dev/nbd0,
/dev/nbd1, …) on the client machine. These devices can be mounted
as any normal disk. Each time a block is read on such a device, there is a
network request and the NBD server sends the data requested.
In SystemRescueCd, NBD is used to mount the loopback root filesystem which is
stored in sysrcd.dat through the network. The configuration of the
NBD server is not described in this documentation, but it’s really easy. Most
linux distributions provide a package called nbd-server or simply
nbd which you can use to provide the boot server.
Here is an example NBD server configuration file that you can use:
# /etc/nbd-server/config
[generic]
user = nbd
group = nbd
listenaddr = 192.168.1.1
[partimage]
exportname = /mnt/cdrom/sysrcd.dat
port = 2000
And here is an NBD server command:
nbd-server 2000 /mnt/cdrom/sysrcd.dat
To configure an NFS v3 server,
you have to install the appropriate packages on your favourite linux
distribution, and then you can add such an entry in the
/etc/exports file:
/tftpboot *(ro,no_subtree_check,all_squash,insecure,anonuid=1000,anongid=1000)
NFS requires multiple ports to work so it may be complicated if you have a firewall between the NFS server and the SystemRescueCd client.
Also you have to check that the sysrcd.dat and
sysrcd.md5 file are available on the NFS server:
# ls -lh /tftpboot/sysrcd.*
-rw-r--r-- 1 root root 198M 2010-02-21 21:06 /tftpboot/sysrcd.dat
-rw-r--r-- 1 root root 45 2010-02-21 21:06 /tftpboot/sysrcd.md5
Here is an example of a boot command for the client:
setkmap=uk ethx=192.168.52.2 nfsboot=192.168.52.1:/tftpboot gw=192.168.52.1