Sharing Our Passion for Technology
& continuous learning
〈  Back to Blog

Ubuntu Live Network Boot using PXE

Requirements

  • Linux server with NFS (or compatible)
  • TFTP server
  • DHCP server
  • syslinux / pxelinux files

To simplify these instructions we are going to make the following assumptions.

  • DHCP server is 10.0.0.2
  • TFTP server is 10.0.0.3
  • NFS is a Ubuntu server at 10.0.0.4

In reality it’s likely your TFTP and NFS server are going to be the same server, however because we go by IP in this, it is hopefully easier to understand.

Basic working of PXE

When a client attempts to boot by PXE, it makes a DHCP request. The DHCP server responds with an IP address and the IP of the TFTP server as well as a file to request.

The PXE client connects to the given IP and requests the file (pxelinux)

The system then looks for a configuration file.

Setting up NFS

Installing NFS

sudo apt-get install nfs-kernel-server nfs-common portmap

Setting up NFS for Ubuntu Live Network Boot

In this we will assume that we are going to mount the NFS at /srv/nfs/ubuntu. Download Ubuntu ISO Mount the ISO:

sudo mount -o loop ubuntu-x,xx-desktop.iso /mnt

Copy the contents of the CD:

sudo cp -a /mnt /srv/nfs/ubuntu

Edit /etc/exports:

/srv/nfs/ubuntu 10.0.0.0/255.255.255.0(async,no_root_squash,no_subtree_check,ro)

Restart NFS

sudo /etc/init.d/nfs-kernel-server restart

Setting up TFTP

There are windows TFTP servers, but for this we are going to use the Ubuntu box.

To Install:

sudo apt-get install xinetd tftpd tftp

Configuration: Edit/Create /etc/xinetd.d/tftp to:

service tftp{
 protocol = udp
 port = 69
 socket_type = dgram
 wait = yes
 user = nobody
 server = /usr/sbin/in.tftpd
 server_args = /tftpboot
 disable = no
}

Start TFTP

sudo /etc/init.d/xinetd start

Setting up TFTP for PXE

Download PXELinux (preferably) or SysLinux. Extract the contents into the /tftpboot boot directory Copy Ubuntu’s Kernel & initrd.gz

mkdir /tftpboot/casper
sudo mount 10.0.0.4:/srv/nfs/ubuntu /mnt
sudo cp /mnt/casper/initrd.gz /tftpboot/casper
sudo cp /mnt/casper/vmlinuz /tftpboot/casper

Create the config directory:

mkdir /tftpboot/pxelinux.cfg

Create the default config for PXE

vi /tftpboot/pxelinux.cfg/default

with the contents:

default menu.c32
prompt 0
LABEL ^Boot Live Ubuntu
kernel casper/vmlinuz
append root=/dev/nfs boot=casper netboot=nfs nfsroot=10.0.0.4:/srv/nfs/ubuntu initrd=casper/initrd.gz quiet splash --

Setting up DHCP

Windows Server

Open the DHCP Manager, edit expand your scope Select Scope Options Add the following options:

067   Boot File Name                            pxelinux.0
066    Boot Server Hostname             10.0.0.3

Linux

Edit dhcpd.conf to include:

allow booting;
allow bootp;

Add the dhcp.conf group:

next-server 10.0.0.3;
filename "pxelinux.0";

Boot Ubuntu

With a bit of luck you can now boot any PXE compatable PC on the network into a network booted Ubuntu Live CD.

〈  Back to Blog