TFTP Setup for Diskless Boot
Enable TFTP Services on server.
- Create new tftp directory in /opt/services tree
-
mkdir -p /opt/services/tftpboot
- edit /etc/xinetd.d/tftp
-
- Change the line disable=yes to disable=no
- Change the TFTP data directory in the server_args line.
# 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 /var/lib/tftpboot
server_args = -s /opt/services/tftpboot
# disable = yes
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
- Restart the xinetd service
-
service xinetd restart
Populate the TFTP area
Minimally, /opt/services/tftpboot should look like
[root@usno-serv-1 tftpboot]# tree
.
|-- linux
| |-- sysimage.cpio.gz
| `-- vmlinuz-2.6.32-220.el6.x86_64
|-- pxelinux.0
|-- pxelinux.cfg
`-- default
2 directories, 5 files
[root@usno-serv-1 tftpboot]#
Perform the following to set up the basic structure and partially populate:
cd /opt/services/tftpboot
mkdir linux
mkdir pxelinux.cfg
cp /usr/share/syslinux/pxelinux.0 .
Other kernels and boot images can be added later and nodes configured to use
them using config files in the pxelinux.cfg directory. A node can use a different configuration file based on it's IP address as given by DHCP. Name the file after the IP address converted to hex. The utility
/usr/bin/gethostip can makes this easy. e.g. for node-3;
[root@usno-serv-1 build]# gethostip node-3
node-3.usno.aoc.nrao.edu 10.1.34.103 0A012267
[root@usno-serv-1 build]#
So use pxelinux.cfg/0A012267 as the config file and node-3 will use it instead of pxelinux.cfg/default.
The kernel in this example, vmlinuz-2.6.32-220.el6.x86_64, should be the current kernel copied from the image build area, /opt/services/boot/build/0_OSimage/boot. See
UsnoDifxDisklessBoot. e.g.:
cd /opt/services/tftpboot
cp /opt/services/boot/build/0_OSimage/boot/vmlinuz-2.6.32-279.el6.x86_64 linux/
The file pxelinux.cfg/default should look like,
default linux
label linux
kernel linux/vmlinuz-2.6.32-220.el6.x86_64
append initrd=linux/sysimage.cpio.gz root=/dev/ram rw ip=dhcp
With proper values to match the kernel and the ramdisk image (initrd=).
Allow TFTP
- USNO security requires TCP wrappers
-
echo "in.tftpd:10.1.34.* #for booting diskless nodes" >> /etc/hosts.allow
echo "rpcbind:10.1.34.*, 127.0.0.1 #for NFS to diskless nodes" >> /etc/hosts.allow
echo "mountd:10.1.34.*, 127.0.0.1 #for NFS to diskless nodes" >> /etc/hosts.allow