User Tools

Site Tools


Writing /var/lib/dokuwiki/data/meta/teaching/ie0117/proyectos/2012/i/diskless_network_boot.meta failed
teaching:ie0117:proyectos:2012:i:diskless_network_boot

This is an old revision of the document!


Diskless Network Boot

Configuration for the installation of a client computer booting through network from another one working as the serve computer.

Introduction

This project aims to start a workstation via the network from a server-based system, using the version of operating system installed.

The development work is to optimize the use of hardware resources depending on the needs that may present the user.

It aims to determine the advantages and disadvantages of this configuration boot systems as optimal model to reduce hardware costs, maintenance and operation.

Objectives

  • Understanding settings on boot processes for network devices from a server.
  • Apply diskless network boot via a network configuration in computers in Autonomous Robots and Cognitive Systems Lab, ARCOS-LAB in the School of Electrical Engineering, UCR.
  • Document the configuration steps diskless network boot from a server.
  • Determine the advantages and disadvantages to using network booting from diskless server.

Tutorial

The tutorial is based on Diskless Debian, network boot that was used preliminary for the installation of client arcoslab02. Modifications were made for the installation of multiple computers with the same architecture of the server, amd64. Computers with another processor architecture need some more system configuration changes.

Server

PXELINUX is a SYSLINUX derivative, for booting Linux from a network server using a network ROM conforming to the Intel PXE (Pre-Execution Environment) specification. PXELINUX is not a program intended to be flashed or burned into a PROM on the network card. If you want that, check out iPXE

  • Used server specifications:
Processor                 AMD FX(tm)-8120 Eight-Core Processor 
Speed	                  3.10 GHz
64-bit Technology	  Yes
RAM Memory	          8.0 GB
Storage Capacity	  2.6 TB (2 HHD, RAID)
Kernel Version	          vmlinuz-3.2.0-3-amd64 
Operative System	  Debian GNU/Linux Sid 

Install pxe and the tftp server:

sudo apt-get install syslinux tftpd-hpa isc-dhcp-server nfs-kernel-server unionfs-fuse

NFS (Network File System) It offers the ability to share the hard disk space of a big server with many smaller clients. Again, this is a client/server environment. While this seems like a standard service to offer, it was not always like this. In the past, clients and servers were unable to share their disk space.

Source: http://www.debianhelp.co.uk/nfs.htm

Configure the dhcp server. Dynamic Host Configuration Protocol (DHCP) is network protocol for automatically assigning TCP/IP information to client machines. Each DHCP client connects to the centrally-located DHCP server which returns that client's network configuration including IP address, gateway, and DNS servers.

http://www.debianhelp.co.uk/dhcp.htm

Edit file /etc/dhcp/dhcpd.conf and edit the following lines:

option domain-name "arcoslab.eie.loc";
option domain-name-servers dns1ip, dns2ip;

Add the following lines:

#Configuration of the subnet 

subnet 192.168.17.0 netmask 255.255.255.0 {
	range 192.168.17.100 192.168.2.200; #non-static IP range
option routers 192.168.17.1; #Gateway server

option broadcast-address 192.168.17.255;

	default-lease-time 600;
	max-lease-time 7200;
}

#Configuration for the new host "diskless_client" computer

host diskless_client {
	hardware ethernet mac-address;
	fixed-address 192.168.17.10;
	filename "pxelinux.0"; #bootloader
	next-server 192.168.2.1; #TFTP server
	option subnet-mask 255.255.255.0;
	option broadcast-address 192.168.2.255;
	option routers 192.168.2.1; #Gateway server
}

For example, this is the configuration for a new host for the server arcoslab01:

#Configuration as "diskless_client" for netwook boot of Optiplex 740 Enhanced System Code: 285798
 
host arcoslab03 {
	hardware ethernet 00:22:19:00:B4:CA; # MAC address, must be obtained from the client
	fixed-address 192.168.17.11; # Address asigned for the client
	filename "pxelinux.0";
  	next-server 192.168.17.1;
	option subnet-mask 255.255.255.0;
	option broadcast-address 192.168.17.255;
	option routers 192.168.17.1; 

	}

Note: Must add more hosts for other client nodes

Restart dhcp server

sudo /etc/init.d/isc-dhco-server restart

Configure the tftp files for network boot:

sudo cp /usr/lib/syslinux/pxelinux.0 /srv/tftp/
sudo mkdir pxelinux.cfg
cd /srv/tftp/pxelinux.cfg/

Trivial File Transfer Protocol (TFTP) is a very simple file transfer protocol, with the functionality of a very basic form of FTP. It has no authentication system.

Source: http://wiki.debian.org/Tftp

For the configuration of more tha one computer booting from the same server, instead of creating a file name “default”, the name of the configuration file of each machine must be the MAC address all in lower case hexadecimal with dash separators.

Source: http://www.syslinux.org/wiki/index.php/PXELINUX

PROMPT 1
DEFAULT arcoslab
TIMEOUT 10
LABEL arcoslab

	kernel arcoslab03/vmlinuz-3.2.0-0-amd64
	append boot=nfs root=/dev/nfs nfsroot=192.168.17.1:/ ip=dhcp initrd=diskless_client/initrd.img-3.2.0-3-amd64 rw rootdelay=10 vga=extended init=/etc/init.d/init_arcoslab03 --

#break=mount

Copy the kernel and initrd images to the tftp directory

sudo mkdir /srv/tftp/diskless_client/
sudo cp /boot/vmlinuz-3.2.0-3-amd64 /srv/tftp/diskless_client/
sudo cp /boot/initrd.img-3.2.0-3-amd64 /srv/tftp/diskless_client/

Create a directory and some files for the system files that will be different on the diskless-client computer This will later be mountes on the diskless_client on top od the root filesystem uning unionfs

For more information: http://unionfs.filesystems.org/

sudo mkdir /unionfsfstab
sudo mkdir -p /unionfs/common/etc
sudo mkdir -p /unionfs/common/var
sudo mkdir -p /unionfs/host
sudo mkdir -p /unionfs/hosts/diskless_client/etc/apache2/sites-enabled
sudo mkdir -p /unionfs/hosts/diskless_client/etc/init.d/
sudo mkdir -p /unionfs/hosts/diskless_client/etc/network
sudo mkdir -p /unionfs/hosts/diskless_client/etc/rc2.d/
sudo mkdir -p /unionfs/hosts/diskless_client/etc/rc6.d/
sudo mkdir -p /unionfs/hosts/diskless_client/etc/rcS.d/
sudo mkdir -p /unionfs/hosts/diskless_client/var
sudo mkdir -p /unionfs/union/etc
sudo mkdir -p /unionfs/union/var

Create these files on its corresponding directory

sudo touch /unionfs/common/etc/README
sudo touch /unionfs/common/var/README
sudo touch /unionfs/host/README
sudo touch /unionfs/hosts/diskless_client/etc/README
sudo touch /unionfs/union/etc/README
sudo touch /unionfs/union/var/README
sudo touch /unionfs/hosts/diskless_client/etc/apache2/sites-enabled/000-default
sudo touch /unionfs/hosts/diskless_client/etc/apache2/sites-enabled/default-ssl
sudo touch /unionfs/hosts/diskless_client/etc/apache2/sites-enabled/dokuwiki
sudo touch /unionfs/hosts/diskless_client/etc/apache2/sites-enabled/homes
sudo touch /unionfs/hosts/diskless_client/etc/exports
sudo touch /unionfs/hosts/diskless_client/etc/init.d/apache2
sudo touch /unionfs/hosts/diskless_client/etc/init.d/isc-dhcp-server
sudo touch /unionfs/hosts/diskless_client/etc/init.d/nfs-kernel-server
sudo touch /unionfs/hosts/diskless_client/etc/init.d/tftp-hpa
sudo touch /unionfs/hosts/diskless_client/etc/rc6.d/K03sendsigs

Note: The files on /unionfs/hosts/diskless_client/etc/init.d/ must me executable

Edit the following files with:

  • /unionfs/hosts/diskless_client/etc/fstab

The fstab (/etc/fstab) (or file systems table) file is a system configuration file on Debian systems. The fstab file typically lists all available disks and disk partitions, and indicates how they are to be initialized or otherwise integrated into the overall system's file system. Source: http://wiki.debian.org/fstab

#192.168.17.1:/root     /root    nfs     rw,nfsvers=3,hard,intr,bg,timeo=600,nolock,rsize=32768,wsize=32768,noatime      0       0
192.168.17.1:/home     /home    nfs     rw,nfsvers=3,hard,intr,bg,timeo=600,nolock,rsize=32768,wsize=32768,noatime      0       0
tmpfs                  /tmp     tmpfs   defaults        0       0
/unionfs/union/etc     /etc     none    ro,bind         0       0
  • /unionfs/hosts/diskless_client/etc/hostname
arcoslab03
  • /unionfs/hosts/diskless_client/etc/hosts
127.0.0.1 localhost
127.0.1.1 arcoslab02.eie.ucr.ac.cr arcoslab02
  • /unionfs/hosts/diskless_client/etc/network/interfaces
auto lo 
iface lo inet loopback
  • /unionfs/hosts/diskless_client/etc/syslog.conf
#send everything to diskless_server
*.*;local4.!* /var/log/messages
*.*;local4.!* @diskless_server_ip
local4.*      /var/log/ipmi

A syslog server is a kind of a central repository for log messages as a way for you to centralize your monitoring of network systems and devices. It's a client/server type of setup where the devices are the “clients”. When set up to use a syslog server, devices will send their log messages over the network wire to the syslog server rather than recording them in a local file or displaying them.

Source: http://www.aboutdebian.com/syslog.htm

Export root file system as read-only (to avoid damage by other computer) and others as read-write using nfs on:

  • /etc/exports

#diskless_client

/    192.168.17.0/24(ro,insecure,async,no_subtree_check,no_root_squash,insecure_locks)
/root   192.168.17.0/24(rw,insecure,async,no_subtree_check,no_root_squash,insecure_locks)
/home   192.168.17.0/24(rw,insecure,async,no_subtree_check,no_root_squash,insecure_locks)
/unionfs        192.168.17.0/24(rw,insecure,async,no_subtree_check,no_root_squash,insecure_locks)

In the server computer create a file called /etc/init_diskless_client with:

#!/bin/sh -x
NFS_SERV="192.168.2.1"
NFS_OPT="-otcp,nfsvers=3,hard,intr,bg,timeo=600,nolock,rsize=32768,wsize=32768"

FUSE_OPT="-o default_permissions -o allow_other -o use_ino -o nonempty -o suid"
UNION_OPT="-o cow -o noinitgroups"

UPATH="/unionfs"
UBIN="/usr/bin/unionfs-fuse"

ulimit -n 16384

#This tmpfs is needed, because mount and others need a temporary place to write
#consider changing this to a permanent place over NFS?  Could fill RAM
mount -n -t tmpfs tmpfs /tmp

ifconfig lo 127.0.0.1

#specific directory
mount -n -t nfs $NFS_OPT ${NFS_SERV}:${UPATH}/hosts/diskless_client ${UPATH}/host
  
#function to combine a directory from the read-only root directory (/),
#with a specific unionfs for this host that is writable
unionmount()
{
      dir=$1
      mkdir -p ${UPATH}/host/$dir  #if not existant, create dir
      mount -n --bind /$dir $UPATH/common/$dir  #mount the original read-only dir to common
      host="${UPATH}/host/${dir}=RW"
      common="$UPATH/common/${dir}=RO"
      #combine the two directories into a unionfs
      $UBIN $FUSE_OPT $UNION_OPT ${host}:${common} $UPATH/union/$dir
      #replace the mount in /$dir with the newly created combination
      mount -n --bind $UPATH/union/$dir /$dir
}

#same as the previous function, just make the directory read-only at the end
unionmount_ro()
{
      dir=$1
      unionmount $dir
      mount -n -o remount,ro /$dir
}

#which directories will get the overlay of the unionfs:
unionmount etc
cat /proc/mounts > /etc/mtab
mount -n -o remount,ro $UPATH/union/etc
mount -n -o remount,ro /etc

#sleep 4                                                                        

unionmount var

mount -t nfs -a
#/etc/init.d/chrony start                                                       
/etc/init.d/ssh start

#exec /bin/bash                                                                 
exec /sbin/init

Change permissions ot this file to executable

sudo chmod +x /etc/init.d/init_diskless_client

Clients

ClIENT 2: arcoslab02

System specifications

Processor 	                AMD FX(tm)-8120 Eight-Core Processor 
Speed	                        3.10 GHz
64-bit Technology	        Yes
RAM Memory	                8.0 GB
Kernel Version	        vmlinuz-3.2.0-3-amd64 
Operative System	        Debian GNU/Linux Sid 

CLIENT 1: arcoslab03

System specifications

System:			Optiplex 740 Enhanced
Bios Version: 		2.1.8 (07/03/08)
Processor:			AMD Athlon(tm) Dual Core Processor 4450B
Processor Clock Speed:	2.30 GHz
Processor Bus Speed:		1000 MHz
Processor L2 Cache:		1 MB
Processor ID:			0FB2
64-bit Tecnology:		Yes

Memory:			2.0 GB
Memory tecnology:		DDR2 SDRAM

Drive:			SATA ST3160815AS
Capacity:			160 GB

MAC address:			00:22:19:00:B4:CA

To make the system boot from network

  1. Enter to the BIOS setup and enable network boot.
  2. Change the order of booting devices until the option of network boot is first in the list.
  3. Save changes and continue to system booting.

The system will recognize the DHCP server and will start to boot from the server.

Results

The client arcoslab03 computer successfully boot from the server after making some modifications to the preconfigures network booting for the preinstalled client arcoslab02 computer, especially for the files in the /srv/tftp/pxelinux.cfg/ directory. This is very important for multiple client setup.

The user's home directory was loaded to the client computer. Some gateway permissions changes were needed to be made in the server for the clients can access the Internet.

The client computers can run smoothly except the server is rebooted or poweroff. The network turns down so the tranfering of files through it is lost and must reboot to restart the conection to the server.

The original hard disk of the client is mounted in the booting process, but is not necesary for the computer to run because its files system is mounted on the server using unionfs.

Conclusion

The settings on boot processes for network devices from a server were understood. The configuration for the booting process and the network were seen when working on this project.

A client computer was configured in the ARCOS-Lab during the proyect, acchieving the goal of installing a machine using this configuration for the usage in the laboratory.

All process was documented in steps for further usage.

The advantages of using this system is saving money on storage devices for each computer and improving network management, using only the server for its configuration.

teaching/ie0117/proyectos/2012/i/diskless_network_boot.1457364352.txt.gz · Last modified: 2022/09/20 00:08 (external edit)