Tero Karvinen - Articles - Downloads - Courses - Contact

Table of Contents

Network Boot Server with Ubuntu 8.04 Hardy

Ubuntu can work as a network boot server. For example, workstations can PXE boot to Ubuntu installer and install Ubuntu trough network. I describe a working setup to create a PXE boot server with Ubuntu 8.04, ISC DHCP-server and HPA TFTP-server.

Install DHCP server

DHCP server distributions network information: ip address, mask, default gateway and nameservers.

See Ubuntu DHCP.

PXE Specific DHCP Settings

In PXE network booting, DHCP server tells client where to download bootloader image.

Add to the global scope of your dhcp.conf:

next-server 172.28.1.221; # TFTP server ip address
filename "pxelinux.0"; # name of bootloader image

TFTP Serves Files

In PXE network boot, the files needed for booting are served with TFTP. Trivial FTP (TFTP) should not be confused with FTP, even if their names sound a bit similar.

The bootloader files served are:

Other files are referenced in pxelinux.cfg are kernel and initial ramdisk image:

Install TFTP

Install TFTP server

$ sudo apt-get install tftpd-hpa

Enable it. it’s beyond me why it’s not enabled by default:

$ sudo nano /etc/default/tftpd-hpa

Set RUN_DAEMON to yes.

RUN_DAEMON="yes"

Start TFTP server. Verify that it prints “Starting...”

$ sudo /etc/init.d/tftpd-hpa start
Starting HPA's tftpd: in.tftpd.

Copy Files to Server

TFTP servers files from /var/lib/tftpboot.

Bootloader:

$ sudo apt-get install syslinux  # contains pxelinux.0 bootloader
$ sudo cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot/

Bootloader configuration:

$ sudo mkdir /var/lib/tftpboot/pxelinux.cfg
$ sudo nano /var/lib/tftpboot/pxelinux.cfg/default
# pxelinux.cfg/default - network boot loader configuration
# (c) 2008 Tero Karvinen www.iki.fi/karvinen
# All paths are relative to pxelinux.0 path, usually /var/lib/tftpboot
display welcome.txt
prompt 1
timeout 30      # seconds
default ubuntu-8.04
label ubuntu-8.04
      kernel ubuntu-8.04/linux
      # append must be on a single line
      append initrd=ubuntu-8.04/initrd.gz ramdisk_size=64000 root=/dev/rd/0 rw -- debian-installer/locale=en_DK kbd-chooser/method=fi netcfg/get_hostname=x netcfg/get_domain=x

Kernel and initial ramdisk image (these examples are for amd64 cpu architechture):

$ wget http://fi.archive.ubuntu.com/ubuntu/dists/hardy/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux
$ wget http://fi.archive.ubuntu.com/ubuntu/dists/hardy/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz
$ sudo mkdir /var/lib/tftpboot/ubuntu-8.04
$ sudo mv linux initrd.gz /var/lib/tftpboot/ubuntu-8.04/

Test TFTP

It’s much easier to catch TFTP problems now than later.

$ mkdir testdir
$ cd testdir
$ tftp -v localhost -c get pxelinux.0
Connected to localhost (127.0.0.1), port 69
getting from localhost:pxelinux.0 to pxelinux.0 [netascii]
Received 14296 bytes in 0.2 seconds [702075 bit/s]
$ ls -l  # verify that file size is greater than zero
-rw-r--r-- 1 tee tee 14146 2008-09-11 12:58 pxelinux.0
$ sudo apt-get install syslinux

Last modified: 2008-09-11. Permanent url: http://www.iki.fi/karvinen/ubuntu_hardy_pxe_notes.html

Tero Karvinen www.iki.fi/karvinen - Top - Validate HTML - Validate CSS