Project

General

Profile

Tftp » History » Version 9

Ohad Levy, 02/21/2012 07:46 AM

1 1 Ohad Levy
h1. TFTP
2 1 Ohad Levy
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 2 Frank Sweetser
7 2 Frank Sweetser
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 2 Frank Sweetser
9 8 Ohad Levy
Foreman tries to guess the right server name that should put into the dhcp record, if this is not what you want, you can override it - see 
10 8 Ohad Levy
*tftp_servername* under [[Settingsyml]].
11 2 Frank Sweetser
12 2 Frank Sweetser
h2. Setting Up the Proxy Server Host
13 2 Frank Sweetser
14 2 Frank Sweetser
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.
15 2 Frank Sweetser
16 2 Frank Sweetser
h3. Automatic Setup
17 2 Frank Sweetser
18 9 Ohad Levy
Foreman includes a "TFTP server module":https://github.com/theforeman/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/tftpboot@, which may change if necessary.  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@.
19 2 Frank Sweetser
20 2 Frank Sweetser
h3. Manual Setup
21 2 Frank Sweetser
22 2 Frank Sweetser
The setup is very simple, and may be performed manually if desired.
23 2 Frank Sweetser
24 3 Mohit Chawla
# The TFTP root directory must exist (we will use @/var/lib/tftpboot@ in this example).
25 3 Mohit Chawla
# Populate @/var/lib/tftpboot@ with PXE booting prerequisites.  At a minimum, this should include:
26 2 Frank Sweetser
** @pxelinux.0@
27 2 Frank Sweetser
** @menu.c32@
28 2 Frank Sweetser
** @chain.c32@
29 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).
30 3 Mohit Chawla
# Create the directory @/var/lib/tftpboot/pxelinux.cfg@ and make it writeable by the foreman proxy user (foreman-proxy).
31 2 Frank Sweetser
32 2 Frank Sweetser
h2. Setting Up Foreman
33 2 Frank Sweetser
34 2 Frank Sweetser
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.
35 2 Frank Sweetser
36 2 Frank Sweetser
h2. Workflow
37 2 Frank Sweetser
38 2 Frank Sweetser
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.
39 2 Frank Sweetser
40 3 Mohit Chawla
# Call @mkdir -p /var/lib/tftpboot/pxelinux.cfg@ if it does not already exist.
41 3 Mohit Chawla
# 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.
42 3 Mohit Chawla
# Call @mkdir -p /var/lib/tftpboot/boot@ if it does not already exist.
43 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
44 2 Frank Sweetser
<pre>wget --no-check-certificate -nv -c <src> -O "<destination>"</pre>
45 2 Frank Sweetser
# At this point, the TFTP state is ready for the installation process.
46 2 Frank Sweetser
# Once the host has completed installation, the OS specific installation script should inform foreman by retrieving the built URL.
47 2 Frank Sweetser
# The host-specific TFTP configuration file is deleted.
48 2 Frank Sweetser
# 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.
49 7 Ohad Levy
50 7 Ohad Levy
h2. Limitations
51 7 Ohad Levy
52 7 Ohad Levy
At the moment, the proxy is not able to fetch boot files using NFS.
53 7 Ohad Levy
As a workaround, expose your installation medium (or use a public mirror) over http/ftp to configure one machine with the require boot files.
54 7 Ohad Levy
this would be resolved as part of #992.