Updated 1 January 2020
© 2020 Logiqwest, Inc. All rights reserved.
Linux Logo

TFTP Setup

The Quickstart server requires that a small boot images be initiated to the client server to be booted. This entails setting up a TFTP boot service and images. The follwing describes how to install and configure this service. Note that a basic DHCP server must have already been installed and configured. See Basic DHCP Server Setup. 

Steps
Edit section

  • Install tftp-server (yum -y install tftp-server).
  • Change 'disable' parameter to 'no' in the /etc/xinetd.d/tftp file.
  • Create the TFTP directory layout for the PXE boot.
  • Prerequisit: Mounted copy CentOS install or wget to to a web site to obtain vmlinuz  and initrd.img.
  • Copy vmlinuz and initrd.img to /tftpboot/images
  • Create a default pxe configuration file in /tftpboot/pxelinux.cfg
  • Open Firewall ports: 67:tcp, 68:tcp, 69:udp

tfpboot File Setup
Edit section

tftpboot/      
  images/    
    initrd.img copied from os image
    vmlinuz copies from os image
  pxelinux.cfg/    
    default new file created
  menu.c32   copies from /usr/lib/syslinux/ and edited
  pxelinux.0   copied from /usr/lib/syslinux/

Prerequisit
Edit section

Use wget to obtain copies of vmlinuz  and initrd.img  for the linux version that is to be installed:

[root@kickstart ~]# wget http://mirror.stanford.edu/yum/pub/centos/5.9/os/x86_64/isolinux/vmlinuz
[root@kickstart ~]# wget http://mirror.stanford.edu/yum/pub/centos/5.9/os/x86_64/isolinux/initrd.img

Install tftp Server
Edit section

Perform yum to install the tftp Server software (e.g. yum -y install tftp-server):

[root@kickstart ~]# yum install tftp-server
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirror.hmc.edu
 * extras: mirrors.easynews.com
 * updates: mirror.5ninesolutions.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tftp-server.x86_64 0:0.49-2.el5.centos set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================
 Package               Arch             Version                      Repository      Size
==========================================================================================
Installing:
 tftp-server           x86_64           0.49-2.el5.centos            base            32 k

Transaction Summary
==========================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 32 k
Is this ok [y/N]: y
Downloading Packages:
tftp-server-0.49-2.el5.centos.x86_64.rpm                           |  32 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : tftp-server                                                        1/1 

Installed:
  tftp-server.x86_64 0:0.49-2.el5.centos                                                  

Complete!
[root@kickstart ~]# 

Edit the tftp Configuration File
Edit section

Edit /etc/xinetd.d/tftp and change the 'disable' parameter to 'no':

# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /tftpboot
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

 Start the xinetd Service 
Edit section

 Start the xinetd service with the service command (e.g service xinetd start)

[root@kickstart ~]# service xinetd start
Starting xinetd:                                           [  OK  ]
[root@kickstart ~]# 

Install syslinux
Edit section

Syslinux is a collection of boot loaders for the Linux operating system. Install this pacakge using yum (yum install syslinux):

[root@kickstart ~]# yum install syslinux
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirror.hmc.edu
 * extras: mirrors.easynews.com
 * updates: mirror.5ninesolutions.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package syslinux.x86_64 0:3.11-7 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================
 Package               Arch                Version                Repository         Size
==========================================================================================
Installing:
 syslinux              x86_64              3.11-7                 base              474 k

Transaction Summary
==========================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 474 k
Is this ok [y/N]: y
Downloading Packages:
syslinux-3.11-7.x86_64.rpm                                         | 474 kB     00:01     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : syslinux                                                           1/1 

Installed:
  syslinux.x86_64 0:3.11-7                                                                

Complete!
[root@kickstart ~]# 

Create the TFTP Directory Layout
Edit section

In the root directory, create the tftpboot directory and copy pxelinux software

[root@kickstart ~]# cd /
[root@kickstart /]# mkdir -p /tftpboot/images
[root@kickstart /]# mkdir -p /tftpboot/pxelinux.cfg
[root@kickstart /]# cp /usr/share/syslinux/menu.c32 /tftpboot
[root@kickstart /]# cp /usr/share/syslinux/pxelinux.0 /tftpboot
[root@kickstart /]# 
 

Prerequisit
Edit section

Use wget to obtain copies of vmlinuz  and initrd.img for the linux version that is to be installed:

(this is from a public site). You can get this from the OS ISO or from an internal OS install site.

[root@kickstart ~]# wget http://www.gtlib.gatech.edu/pub/centos/5.8/os/x86_64/isolinux/vmlinuz
[root@kickstart ~]# wget http://www.gtlib.gatech.edu/pub/centos/5.8/os/x86_64/isolinux/initrd.img

Copy vmlinux and initrd.img
Edit section

Copy vmlinuz and initrd.img to /tftpboot/images

[root@kickstart ~]# cp vmlinuz /tftpboot/images/
[root@kickstart ~]# cp initrd.img /tftpboot/images/
[root@kickstart ~]# ls -l /tftpboot/images/
total 14140
-rw-r--r-- 1 root root 12340659 Mar 23 19:56 initrd.img
-rw-r--r-- 1 root root  2115772 Mar 23 19:56 vmlinuz
[root@kickstart ~]# 

Create Default PXE Configuration File
Edit section

Create a default pxe configuration file in /tftpboot/pxelinux.cfg/ directory using a text editor

[root@kickstart ~]# vi /tftpboot/pxelinux.cfg/default

consisting of

## /tftpboot/pxelinux.cfg/default ##

default menu.c32
prompt 0
timeout 10

MENU TITLE PXE Menu

LABEL CentOS 5.8 x86_64
MENU LABEL CentOS 5.8 x86_64
KERNEL images/vmlinuz
append initrd=images/initrd.img linux ks=http://192.168.201.1/OS_IMAGES/kickstart/test.cfg

NOTE:
The 192.168.201.1 address assumes you are going to use the dhcpd/tftpboot server to contain the OS install file with a http server

Open Firewall Ports
Edit section

Open Firewall ports 67, 68 and 69:

Port Type
67 tcp
68 tcp
69 udp

Either use command line:

[root@kickstart ~]# vi /etc/sysconfig/iptables 
# -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 67 -j ACCEPT 
# -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 68 -j ACCEPT 
# -A RH-Firewall-1-INPUT -m udp -p udp --dport 69 -j ACCEPT  [root@kickstart ~]
# service iptables restart Flushing firewall rules:                                   [  OK  ] 
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
Applying iptables firewall rules:                          [  OK  ]
Loading additional iptables modules: ip_conntrack_netbios_n[  OK  ]
[root@kickstart ~]#   

Or run the GUI (e.g. system-config-securitylevel)

PXE_Firewall.png

Testing
Edit section

Start up a new server and defined it to look for a pxe network boot. You should see the following screen followed by the PXE Menu that was defined.

pxe_boot (1).png 

pxe_menu (1).png

Note: 

  1. If you select the the menu you can start an install using the defined test.cfg kickstart file defined in the /tftpboot/pxelinux.cfg/default file. This kickstart file does not exist and will need to be create. See Enabling KickStart GUI's 
  2. If you have installed the OS Image that is available to install (see Building an OS Image HTTP Server), the screen complaining about the missing kickstart file has a cancel option and will allow you to perform an interactive install the OS
Click for more info