PXE Boot Server

Wow!  Wouldn’t it be nice if you could boot up a diagnostic operating system — Perhaps something as useful Parted Magic — over the network?  With the enormous help of DNSMasq, you can with relative ease!  A big “shout out” to Shawn Powers over at Linux Journal for putting together a great intro to DNSMasq.

We’re going to keep this simple and since we’ll be serving ip addresses,  you may want to separate your network – I’ve found a laptop works brilliantly.  You automatically have 2 interfaces – one (wired) for the PXE network and the other (wireless) for internet access.

The network manager GUI may get in the way of things…
$ sudo apt-get remove network-manager

Change your wired interface to a static IP:
$ sudo /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static

auto wlan0
iface wlan0 inet dhcp
wpa-ssid xxxxx
wpa-psk xxxxx

Let’s turn on packet forwarding from one interface to the other:

$ sudo apt-get install dnsmasq
gets you started on the useful path to booting over the network.

One configuration file?  That’s right! And well commented.  What a relief, because we really don’t need anything fancy when starting out.
/etc/dnsmasq.conf is where you’ll find the options to set up your PXE boot config .

To specify an interface for DHCP, uncomment:
interface=eth0     # change to your interface if necessary

To turn on the DHCP server, uncomment:
dhcp-range=,,12h     # You may want to use different IPs #

** Uncomment the boot filename **

DNSMasq also gives you options for menus!
“Boot from local disk”
“Install Linux”

To enable the tftp server, uncomment:

** Remember to tell DNSMasq where your pxelinux.0 file is **

Basically, you’re doing this…
dhcp-option=3,  # To set the gateway
dhcp-option=6,,  # To set DNS servers

Restart DNSMasq
$ sudo service dnsmasq restart

EASY!!!  Now transfer your PXE files into /var/lib/tftpboot
$ sudo mkdir /var/lib/tftpboot

Let’s start with pxelinux.0
$ sudo cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot/

# ** Note:  you need to copy ldlinux.c32 from an Ubuntu iso (/install/netboot/ubuntu-installer/amd64/boot-screens) to /var/lib/tftpboot

For Parted Magic, create a directory for it:
$ sudo mkdir /var/lib/tftpboot/pmagic

Put the following files into your pmagic directory:

Create a pxelinux.cfg directory:
$ sudo mkdir /var/lib/tftpboot/pxelinux.cfg

In your pxelinux.cfg directory, create a file called “default” and enter similar text:
DEFAULT pmagic32

LABEL pmagic32
LINUX pmagic/bzImage
INITRD pmagic/initrd.img,pmagic/files.cgz
APPEND edd=on vga=normal

LABEL pmagic64
LINUX pmagic/bzImage64
INITRD pmagic/initrd64.img,pmagic/files.cgz
APPEND edd=on vga=normal

Allright ! or Allright ???
You may need to modify your settings to get this working properly.

When you’re ready to take this to the next level…

Leave a Reply

Your email address will not be published. Required fields are marked *