Preboot Execution Environment Server or simply PXE server..

PXE SERVER for SICSR

 

USE of PXE server:  This Preboot Execution Environment server creates a environment in which one hard disk can be replicated as it is over network to multiple system simultaneously.

Point to Remember :

  • Sender PC hardware configuration like HDD and RAM need to same or more at receiver side.
  • Network Adapter needs to be PXE capable.
  • In BIOS network should be enabled.

Installation steps in fast glance :  Details description is given below here i will just summaries the requirements and working.

1)      Install TFTP server

2)      Install DHCP server if Required

3)      Download (link is provided below) linux (kernel image), initrd and pxelinux.0  image and place it in /var/lib/tftpboot folder.

4)      Download (link is provided below) default file and place it in /var/lib/tftpboot/pxelinux.cfg folder.    Pxelinux.cfg need to be created manually.

5)      In the dhcp server entry needs to be made where the pxelinux.cfg file is found in server(details given below)

Working of PXE server in fast glance :

1)      System in network booted(press F12 at boot time) .

2)      IP is obtained by the client from dhcp server.

3)      DHCP server directs the client to server where the boot strap file “pxelinux.0” is found, it is downloaded by the client automatically .

4)      Then client read default file and automatically downloads kernel and initrd image from server.

5)      GUI is presented to user . Its the same step for both sender as well as receiver.

6)      Steps 1 – 5 everything happens automatically if server is functioning properly.  We just need to network boot each system.

 

Step 1:  Installing prerequisite software’s

Number 1 :- TFTP Server

Note:

1)      Think over why should we install TFTP , cant we do it with FTP ? See through that you understand  the difference between FTP & TFTP, and their way of working.

2)      See through the configuration file as well.

Commands and Description

sudo apt-get –y install  tftp-hpa

-y : This will trigger a non-interactive installation, managing all options by itself.

Tftp-hpa : is the package name which is used to install tftp server. This will install both client and server .

To Restart the service : Sudo /etc/init.d/tftp-hpa restart

To check whether the installed is service is running or not run the below command

                ss –apu | grep tftp ( below should be the output)

UNCONN     0      0                       *:tftp                     *:*        users:((“in.tftpd”,1053,4))

 

Number 2 : DHCP-server

Note:

  • If a DHCP server already exist in the domain then you need to  make some changes in the existing scope
  • 1) You need to specify where the linux boot file is kept and that server ip in which  the  pxelinux.0 file is placed.
  • Above configuration needs to be done if we are having PXE server and DHCP server separate.

1)      Considering their is no DHCP server in your domain we will install and configure one.

Command & Description To Install DHCP Server

Sudo apt-get  -y install isc-dhcp-server

Isc-dhcp-server is the command used to install dhcp-server.

DHCP Configuration  File Will be Found in :/etc/dhcp/dhcp.conf

In that file we need to make some  changed to activated the DHCP server.

 # A slightly different configuration for an internal subnet.

subnet 10.5.5.0 netmask 255.255.255.0 {

   range 10.5.5.20 10.5.5.200;

   option domain-name-servers 10.5.5.5;

   option domain-name “pxe.test”;

   option routers 10.5.5.1;

   filename “pxelinux.0”;

   next-server 10.5.5.5 ;

   option broadcast-address 10.5.5.255;

   default-lease-time 600;

   max-lease-time 7200;

}

The above configuration is found in /etc/dhcp/dhcp.conf file.  When installed  all the line will be  commented out, we need to make the above change only after that dhcp server starts running.

NOTE : See through that  DHCP server is working properly and clients are getting IP.   To check to a higher extent, you can network boot (press F12 to network boot a system)  a client machine and see the output. If the output if as below then you can make sure there is some problem with the DHCP server.

Note :

1)      To understand  above picture we need to know each and every internal step which happens after we network boot up a system.

TO GET THE PICTURE OF THIS POST YOU CAN DOWNLOAD THE FULL DOCUMENTATION FROM THE LINK BELOW.

Above given image is screen shot of log file when clients ask for a IP and connection is established.

2)      Lets not worry about first three lines, considering from fourth line it states DHCPDISCOVERY from 00:0c:29:……. via eth0. Lets dig deeper J

  • DHCPDISCOVER – First thing a system does after it network boots is get a IP for itself , and how does it do ?  In a Ethernet frame it embeds its MAC address and  broadcast it with a empty block for IP address to be filled over the network.
  • DHCPOFFER – DHCP server responds to its request by accepting the pack and fill the IP address block. And sends it back to client.
  • DHCPREQUEST – Client send another request frame with IP address and its MAC address to server via eth0 interface, this is hand shake request happening.
  • DHCPACK – Server acknowledges it by sending back a response pack .
  • 10.5.5.5 is the DHCP server IP.

NOTE : The above is screen shot from log file of dhcp server. It will be found in /var/log/syslog.  After setting up the server refer to log file if things are not working.  Log always helps us to understand the problem better.

3)      Now as our client system has IP address what happens next ?  Client need to be  bootstrapped (try to learn what is bootstrapping  a system means before you continue further).

4)      In the DHCP server we had written two lines  a) filename “pxelinux.0”  b) next-server 10.5.5.5 .  “pxelinux.0” is the boot loader which will be downloaded by the client as soon as it gets ip, and next-server <ip> means in which server the initial boot loader i.e “pxelinux.0” file kept. (NOTE : If you are having a windows DHCP server , in the scope a entry needs to be added for “pxelinux.0” file and the server ip where is resides) .

5)      Once  boot loader is downloaded by the client , the system is said to be boot strapped. Now Kernel image and initrd (initial ram disk) will be downloaded . The control move from the kernel image and initrd image. Where kernel image loads NFS for further functioning  and initrd image does the basic initial function of i/o.

6)      So how to does Client comes to know from where these images are places and from where it needs to be picked  and downloaded ?  going back to point 2 where the client has IP.

7)      Configuration files for PXELINUX reside in directory /var/lib/tftpboot/pxelinux.cfg/. PXELINUX uses the following method to search for the appropriate configuration file:

  1. The hardware type (using its ARP type code) and address, all in lower case hexadecimal with dash separators; for example, for an Ethernet (ARP type 1) with address 88:99:AA:BB:CC:DD it would search for the file-name 01-88-99-aa-bb-cc-dd.
  2. The client IP address in upper case hexadecimal, e.g. 192.0.2.91 -> C000025B
  3. Continousosly remove one hex digit from the hexadecimal IP address
  4. A file named default

As an example, if the boot file name is pxelinux.0, the Ethernet MAC address is 88:99:AA:BB:CC:DD and the IP address 192.0.2.91, it will try following the files:

  1. 1.       /var/lib/tftpboot/pxelinux.cfg/01-88-99-aa-bb-cc-dd
  2. 2.       /var/lib/tftpboot/pxelinux.cfg/C000025B
  3. 3.       /var/lib/tftpboot/pxelinux.cfg/C000025
  4. 4.       /var/lib/tftpboot/pxelinux.cfg/C00002
  5. 5.       /var/lib/tftpboot/pxelinux.cfg/C0000
  6. 6.       /var/lib/tftpboot/pxelinux.cfg/C000
  7. 7.       /var/lib/tftpboot/pxelinux.cfg/C00
  8. 8.       /var/lib/tftpboot/pxelinux.cfg/C0
  9. 9.       /var/lib/tftpboot/pxelinux.cfg/C
  10. 10.   /var/lib/tftpboot/pxelinux.cfg/default

8)      Before going into contents of default , we need to place initrd , linux (Kernel image) and boot loaded  “pxelinux.0” in /var/lib/tftpboot folder, because all these files will be downloaded  by tftp.

  •  Now where to find this image ?
  • Initrd and kinux (kernel image) needs to be downloaded form this http://www.udpcast.linux.lu/bootloader.html#pxe  site.
  • “Pxelinux.0” will also be found in the above site or it will be found in any linux system in folder /usr/lib/syslinux/pxelinux.0.

9)      Linux(kernel image), initrd  and pxelinux.0 image should be kept in /var/lib/tftpboot folder.  And we will have a sub folder name pxelinux.cfg which in turn  will have a text file name default which can be downloaded from the above updcast site.

10)   Default file basically tell where the images are kept in server. Once again referring to point 7, default file is what is read by client at last.  Once this file is read by the client, automatically it will fetch kernel first and initrd image next automatically

Refer to the documentation image from below.

Screen shot of default file which is present in /var/lib/tftpboot.pxelinux.cfg/default

NOTE:

  •  The picture itself is self descriptive .  This is the content of default file, reading through you will find in third line “ “ kernel /linux “ “ this tell where the linux(kernel image) is kept. In fourth line initrd=/initrd which also means the same.
  • To understand more about default file and it configuration settings, go to this link http://www.udpcast.linux.lu/bootloader.html#configFile where you will find description of each and every line.

If everything is followed as written above i am sure you PXE server is ready to put into work J .  For the first to setup this server it took me one week and second time just few hours.  Don’t loose your patients if things are not working , read log message when ever you encounter and error.  And online help is always available.

 

PXE server which was used in GNUnify-11  and this Documentation was prepared by M.Sc(CA) 2011-13 batch student.

Dipin Thomas

E-mail : dipinthomas2003@gmail.com

NOTE: feel free to write  to me if you find any problem

Reference :

 

Click here How to setup a PXE server to download the documentation written here.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s