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:

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 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

<em>aptitude install</em> syslinux

Create a folder for TFTP server with the following (similar) structure

mkdir -p /tftpboot/pxelinux.cfg<br /> mkdir -p /tftpboot/images/<em>ubuntu/12.04/i386</em><br /> mkdir -p /tftpboot/images/<em>ubuntu/14.04/i386</em>

Copy the necessary files from syslinux

cp <em>/usr/lib/syslinux/vesamenu.c32</em> /tftpboot<br /> cp <em>/usr/lib/syslinux/pxelinux.0</em> /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 <em>/iso/ubuntu12.04/install/netboot/ubuntu-installer/i386/initrd.gz /tftpboot/images/ubuntu/12.04/i386</em><br /> cp <em>/iso/ubuntu12.04/install/netboot/ubuntu-installer/i386/linux /tftpboot/images/ubuntu/12.04/i386</em>

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

wget<br /> gzip -d ./memtest86+-5.01.bin.gz<br /> cp ./memtest86+-5.01.bin /tftpboot/memtest

Create and edit /tftpboot/pxelinux.cfg/default file

The IP can be changed to reflect the path to your installation files

`default vesamenu.c32
prompt 0</p>

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: 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: 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 should be the IP of the machine that runs DNSMASQ `tftp-root=/tftpboot
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=,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!