How to Configure PXE boot Server


Assume the followings
1. Hostname : server.example.com
2. IPaddress : 192.200.1.222
3. DNS Configured (Not required for PXE boot, you can use ip address instead of hostname)
4. Path of YUM using -vg option with ftp server (i.e.baseurl=ftp://server.example.com/rhel5/ )
5. NFS server installed

6. Lan Card (NIC) PXE boot enabled Here are the packages to be installed:

  •      system-config-netboot
  •      tftp
  •      tftp-server
  •      dhcpd

Step 1:Configuration of the NFS server

Add the following line in /etc/exports:
[root@server ~]# echo "/var/ftp/rhel5 *(rw,sync)" >> /etc/exports 

Then run 
[root@server ~]# exportfs -va
exporting *:/var/ftp/rhel5

Then run
[root@server ~]# service nfs restart
Shutting down NFS mountd:                             [  OK  ]
Shutting down NFS daemon:                             [  OK  ]
Shutting down NFS services:                           [  OK  ]
Starting NFS services:                                [  OK  ]
Starting NFS daemon:                                  [  OK  ]
Starting NFS mountd:                                  [  OK  ]
root@server ~]# showmount -e server.example.com
Export list for server.example.com:
/var/ftp/rhel5 *

Step 2:Configuration of the tftp Server 

[root@server ~]# yum install tftp-server  tftp  alchemist  -y

Download the file system-config-netboot-0.1.41-1.FC6.noarch.rpm
http://cid-69d9b9d659f9c8cb.skydrive.live.com/browse.aspx/Public?authkey=ZHv7!TsBbGo%24

[root@server ~]#rpm -ivh system-config-netboot-0.1.41-1.FC6.noarch.rpm

Run system-config-netboot and configure a network installation:

[root@server ~]# system-config-netboot

Click on Network Installation and select the following entries

* Oprating system identifier: RHEL5
* Description: Red Hat Enterprise Linux 5
* Select protocol for installation: choose NFS
* Kickstart: if you have a kickstart file, put the path to it here, if not, leave empty
* Server IP address : 192.200.1.222* Location: /var/ftp/rhel5

Click OK. This creates a directory /tftpboot/linux-install/RHEL5 with files like initrd.img and vmlinuz downloaded from your nfsserver (/var/ftp/rhel5/images/pxeboot/).

Create a New PXE configuration file:

* Hostname of IP Address/subnet: 192.200.1.222

* Operating system: RHEL5 should be there. It is auto-populated from the previous step.

Click OK. A file named default is created in /tftpboot/linux-install/pxelinux.cfg.

Edit the file /etc/xinetd.d/tftp and change the line containing server_args and disable 

[root@server ~]# vim /etc/xinetd.conf
service tftp
{
 socket_type      = dgram
 protocol         = udp
wait              = yes
user              = root
server            = /usr/sbin/in.tftpd
server_args       = -s /tftpboot -v -v    //changes in this line
disable           = no                   //changes in this line
per_source        = 11
cps               = 100 2
 flags            = IPv4
}

[root@server ~]# chkconfig tftp on
and the start the server xinetd:

[root@server ~]# service xinetd restart
You can test your tftp server with the tftp client from your home directory:

[root@server ~]# tftp server.example.com
tftp> get linux-install/pxelinux.0
You should have the file pxelinux.0 in your home directory.

Step 3:Configuration of the dhcp Server

Edit the file /etc/dhcpd.conf and add the following lines:
subnet 192.168.1.0 netmask 255.255.255.0 
{
range 192.168.1.128 192.168.1.254;
allow booting;
allow bootp;
class "pxeclients"
{
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
 next-server 192.200.1.222;
filename "linux-install/pxelinux.0";
}
}
Even if you have a running dhcp server somewhere, this will work.
Start the dhcp server:
[root@server ~]# service dhcpd restart

Restart now your client (target) pc to boot over the network.If it does not 
work, either disable the firewall (system-config-firewall) or allow port
69 to be accessible to any hosts accessing the tftp server.
 
 

About Manish Jha

Manish is currently working as Staff Solutions Engineer at VMware. I have 12 years of experience in handling Datacenter & Cloud technologies including VMware vSphere, VMware Cloud Director, VMware NSX,vSphere Replication & VMware HCX. For my contribution towards community, I have been felicitated with following awards: vExpert: 2014-2023 vExpert NSX: 2012-2020, vExpert Cloud: 2017-2021 vExpert HCX: 2018-2022 vExpert Pro: 2020-23 I blog at www.vstellar.com If you find any post informational to you please press like and share it across social media and leave your comments if you want to discuss further on any post.
This entry was posted in Server Configuration. Bookmark the permalink.

Leave a comment