PXE Boot Server Configuration Using Linux

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search

PXE is an acronym for Pre-Boot Execution Environment. To know what it does refer to the Pre-Boot Execution Environment page.

This document is a guide to configuration of a PXE boot server using Linux. It will be assumed that you already have an existing network with a Linux server that is responsible for assignment of DHCP addressing for your workstations. There are other guides to cover the configuration of a DHCP server.

You will need to install whatever packages are appropriate for your distribution to have PXE and TFTP.

  • Your DHCP server must also be your PXE boot server.
  • tftpd32 and PXELINUX

 

Redhat / Trustix Guide

Manual Configuration

1. You need to obtain the RPM package for PXE and the RPM package for TFTP and install them on the server.

2. Activate TFTP in xinetd

  • disable=yes to disable=no in /etc/xinetd.d/tftp
  • service xinetd restart

3. Get OS ready in the tftpboot directory

One way to do this is to create a folder and copy the OS install files into the folder. This is probably the most common way, however, there is an alternative that is pretty slick. If the media the OS install files come from are on CD, you can make an ISO image of the CD and mount that to the folder for PXE network installs.

4. Put the pxe boot linux kernel in the tftpboot directory

5. Configure /tftpboot/pxelinux.cfg

6. Create default configuration /tftpboot/pxelinux.cfg/default

7. For the client workstation to actually read the OS installation packages from the server, you may use HTTP, NFS, or SMB.

The PXE installation formula may be described as a combination of the following necessary packages:
  • PXE, TFTP, and HTTPD
  • PXE, TFTP, and NFS
  • PXE, TFTP, and Samba

HTTPD

After you copy the contents of the distribution or operating system media into a folder on the server drive you need to configure the httpd.conf file to reflect that server location. Edit the httpd.conf file (typically located in /etc/httpd/conf/httpd.conf)

<Directory /tftpboot/myOS>
Options Indexes
AllowOverride None
</Directory>

Alias /linux /tftpboot/myOS

NFS

This is the preferred option to use.

Samba

You will want to make sure you have Samba version 3 or above.

Example configuration for samba:

[OSINSTALL]
    path = /tftpboot/myOS
    browsable = true
    read only = No
    guest ok = Yes

You must set null passwords = true in smb.conf.

You also need to modify server name and path in SetupSourceDevice option of winnt.sif file.

Redhat Config Utility

Use the GUI Network Booting Tool on the Redhat server in XWindows.

If you do not have X installed, you can also use the console utility. The pxeos command line utility, which is part of the redhat-config-netboot package, can be used to configure the tftp server files.

pxeos -a -i "<description>" -p <NFS|HTTP|FTP> -D 0 -s client.example.com -L <net-location> <os-identifer>

Debian / (K)ubantu / Knoppix Guide

install the packages netkit-inetd, tftpd-hpa, dhcp3-server, and lftp, so we run

apt-get install netkit-inetd tftpd-hpa dhcp3-server lftp 

vi /etc/inetd.conf and add the following

tftp           dgram   udp     wait    root  /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot

vi /etc/dhcp3/dhcpd.conf example snippet

subnet 192.168.0.0 netmask 255.255.255.0 {
        range 192.168.0.10 192.168.0.49;
        filename "pxelinux.0";
        option subnet-mask 255.255.255.0;
        option broadcast-address 192.168.0.255;
        option routers 192.168.0.1;
}

OpenWRT / WhiteRussian Guide

PXE booting defined to dhcp server on openwrt.

dnsmasq.conf example:

# filter what we send upstream
domain-needed
bogus-priv
filterwin2k
localise-queries

# allow /etc/hosts and dhcp lookups via *.roadrunner.cx
local=/roadrunner.cx/
domain=roadrunner.cx
expand-hosts

addn-hosts=/etc/hosts
resolv-file=/tmp/resolv.conf

# enable dhcp (start,end,netmask,leasetime)
dhcp-authoritative
dhcp-range=10.0.0.80,10.0.0.200,12h
dhcp-leasefile=/tmp/dhcp.leases

# use /etc/ethers for static hosts; same format as --dhcp-host
# <hwaddr> <ipaddr>
read-ethers

# other useful options:
# default route(s): dhcp-option=3,192.168.1.1,192.168.1.2
#    dns server(s): dhcp-option=6,192.168.1.1,192.168.1.2
dhcp-option=1,255.255.255.0
dhcp-option=2,7200
dhcp-option=3,10.0.0.1
dhcp-option=5,10.0.0.1
dhcp-option=6,10.0.0.1
dhcp-option=7,10.0.0.30
dhcp-option=15,roadrunner.cx
dhcp-option=17,10.0.0.30:/opt/ltsp-4.2/i386
dhcp-option=16,10.0.0.30
dhcp-option=42,10.0.0.1
dhcp-option=44,10.0.0.30
dhcp-option=48,10.0.0.30
dhcp-option=49,kde
dhcp-option=69,10.0.0.30
dhcp-option=70,10.0.0.30
dhcp-option=72,10.0.0.30
dhcp-option=128,10.0.0.30

dhcp-vendorclass=pxe,PXEClient
dhcp-vendorclass=eth,Etherboot
dhcp-option=vendor:PXEClient,1,0.0.0.0
dhcp-boot=net:pxe,/2.6.17.8-ltsp-1/pxelinux.0,mainframe.roadrunner.cx,10.0.0.30
dhcp-boot=net:eth,/lts/vmlinuz-2.6.16.8-ltsp-1,mainframe.roadrunner.cx,10.0.0.30

There is no binary TFTPD package for White Russian. But it can easily be packported from Kamikaze using OpenWrt's SDK.

To backport the atftp (client and server) package from Kamikaze do:

cd /tmp
wget http://downloads.openwrt.org/whiterussian/newest/OpenWrt-SDK-Linux-i686-1.tar.bz2
bzcat OpenWrt-SDK-Linux-i686-1.tar.bz2 | tar -xf -
cd OpenWrt-SDK-Linux-i686-1/package/
svn co https://svn.openwrt.org/openwrt/trunk/openwrt/package/atftp/
cd ..
make atftp-clean && make atftp-compile

ls -al bin/packages
-rw-r--r--  1 openwrt-dev openwrt-dev 18249 2006-01-24 23:03 atftp_0.7-1_mipsel.ipk
-rw-r--r--  1 openwrt-dev openwrt-dev 31819 2006-01-24 23:03 atftpd_0.7-1_mipsel.ipk

You might need to get libpcre

ipkg install libpcre

CREATE THIS FILE: /etc/xinetd.d/tftp

# 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
{
       disable = no
       socket_type             = dgram
       protocol                = udp
       wait                    = yes
       user                    = root
       server                  = /usr/sbin/tftpd
       server_args             = -s /var/lib/tftpboot
       per_source              = 11
       cps                             = 100 2
       flags                   = IPv4
}

ADD TO FILE: /etc/services

tftp             69/tcp    # Trivial File Transfer
tftp             69/udp    # Trivial File Transfer

added an "a" in the line

server                  = /usr/sbin/atftpd

(as this is the name of the file located in /usr/sbin)

created file service with :

tftp    69/tcp
tftp    69/udp
tftp-mcast      1758/tcp
tftp-mcast      1758/udp

created folder /atftpboot (and put the file to be transmetted in this folder)

and
chmod 777 /atftpboot

note that atftp is client package and atftpd is server

use atftp --daemon to make listening on port

tested with TFTPD32 v3.01 (windows system) works fine