I must learn to write succinct page titles ;)

Why?

A PXE Boot/Install environment has been on my to-do list for ages… for a number of reasons. I frequently update the versions of Linux on my (too) large estate of systems, for many reasons.

These days most of the versions of Linux I use are downloaded as ISO CD/DVD images. It’s just plain inconvenient to have to burn these images to physical media, and then go hunting for that disk the next time I want to do an install on another machine. Not to mention environmentally unsound.

I have created ad-hoc install servers frequently, it is ridiculously easy to do so using the YaST install server module in the SUSE Linux distributions. However that still needs a bootable CD to get to the install source, and sometimes that’s not convenient, as I have some systems without CD/DVD drives, such as tablets, and laptops with extra batteries in place of the optical drives, etc.

So really it’s just to make my life simpler, always a good plan.

What?

In case you have stumbled upon this page by accident and are asking yourself, “Just what the heck is PXE?” , then let me explain:

PXE is way to start computers without Floppy/Hard Disk/CD-ROM/Flash Memory Storage Device. The computer, BIOS permitting, will boot right from the network, instead of a local device, it reads it’s operating environment from another system on the network.

To make all of this work, there needs to be a server on the network that is able to respond to PXE requests from a client, and act on them, and the client needs to be able to run the PXE (Pre-boot eXecution Environment) code for the installed network card (NIC). Most modern systems are able to boot using the (integrated) NIC.

References (starting points)

openSUSE wiki PXE boot and install server how-to guide.

Novell Cool Solutions site: “Setting Up a SUSE PXE Installation Server in an Existing NetWare Environment“.

How-To:

Services Required:

We will need to run the following services, so make sure that the appropriate packages are installed and the services running:

  • TFTP – to distribute the booting kernel & initrd
  • DHCP – to assign addresses and point the system at the kernel for booting

We will also need the important files from the “syslinux” packag.

Finally as this is going to be an install server, some way of distributing installation media is required, that can be, for example, a web server (HTTP), or a file server (NFS, SMB).

My Implementation:

Operating system: openSUSE 10.2 [latest, fully patched, June 2007.]

Package versions:

TFTP: atftp-0.7.0-22
DHCP server: dhcp-server-3.0.5-7
syslinux: syslinux-3.31-16

A note on DHCP from the openSUSE wiki:

With the ISC DHCP server version 3 (shipped on openSUSE) it is possible to configure the DHCP server to only respond to booting requests and this way run it in parallel with another default dhcp server. This may be desireable in case the default dhcp server can not be configured to supply a boot server or boot file name (this is the case with many DSL routers). The PXE client will ingore DHCP offers that do not contain a boot server or boot file name.

As I have an ADSL modem that acts as a DHCP server already I chose to configure the DHCP server on my PXE boot server this way as this is a system that isn’t necessarily always-on, unlike the ADSL modem.

First things first, configure DHCP, very similar to the example on the openSUSE wiki.

/etc/dhcpd.conf

# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#

# option definitions common to all supported networks...
#
# All of this happens behind the firewall, and the whole domain
# is made-up anwyay, so this is mostly fluff.
#
option domain-name "networkboot.org";
# We don't have Nameservers... so let's just forget this item
#option domain-name-servers ns1.networkboot.org, ns2.networkboot.org;

default-lease-time 600;
max-lease-time 7200;

# if you do not use dynamical DNS updates:
#
# this statement is needed by dhcpd-3 needs at least this statement.
# you have to delete it for dhcpd-2, because it does not know it.
#
# if you want to use dynamical DNS updates, you should first read
# read /usr/share/doc/packages/dhcp-server/DDNS-howto.txt
ddns-update-style none; ddns-updates off;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

#  We only want to respond to PXE DHCP requests

allow booting;

# define rules to identify DHCP Requests from PXE and Etherboot clients.

class "pxe" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
}
class "etherboot" {
match if substring (option vendor-class-identifier, 0, 9) = "Etherboot";
}

# This is our subnet for PXE boot/installation.

subnet 192.168.0.0 netmask 255.255.255.0 {
option broadcast-address 192.168.0.255;
 pool {
  range 192.168.0.201 192.168.0.211; # only need a few addresses
  default-lease-time 180; # no long lease time required for booting
  max-lease-time 360;     # booted system does its own dhcp request
  server-name "192.168.0.8"; # This happens to be the IP of this server too
  next-server 192.168.0.8; # Address of the TFTP server
  filename "/tftpboot/pxelinux.0";
  allow members of "pxe"; # only respond to PXE requests
  allow members of "etherboot"; # allow etherboot, too
 }
}

Don’t forget to specify which ethernet interface to use for the DHCP server, in /etc/sysconfig/dhcpd:

# Interface(s) for the DHCP server to listen on.
#
#
DHCPD_INTERFACE="eth0"

Now configure tftp, again using best-practices from openSUSE…

/etc/sysconfig/atftpd

## Path:    Network/FTP/Atftpd
## Description: ATFTP Configuration
## Type:    string
## Default: "--daemon "
#
# atftpd options
#
ATFTPD_OPTIONS="--daemon --user tftp -v"

## Type:    yesno
## Default: no
#
# Use inetd instead of daemon
#
ATFTPD_USE_INETD="no"

## Type:    string
## Default: "/tftpboot"
#
#  TFTP directory must be a world readable/writable directory.
#  By default /tftpboot is assumed.
#
ATFTPD_DIRECTORY="/srv/tftp"

## Type:    string
## Default: ""
#
#  Whitespace seperated list of IP addresses which ATFTPD binds to.
#  One instance of the service is started on each IP address.
#  By default atftpd will listen on all available IP addresses/interfaces.
#
ATFTPD_BIND_ADDRESSES=""

The configuration file causes the TFTP daemon to run as user “tftp”, you may need to add this user to your system:

# useradd tftp

Now (re)start the DHCP & TFTP daemons:

# rcdhcpd restart
# rcatftpd restart

That’s the infrastructure done. Now onto the PXE configuration itself.

Firewall

Don’t forget to allow access to the tftp daemon on the boot server by opening up port 69 (default port for tftp) to the local network from which the client systems will boot.

PXE Configuration

Under the /srv/tftp directory we need the following directory structure:

/srv/tftp/tftpboot
/srv/tftp/tftpboot/pxelinux.cfg

Copy the pxelinux.0 file from /usr/share/syslinux/ to /srv/tftp/tftpboot/

We also need a configuration file to pass the correct parameters pointing to where the bootable kernel & initrd are. A useful starting point is the installation media where there is a handy file called isolinux.cfg which is a good starting point.

Copy the isolinux.cfg file from [path to cd/dvd]/boot/i386/loader/isolinux.cfg /srv/tftp/tftpboot/pxelinux.cfg/default ; notice it is renamed to default.

Also required are the following files from [path to cd/dvd]/boot/i386/loader/

message – used to display the boot options detailed in the default aka isolinux.cfg file

linux - the linux install kernel

initrd – the corresponding installation system RAMDISK

copies of these files should placed in /srv/tftp/tftpboot/ directory. The message file is used to display the boot options detailed in the default aka isolinux.cfg file.

And that’s it. That’s enough to get a client system to network boot. The downside of this is that it won’t do anything terribly useful at this stage, other than just boot the installation kernel, and then stop when it can’t find the remainder of the installation source.

3 Responses to “Setting up a PXE Boot Environment with openSUSE Linux”


  1. […] A guide to Setting up a PXE Boot Environment with openSUSE¬†Linux. […]


  2. This is a very nice description of a PXE environment to do network booting and installs.

    But if you just want a way of installing without burning CDs, consider copying the /boot directory from the media to a directory on hard disk (say /bootinstall), and then adding a suitable entry to GRUB to point to the loader/linux (as kernel) and loader/initrd files below this, with a suitable “install=” following the kernel entry.

    Then you can boot that grub menu entry and start the install.

    Install from hard disk is unsupported, but works fine (e.g. install=hd:/sda3/). But you have to leave /dev/sda3 alone in the partitioning dialog in YaST: don’t try to set up a mount point until afterwards, or the install may fail.

    See also:

    http://disruptive.org.uk/2006/01/28/suse_remote_install_howto.html

  3. Dan Homolka Says:

    Roger,

    Thanks for the comment, it’s mostly a synthesis of several articles and interpreting configuration files, but aligned to my wavelength.

    The real reason *I* went through the process of setting up a PXE environment is because I have a couple of machines without optical drives (not all running Linux :-o) and occasionally need to do a quick & dirty RESCUE boot :) Which will be the subject of another page… soon.

    You beat me to referencing your remote install how-to :) Which is a splendidly useful document, appearing in my bookmarks in at least four different browsers :)

    Dan.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: