In this part, I will go through the install and setup of the needed software.
This list was in Part 1 as the software needed for this :
The first 2 packages are the ones that make the magic happen.
Dnsmasq is a DHCP and TFTP server, which will let the computers that are connected to the network get an IP address and also grab the files it needs to boot from the server.
Syslinux, or more specifically it’s derivative pxelinux will let computers on the network request a file.
Step 1 – Software Install
Anyway, starting from the end of part 1 – we had just installed Debian Linux.
So first thing we do ?
We need to login, preferably as root to do all the configuration stuff first but you can login as your user and then su to root as well or install sudo and use that.
So once you’re logged in, you’re ready to install the software. If you are going to use CDs to install the software then you should be able to skip this step, but if it doesn’t work then you can still use the
apt-get update command and you should get something similar to this screenshot.
If you have an internet connection, then first thing we need to do is update the sources list with the
apt-get update command.
So after we’ve run the
apt-get update we should see something similar to above.
That updates the software sources that you selected while you were installing the Debian.
Installing the software
Once the software sources are up to date, you can now install the software that you need with this command :
apt-get install dnsmasq syslinux memtest86+
That command will install the 3 packages and any other dependencies that they need to function.
When you run the command you should get something similar to this (I forgot to install memtest at the time of the screenshot 🙁 ) :
Hit enter and you get …
Now you have the software that you need to boot from the network installed !
Step 2 : Configuring the Software
First thing I do now is stop dnsmasq and rename it’s configuration files so we can start with a blank configuration file to make it easier to read later.
To stop dnsmasq, you run this command as root :
Then to rename the config file, you use this command :
mv /etc/dnsmasq.conf /etc/dnsmasq.conf.backup.
Also this is a good time to unplug the pxe server from the network if it is plugged in, because when we start up dnsmasq again, it will start trying to hand out IP addresses, and if there’s 2 DHCP servers on the network, it may wreak havoc with any new computers trying to get an IP address.
Get the files you need
Next up, you will need to create a directory for the TFTP server to store it’s files.
In this guide, I have chosen to use /tftpboot for the server root.
To create the necessary directory, you run this command, again as root :
mkdir -p /tftpboot/boot.
You will now have a directory called /tftpboot and a sub-directory called /tftpboot/boot created.
You will need these later to store the files you use to network boot computers.
You will also need a /tftpboot/pxelinux.cfg directory created, this is where the configuration files for pxelinux will live.
Next is to copy the files for pxelinux over to the tftpboot directory.
You will need 2 files for this step,
In Debian, the files are located in
/usr/lib/syslinux which is where apt-get installed the syslinux package.
Both pxelinux.0 and menu.c32 will need to go into /tftpboot, and to achieve that you will need to run these commands which will copy the files to where we need, again as root :
cp /usr/lib/syslinux/pxelinux.0 /tftpboot
cp /usr/lib/syslinux/menu.c32 /tftpboot
After that, we need to copy the memtest file to the correct directory.
When you first install it, it is installed into /boot for use on the local machine.
To copy it to where we need, we do another
cp to where it needs to go.
cp /boot/memtest86+.bin /tftpboot/boot/memtest86+
I’ve removed the .bin extension as PXELINUX won’t boot memtest properly if the bin extension is kept.
Now with all the files in the correct spot, we can move onto the configuration files.
This is the time to setup a static IP address if you haven’t already. The configuration will differ depending on whether you have 1 or 2 network cards, but the general setup remains the same.
I have used 10.1.1.1 as the IP address for my pxe server, and so my configuration file (/etc/network/interfaces) goes :
iface eth0 inet static
Whether your configuration will be the same or not will depend in your network, but that will work for now.
For dnsmasq, we will need to specify some options to setup the tftp server’s options.
We will need to create a new file with your favourite text editor at /etc/dnsmasq.conf.
The following lines will be added –
This option is needed if you have more than 1 network card, it will tell dnsmasq to listen on eth0 for the DHCP requests.
This will set the range of IP addresses that dnsmasq will assign out to computers. For this guide, I have set it up to only assign a range from 10.1.1.2 to 10.1.1.10 with a subnet mask of 255.255.255.0, but you will need to change this to suit your own network.
This enables the TFTP server in dnsmasq.
This sets the root path for the TFTP server, in this guide I have used /tftpboot but you are free to choose your own, or use the default of /var/lib/tftpboot.
This line sets the file, server name, and ip address for network boot clients to boot from.
So all together, you get :
After you save this file, you will need to start up dnsmasq again, as we stopped it earlier.
/etc/init.d/dnsmasq start will start it up, and you should get something like :
In /tftpboot/pxelinux.cfg/ we need to create a file called default.
This default file will be the file that all computers will read to get the menu options etc.
In there, we should have the following :
MENU TITLE PXE Boot
MENU LABEL Memtest86+ 4.10
With these 3 files setup, you should be setup to boot from the network.
I got my other virtual PC to boot from the network and I get :
In Part 3, I will add some more functions to your new pxe netboot server 🙂
Some further reading:
Syslinux menu config file documenation