Project

General

Profile

Tftp » History » Version 4

Mohit Chawla, 04/06/2011 12:13 PM

1 1 Ohad Levy
h1. TFTP
2
3 2 Frank Sweetser
An essential first step in netbooting a system is preparing the TFTP server with the PXE configuration file and boot images.  This document assumes that you have already configured your DHCP infrastructure, either via manual configuration or through the DHCP smart proxy.
4 1 Ohad Levy
5 2 Frank Sweetser
h2. Configuration Values
6
7
Once enabled, there is currently only one valid setting to change, the default TFTP root.  This is set with the @:tftproot:@ parameter, which defaults to @/var/lib/tftpboot@.
8
9
Please note that currently, foreman defaults to the name of the machine running the TFTP smart proxy.  Future plans are to allow you to explicitly specify the nextServer value - see issue #800 for details.
10
11
h2. Setting Up the Proxy Server Host
12
13
Regardless of the filesystem setup is performed, you must also make sure you have the wget utility installed and in the default path.  wget is used to download OS specific installation when a given host is enabled for the build process.
14
15
h3. Automatic Setup
16
17 4 Mohit Chawla
Foreman includes a "TFTP server module":https://github.com/ohadlevy/puppet-foreman/blob/master/foreman/manifests/proxy/tftp.pp that will perform all of the basic setup.  It defaults to TFTP root of @/var/lib/tftproot@, which may change if necessary (a distribution package might have /var/lib/tftpboot as the tftp root directory, fore instance).  You will still need to provide the basic TFTP load images in your TFTP root directory.  For vanilla PXE booting, this includes @pxelinux.0@, @menu.c32@, and @chain.c32@.
18 2 Frank Sweetser
19
h3. Manual Setup
20
21
The setup is very simple, and may be performed manually if desired.
22
23 3 Mohit Chawla
# The TFTP root directory must exist (we will use @/var/lib/tftpboot@ in this example).
24
# Populate @/var/lib/tftpboot@ with PXE booting prerequisites.  At a minimum, this should include:
25 2 Frank Sweetser
** @pxelinux.0@
26
** @menu.c32@
27
** @chain.c32@
28 3 Mohit Chawla
# Create the directory @/var/lib/tftpboot/boot@ and make it writeable by the foreman proxy user (foreman-proxy, for instance, when installing through a rpm package).
29
# Create the directory @/var/lib/tftpboot/pxelinux.cfg@ and make it writeable by the foreman proxy user (foreman-proxy).
30 2 Frank Sweetser
31
h2. Setting Up Foreman
32
33
In most cases, the default templates should work fine.  You do, however, need to make sure that a PXELinux or gPXE template is associated with your hosts.  See [[Foreman:Unattended_installations|Unattended Installations]] for details.  The template will be used to define the PXE configuration file when a host is enabled for build.
34
35
h2. Workflow
36
37
This is a rough outline of the steps triggered on the TFTP smart proxy host when you click on the "Build" link for a host.
38
39 3 Mohit Chawla
# Call @mkdir -p /var/lib/tftpboot/pxelinux.cfg@ if it does not already exist.
40
# Create a host-specific TFTP configuration file in @/var/lib/tftpboot/pxelinux.cfg/01-XX-XX-XX-XX-XX-XX@, named based off of the MAC address, using the associated PXE template.
41
# Call @mkdir -p /var/lib/tftpboot/boot@ if it does not already exist.
42 2 Frank Sweetser
# Download the OS specific kernel and initrd files using wget.  The download URLs are derived from the installation media path, and OS specific log (see @app/models/redhat.rb@ and @debian.rb@ in foreman for examples of the gory details).  The exact wget command is
43
<pre>wget --no-check-certificate -nv -c <src> -O "<destination>"</pre>
44
# At this point, the TFTP state is ready for the installation process.
45
# Once the host has completed installation, the OS specific installation script should inform foreman by retrieving the built URL.
46
# The host-specific TFTP configuration file is deleted.
47
# The kernel and initrd are not deleted, but left in place for future installs of the same OS and architecture combination.  Please note that in the unlikely case that these files are modified, the simplistic freshness check of wget will likely get confused, corrupting the downloaded versions of the files.  If this happens, you should simply delete the files and let them be re-downloaded from scratch.