HOWTO: Boot Linux from network using PXE and DNSMASQ proxy (Ubuntu 14.04)

This an adaptation from this guide to fit to Ubuntu 14.04 LTS environment:
http://danielboca.blogspot.it/2012/02/boot-linux-from-network-using-pxe-and.html?m=1

The parts in italic are added or modified by me.

I will assume you have an Ubuntu running installation and you know its IP addess.
My IP address is 192.168.0.1: modify the menus to suit yours.
The ISO images I used are ubuntu-12.04.4-desktop-i386.iso for 12.04 and ubuntu-14.04-server-i386.iso for 14.04 (alternate DVD does not exist anymore).
Both are 32 bit, because my test box doesn’t allow 64 bit virtualization, but the process is identical: search and replace “i386” with “amd64”.

ATTENTION! With this article I could get a working PXE server and correctly install Ubuntu 12.04.
Ubuntu 14.04 installation boots kernel and initrd, but gets stuck after that!!! Any help will be greatly appreciated.

This tutorial allows to boot and install Linux from network using PXE and DNSMASQ.

DNSMASQ is a very light implementation of TFTPD,DHCPD and NAMED.

In most of the cases there is already a DHPCD server on the network and starting a new DHCPD server would not work.
Therefore we are going to configure DNSMASQ as a PROXY DHCPD for the existing server and specify what PXE service to use.

The example provides a menu that can install Ubuntu 12.04, Ubuntu 14.04 and also can start the Memtest utility from the network.

Configure SYSLINUX

Become superuser
sudo -i

Install syslinux
aptitude install syslinux

Create a folder for TFTP server with the following (similar) structure
mkdir -p /tftpboot/pxelinux.cfg
mkdir -p /tftpboot/images/ubuntu/12.04/i386
mkdir -p /tftpboot/images/ubuntu/14.04/i386

Copy the necessary files from syslinux
cp /usr/lib/syslinux/vesamenu.c32 /tftpboot
cp /usr/lib/syslinux/pxelinux.0 /tftpboot

Now, let’s assume that the original ISOs have been copied/mounted in /iso/ubuntu12.04 and /iso/ubuntu14.04.

Copy initrd and linux kernel from the original ISOs
cp /iso/ubuntu12.04/install/netboot/ubuntu-installer/i386/initrd.gz /tftpboot/images/ubuntu/12.04/i386
cp /iso/ubuntu12.04/install/netboot/ubuntu-installer/i386/linux /tftpboot/images/ubuntu/12.04/i386

cp /iso/ubuntu14.04/install/netboot/ubuntu-installer/i386/initrd.gz /tftpboot/images/ubuntu/14.04/i386
cp /iso/ubuntu14.04/install/netboot/ubuntu-installer/i386/linux /tftpboot/images/ubuntu/14.04/i386

Download and copy memtest from memtest.org
wget http://www.memtest.org/download/5.01/memtest86+-5.01.bin.gz
gzip -d ./memtest86+-5.01.bin.gz
cp ./memtest86+-5.01.bin /tftpboot/memtest

Create and edit /tftpboot/pxelinux.cfg/default file
The IP 192.168.0.1 can be changed to reflect the path to your installation files
default vesamenu.c32
prompt 0

menu title PXE Boot Menu

label ubuntu-12.04-i386
menu label ubuntu-12.04-i386
kernel images/ubuntu/12.04/i386/linux
append initrd=images/ubuntu/12.04/i386/initrd.gz method=nfs:192.168.0.1:/iso/ubuntu12.04 lang=us keymap=us ip=dhcp noipv6

label ubuntu-14.04-i386
menu label ubuntu-14.04-i386
kernel images/ubuntu/14.04/i386/linux
append initrd=images/ubuntu/14.04/i386/initrd.gz method=nfs:192.168.0.1:/iso/ubuntu14.04 lang=us keymap=us ip=dhcp noipv6

label memtest86
menul label memtest86
kernel memtest
append -

If you like a simpler text mode menu, change vesamenu.c32 with menu.c32 (after you have copied it from /usr/share/syslinux).

Configure DNSMASQ

Install dnsmasq
aptitude install dnsmasq

Create and edit /etc/dnsmasq.d/pxe.conf with the following content
The IP 192.168.0.1 should be the IP of the machine that runs DNSMASQ

tftp-root=/tftpboot
enable-tftp
dhcp-boot=pxelinux.0
dhcp-option=vendor:PXEClient,6,2b
dhcp-no-override
pxe-prompt="Press F8 for boot menu", 3
pxe-service=X86PC, "Boot from network", pxelinux
pxe-service=X86PC, "Boot from local hard disk", 0
dhcp-range=192.168.0.1,proxy

Edit /etc/dnsmasq.conf and check you have a line at the of the file similar to this:
conf-dir=/etc/dnsmasq.d

(Re)start dnsmask
sudo service dnsmasq restart

Boot a machine using the network option from BIOS and install your system or run memtest!

Share on FacebookTweet about this on TwitterShare on LinkedInGoogle+Email to someonePrint this page

4 thoughts on “HOWTO: Boot Linux from network using PXE and DNSMASQ proxy (Ubuntu 14.04)

  1. Hi! sorry but i have problems during the installation with the mirrors. I dont want install with this system. Its supossed that the configuration of nfs is for pick up the files of the local server or maybe im confused.

  2. I am not sure if I get the point, but nfs (from the little I know in netbooting) is only needed to run live distributions. The main purpose of this guide is to set up a machine to run server or alternate installations, so http is enough.

Leave a Comment

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *