Linux

PXE (Pre-eXecution Environment)

Linux lets you to install the OS over the network using NFS, FTP or HTTP. If the hardware supports PXE (Pre-eXecution Environment) the NIC card will send out a broadcast request for DHCP information. The DHCP server provides the client with a IP address and other network information such as the TFTP server address (which provides the files necessary to start the installation) and the location of the files on the TFTP server. This is possible because of PXELINUX, which is part of the syslinux package.
PXE server
PXE server

Necessary packages for PXE Server

In order to setup a PXE installation the following must be carried out:
  1. Install the necessary packages
  2. Configure the DHCP-boot server
  3. Configure the files on the tftp server necessary for PXE booting
  4. Configure the network (NFS, FTP, HTTP) server to export the installation tree (redhat
  5. Configure which hosts are allowed to boot from the PXE configuration
Install the necessary packages
The following software packages are required
  • tftp-server-*
  • tftp-client-* (for testing)
  • dhcp-*
  • xinetd-*

Configure the DHCP-boot server

We have to add some extra information in /etc/dhcpd.conf file. Boot server file look like
ddns-update-style none;

subnet	192.168.0.0	netmask	255.255.255.0	{
	option routers			192.168.0.1;
	option subnet-mask		255.255.255.0;
	option domain-name		"raj.com";
	option domain-name-servers	192.168.0.1;
	default-lease-time 21600;
	max-lease-time	43200;

	range	192.168.0.30	192.168.0.40;
	allow booting;
	allow bootp;
	class "pxeclients" {
   match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
   next-server 192.168.0.1;
   filename "pxelinux.0";
}
	# we want the nameserver to appear at a fixed address
	host ns {
		next-server mohit.raj.com;
		hardware ethernet 00:13:20:26:13:FC;
		fixed-address 192.168.0.1;
	}
}

Configure the files on the tftp server necessary for PXE booting

Open /etc/xinetd.d/tftp file As shown in figure, if your disable entry is yes change it to no.
PXE server configuration
PXE server configuration

Open the /tftpboot/linux-install directory there would be a file pxelinux.0 copy this and placed this file into the /tftpboot directory If you want to install REDHAT 5 on the client pc in order to do this, make a directory in /tftpboot directory for e.g. I make /tftpboot/red5

Copy two file initrd.img and vmlinuz from DVD or first CD of redhat 5 (these file are placed in isolinux directory) and place in /tfttpboot/red5 directory.

If you want to install REDHAT 6 on the client pc in order to do this, make a directory in /tftpboot directory for e.g. I make /tftpboot/red56

Copy two file initrd.img and vmlinuz from DVD or first CD of redhat 6 (these file are placed in isolinux directory) and place in /tfttpboot/red6 directory.

Make a new directory /tftpboot/pxelinux.cfg
Make new file named default put this file in /tftpboot/pxelinux.cfg directory

The line which you have to write in default file as shown in figure below
PXE server for booting
PXE server for booting


Configure the network (NFS, FTP, HTTP) server to export the installation tree (redhat packages, etc)

Copy the complete DVD of redhat 5 or redhat 6 and placed in linux server, as I placed my DVD of redhat 5 file in /tftpboot/redhat5 and redhat 6 in /tftpboot/redhat6.
My /tftpboot directory look like this
Now we have to configure NFS server. You can configure FTP sever also. Do as shown in figure.
NFS, FTP, HTTP server configuration for PXE
NFS, FTP, HTTP server configuration for PXE

Don't forget to give permission to these directories.

Configure the Host for PXE server

Now connect the lan cable to client computer and set the boot priority in BIOS setup. BOOT by LAN should be first . After the client has obtained it's IP address via DHCP it looks for the following configuration files. Press 1 for redhat 5 and press 2 for redhat 6. This is due to default file which is placed in pxelinux.cfg file.
PXE server client configuration
PXE server client configuration


I hope you liked the chapter do like, share and comment.






admin