How to setup a PXE server with Ubuntu without affecting your router

NOT COMPlETE YET! But it works 🙂

Since most home networks uses a router with a builtin dhcp server, I wanted a PXE server which doesnt affect the router. So, this guide shows how to setup a PXE service on an Ubuntu server machine. PXE is used to install linux diskless by using your home network.
To make this happen we are going to use DNSmasq and a nfs-server.

Things you need to setup a working PXE service:
1. Ubuntu server
2. DNSmasq
2.1 syslinux
3. nfs-server
4. Operating Systems

ubuntu

1. Ubuntu server

Download the server from ubuntu website and install it.

dnsmasq

2. DNSMasq

DNSmasq is used for the pxe service and tftp-server.

Be sudo

sudo -s

Install Dnsmasq

apt-get install dnsmasq

Now you need to change the configuration.
But make a backup of the config file first.

mv /etc/dnsmasq/dnsmasq.conf /etc/dnsmasq/dnsmasq.conf.old

Then create a config file with this:

vi /etc/dnsmasq.conf

And paste the following in it, but change the following:

dhcp-range= to your ip


dhcp-boot=pxelinux.0
log-dhcp
dhcp-option=vendor:PXEClient,6,2b
dhcp-no-override
pxe-prompt="Press F8 for boot menu", 1
pxe-service=X86PC, "Boot from network", pxelinux
pxe-service=X86PC, "Boot from network iPXE", undionly
pxe-service=X86PC, "Boot from local hard disk", 0
dhcp-range=192.168.0.11,proxy,255.255.255.0
enable-tftp
tftp-root=/var/lib/tftpboot/

Alright, restart dnsmasq

/etc/init.d/dnsmasq restart

syslinux

2.1 Syslinux

To make dnsmasq work with PXE we need some pxe files from syslinux.

In progres….

Create a directory for the operatings system later on

mkdir /var/lib/tftpboot/dist/code>

nfsserver

3. NFS Server

Be sudo

sudo -s

Install the nfs-kernel-server

apt-get install nfs-kernel-server

Edit the configuration file to make the files available

vi /etc/exports

And create a line at the bottom that says:

/var/lib/tftpboot/dist *(ro,async,no_root_squash,no_subtree_check,insecure)

Dont forget the insecure at the end!! I couldnt get any access to the nfs otherwise…This actually took me a while…

os

4. Operating Systems

extract

4.1 Extract the iso’s

config

4.2 Configuration Files

I got the configuration files from Yumi, a multiboot usb creator and changed it a bit so the files will boot over pxe and nfs. This was actually the hardest part since most guides on the internet use different configurations.

For Ubuntu


label test
menu label test
kernel dist/ubuntu13/casper/vmlinuz.efi
append boot=casper netboot=nfs nfsroot=192.168.0.11:/home/export/ubuntu13 initrd=dist/ubuntu13/casper/initrd.lz

For fedora

label live
menu label Run Fedora 19 KDE 64
kernel dist/fedora19/pxeboot/vmlinuz
APPEND netboot=nfs nfsroot=192.168.0.1:/home/export/fedora19 initrd=dist/fedora19/pxeboot/initrd.img rw rd.live.image rhgb rd.luks=0 rd.md=0 rd.dm=0

Sidebar