Advertisment

Remote Booting in Linux

author-image
PCQ Bureau
New Update

Remote booting is a fairly old concept that’s still widely used. It involves booting a PC without a hard disk from a remote server. The advantage is that you don’t need a hard drive on the PC, and since all the software is installed on one central server, it makes administration easier. There are several ways to do remote booting. You could use a network card with a RPL (Remote Program Loader) or PXE (Preboot Executable Environment) compatible boot ROM, or do floppy based network booting. In this article, we’ll talk about remote booting using a PXE boot ROM. The PXE Boot ROM is a client-based firmware that enables client PCs to access and boot from boot image files kept

on a TFTP(Trivial FTP) or similar server.

Advertisment
Note:

If your DHCP Server is not running in the same machine as the TFTP and PXE server, then you have to add another option to the dhcpd.conf. Add the following line in the global Settings of the dhcpd.conf file: “next-server ip-of—tftp-srvere”



If the DHCP Server is on the same machine, then you’ll need to make some changes in the pxe.conf file So open the file /etc/pxe.conf and change the value of from ‘1’ to ‘0’. 

To start with, we’ll assume that you have a system running the full installation of PCQLinux 8.0. For any other type of PCQLinux installation, make sure you have pxe-0.1-33, tftp-1.29-3, tftp-server-1.29-3, nfs-utils-1.0.1-3 and the kernel source, installed on your machine. You’ll also need a DHCP server and if you don’t, then install dhcp-3. Then of course you need a client machine having a LAN card with the PXE boot ROM. 

Configuring a remote boot server is made of three parts–Configuring DHCP, Configuring PXE/TFTP and Configuring NFS.

Advertisment

Configure DHCP Server 



For a DHCP server you can use a separate machine or configure it on the same machine as the one with the PXE and TFTP servers. To configure it, open the file “dhcpd.conf” from the /etc directory, and using any text editor, create a new host and enter all necessary information like MAC Address, Fixed IP and Boot File name to it. After making the changes, it should look like the following example. You can also use Webmin to configure it.

#dhcpd.conf



#Global Settings


ddns-update-style none;


allow booting;


allow bootp;


subnet 192.168.1.0 netmask 255.255.255.0 {


range dynamic-bootp 192.168.1.1 192.168.1.254; #The Pool of IP addresses which will be allotted by the server


#New Host For Remote Boot


host Host1 {


filename “pxelinux.0”; # Remote Boot Loader for Linux


hardware ethernet 00:A1:B2:C3:D4:E5; # Mac address of the client


fixed-address 192.168.1.2; # Fixed IP, #which will be allocated to the client }


}










Here, it assumes that the machine is on a class C network and the network address is 192.168.1.0. The Mac address of the remote boot client is 00:A1:B2:C3:D4:E5 and the fixed IP allotted to this client is 192.168.1.2. The boot file that is used to boot the client through the network is pxelinux.0 Restart your DHCP server by issuing:

Advertisment

#/etc/init.d/dhcpd restart 

Configuring TFTP



TFTP is a file transport protocol, which is generally used for transferring files containing the bootstrap at the pre-boot phase of remote booting through PXE. For remote booting Linux you also need a bootstrap or remote boot loader file, which is able to load your Linux kernel from any remote machine over NFS. To access that go to:

http://www.kernel.org/pub/linux/utils/boot/syslinux/

and download the latest version of syslinux and decompress it. You will find a file called pxelinux.0 in its directory. Copy it to the “/tftpboot” directory on your system. Pxelinux takes the boot configuration from a file called default. This file is saved in a directory called pxelinux.cfg. So create a folder in /tftpboot called “pxelinux.cfg”. Go to this folder, create the file called ‘default’, and enter:

serial 0 19200



console=ttyS0, 19200n81


KERNEL=linux


APPEND root=/dev/nfsd


nfsaddrs=192.168.1.2:192.168.1.1:192.168.1.1:255.255.255.0:prompt:eth0


nfsroot=192.168.1.1:/tftpboot/192.168.1.2 panic=10


ip dhcp


prompt 1


timeout 100


ipappend 1


Here 192.168.1.1 is the IP of the NFS and TFTP servers and 192.168.1.2 is the fixed IP of the Remote Boot Client.








Advertisment

Here 192.168.1.1 is the IP address of the NFS server. Now put a hard disk into a client machine and do a minimal installation of PCQLinux in it. Then either by NFS or by physically transferring the hard disk, copy all content of it to a newly created blank folder called ‘192.168.1.2’(Which is the IP Address of the client) in /tftpboot. This is the total disk structure, visible in the client’s machine. Now you have to modify some settings to make it suitable for a remote boot. To do that, first delete the file in /tftpboot/192.168.1.2/etc/sysconfig/network-scripts called ifcfg-eth0. Now open the inittab from /tftpboot/192.168.1.2/etc. and make the default run-level to 1 by changing the line “:ID:3:initdefault:” to “:ID:1:initdefault:”. With this change, the system starts with minimum configuration during the first time. Now open the fstb file from client’s ‘etc’ directory and remove all entries that are trying to mount any hard disk and enter the following lines so that it can mount the remote folders (/tftpboot/192.168.1.2 and /tftpboot/192.168.1.2/proc) as root (/ and /proc), which is kept in the server (192.168.1.1) 

#/etc/fstab



192.168.1.1:/tftpboot/192.168.1.2/ / nfs


192.168.1.1:/tftpboot/192.168.1.2/proc /proc nfs

Now everything is ready except the kernel, which will boot through the pxelinux.0. We’ll now create the new kernel that contains the things listed below. First run the make xconfig to start up the xconfig screen. This will pop up a form full of tabs. Enable the following

options:

Advertisment
  • Driver for your LAN card (from Network Device Support)
  • The NFS file system (from File System >Network File System) 
  • Root file system on NFS option (File System>Network file system)
  • IP kernel level autoconfiguration (from Networking Options)

After this, click on Save and Exit tab. Now from the same location run:

#make dep



#make bzImage

Advertisment

This creates a compressed Linux kernel in /usr/src/linux/arch/ i386/boot directory as bzImage. Copy this image into the /tftpboot directory as Linux, like this:

#cp /usr/src/linux/ arch/i386/boot/bzImage /tftpboot/linux

Your TFTP server is now ready and you have to only populate the directory structure through the NFS server. 

Advertisment

Configuring NFS Server



The basic configuration of NFS Server is very easy. You just have to modify a file called exports in the /etc directory and enter the folder name which you want to share by opening the file /etc/exports and entering the following line in it:



/tftpboot/192.168.1.2/ 192.168.1.2(rw)

This shares the /tftpboot/192.168.1.2 folder for the machine having the IP 192.168.1.2 with read write support. 

Now, reboot the server first and then the client. It will boot into Linux, showing you a ‘$’ prompt as you are logged in through init 1. 

Anindya Roy

Advertisment