Linux tftp Server For Diskless Clients

linux_diskless

Diskless client can be very useful for educational institutes, testing setups or the networks that have limited hardware resources available with them. Linux offers a robust diskless environment that can be configured on CentOS with ease.

Server Setup

To configure server we need (NFS, xinetd, tftp and dhcp server). I hope all these services already installed in your system. If you do not find these services in your system you can install all of them as follow

yum install  xinetd tftp-server nfs-utils nfs-utils-lib sytem-config-nfs busybox-anaconda system-config-netboot

Create a directory on the NFS server to contain the diskless environment such as /diskless/i386/TECHBABU/ e.g

mkdir -p /diskless/i386/TECHBABU/root/
mkdir -p /diskless/i386/TECHBABU/snapshot

In the above configuration I have selected (TECHBABU) as operating identifier. You can change according to your need.

Configuring the NFS Server

Edit file /etc/exports

/diskless/i386/TECHBABU/root/     *(rw,sync,no_root_squash)
/diskless/i386/TECHBABU/snapshot/ *(rw,sync,no_root_squash)

Next we need to start NFS Server

service nfs start

Let’s copy a running Linux OS in diskless environment through rsync utility. For example:

cd /diskless/i386/TECHBABU/root/
rsync -avz --exclude='/proc/*' --exclude='/sys/*' /  .

If you want to copy image from a remote machine then use this: rsync -avz –exclude=/proc/ –exclude=/sys/ root@remote-machine:/ .

After copy OS image, make sure proc and sys directories must be empty. e.g.

rm -rf /diskless/i386/TECHBABU/root/proc/*
rm -rf /diskless/i386/TECHBABU/root/sys/*

Start the tftp Server

service xinetd start

Configuring the DHCP Server for PXE Clients

Edit file /etc/dhcpd.conf

group {
   if substring(option vendor-class-identifier, 0, 9) = "PXEClient" {
   next-server 192.168.1.201;
   filename "linux-install/pxelinux.0";
}
      host DiskLess1 {
      option root-path "/diskless/i386/TECHBABU";
      hardware ethernet 00:0c:29:d7:c1:16  ;
      fixed-address 192.168.1.202;
}

hardware ethernet 00:0c:29:d7:c1:16
The Line above has MAC Address of diskless client, which can be easily noted at startup time of diskless system

Finish Configuring the Diskless Environment

system-config-netboot

A wizard will appear as follows

linux_diskless

In the next window you need to enter IP Address of nfs Server where disk image for clients is shared.

linux_diskless

Press Apply Button to finish the configuration.

linux_diskless

In the next window we need to enter IP address of diskless client. It can be single IP or entire subnet e.g 192.168.1.0/255.255.255.0.

linux_diskless

Tthe diskless kernel and image file are created based on the kernel selected. They are copied to the PXE boot directory /tftpboot/linux-install/os -identifier/

That’s all Diskless Server is ready. Next we need a system with Network Card for diskless client. You must edit (System BIOS) settings on client machine where you must select first boot priority as Network Boot/PXE Booot.

If you can’t find Network/PXE Boot related configuration in (BIOS) then it meas your network card is not a PXE Bootable. Then you need to change your card.

I hope you’ll enjoy this howto

One comment

  1. [...] here Tags: linux, linux as diskless server, linux diskless client, linux terminal server, [...]

Leave a Reply

Your email address will not be published. Required fields are marked *

*