Sysresccd-manual-en PXE network booting
From SystemRescueCd
Contents |
[edit] About
The PXE environment allows you to boot a computer with SystemRescueCd even if this computer has no CDRom driver or USB socket. It allows to boot SystemRescueCd from the network, and then it's faster to troubleshoot computers of 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 on which you have no physical access to insert the disc. For the moment, SystemRescueCd supports only PXE booting on the x86 architecture (PC computers).
The SystemRescueCd implemented the network boot process with HTTP instead of NFS, since HTTP is easier to configure (only one port for HTTP on the network, NFS is complex to configure especially for firewalls), and HTTP is based on the reliable TCP transport protocol, the data cannot be corrupted.
[edit] Requirements
- A computer able to boot a CD/USB to act as a PXE server. You can use a simple virtual VMWare machine if you have no computer available for this task.
- A client computer with a least 300MB of memory and a PXE able network card
- SystemRescueCd version 1.0.0 or newer if you use these options since the previous versions had important bugs.
[edit] How the PXE boot process works
[edit] The PXE boot server
The PXE boot server is made of three parts:
- DHCP server that sends an IP address to the client
- TFTP server that sends the first boot files (boot loader + kernel) to the client
- HTTP server that sends the root filesystem to the client ( http is not mandatory anymore)
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.
[edit] The PXE boot process
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:
- When the client computer try to boot with PXE, it first emits a DHCP request on the network to get an IP address.
- Then a DHCP server reply with a DHCP offer that contains a new IP address that was not already allocated and some specific options (DNS, default route) and the IP address of the TFTP server
- The client receives this DHCP offer and accept it. It connects to the TFTP server (it received its IP address in the previous stage) to get the boot loader files.
- The TFTP server sends the boot loader files (
pxelinux) and the text files displayed on the screen bypxelinux. - The client displays the pxelinux prompt, and the user can choose the boot options. It then requests the TFTP server the kernel and initramfs files necessary to boot the system
- The TFTP server sends the kernel and initramfs files (
rescuecd+rescuecd.igz) to the client - The client boots on this kernel and executes the
linuxrcscripts that comes with the initramfs. - During its initialization the kernel makes a DHCP request again because of the
ip=dhcpkernel boot parameters. In deed the kernel does not know the IP address used by the computer at the pxelinux stage. - The client downloads the
sysrcd.datfile into RAM from an HTTP server. The IP address of this web server was sent to the client by the tftp server with the kernel boot options. Thesysrcd.datfile is quite large (around 120MB) and it contains all the SystemRescueCd system excepts the kernel. - The client mounts
sysrcd.datand it can now complete the boot process. - At this stage the client holds all the files in memory and it does not require any boot server any more
[edit] The pxebootsrv service
In SystemRescueCd the PXE server setup is done with a single service named pxebootsrv. This service is charged of preparing the server configuration and running the three workers services involved in the PXE boot process. When 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 workers 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 use the dhcpd/tftpd/thttp services directly.
[edit] Setup the PXE-boot-server on a typical configuration
[edit] About
This sections explains how to setup a SystemRescueCd PXE boot server with all the services running on a single machine. It means the DHCP server and the TFTP server and the HTTP server are running on the single machine of your network. If you want to run these services on separate computers please read the next section.
[edit] Overview
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. 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 computer with at least 280MB of memory from the network with PXE.
[edit] Steps to configure PXE on the server
- Boot SystemRescueCd from the CD/USB/HDD on a computer
- Configure the network settings with
ipconfigandroute. Here is a typical example:ifconfig eth0 192.168.1.5/24route add default gw 192.168.1.254
- Edit your pxe/network settings in
/etc/conf.d/pxebootsrv - Start the service with
/etc/init.d/pxebootsrv start. In case of errors, check the/var/log/messagesfile for more details. - The computer should be ready to act as a PXE boot server
Here is a copy of a typical /etc/conf.d/pxebootsrv configuration file:
# ------------------------ CONFIGURATION -------------------------------
# By default the current systems acts as DHCP and TFTP and HTTP server
# If you want another machine of you network to act as one of those
# you will have to turn the appropriate option yo "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
[edit] Setup the PXE-boot-server on a custom configuration
[edit] About
In this section you will learn how to install a PXE-boot environment with the three services (DHCP, TFTP, HTTP) running on different machines. Make sure you understand how to PXE boot process works before you install the PXE boot server with a configuration different from the typical case.
[edit] Customization of the pxebootsrv service
You may configure the pxebootsrv service to act only as the requirements you have. For example if you already have a DHCP server running on your network you may not work to install another DHCP again. In that case you can configure SystemRescueCd pxebootsrv to act only as TFTP/HTTP servers. You just have to turn off the PXEBOOTSRV_DODHCPD option in /etc/conf.d/pxebootsrv:
# ------------------------ CONFIGURATION -------------------------------
# By default the current systems acts as DHCP and TFTP and HTTP server
# If you want another machine of you network to act as one of those
# you will have to turn the appropriate option yo "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 the DCHP service sends to 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
[edit] Steps to boot the client with PXE
- Check your PXE boot server is ready to answer to the requests from the PXE client
- Check your client computer has at least 280MB of RAM
- Setup your BIOS to boot from the network via PXE
- Check your computer is connected to the same network as the server
- Boot your client computer and it should work
[edit] Rescue a remote machine with PXE
SystemRescueCd provides a set of boot options that automatically configure the network at boot time. It's very convenient to use both rootpass and the network boot options, it means you can remotely boot SystemRescueCd and use it to manage remote servers with ssh. It's very useful with servers installed in a datacenter.
- dodhcp: Use
dodhcpif you have a DHCP server on your network and you want the system to get a dynamic IP address at boot time. - ethx=ipaddr: Sets the static IP address of all the ethernet interfaces found on the system. For instance, if you use option
ethx=192.168.0.1on a machine with two ethernet adapters, botheth0andeth1will be configured with192.168.0.1. You can also write something likeethx=10.0.0.1/24 - dns=ipaddr: Sets the static IP address of the DNS nameserver you want to use to resolve the names. For instance
dns=192.168.0.254means that you want to use192.168.0.254as the DNS server. - gateway=ipaddr: Sets the static IP address of the default route on your network. For instance
gateway=192.168.0.254means that the computer can connect to a computer outside of the local network via192.168.0.254. - rootpass=1234: Sets the root password of the system running on the livecd to
1234. That way you can connect from the network and ssh on the livecd and give1234password as the root password.
