Asterisk PXE Boot Edition

Asterisk - PXE boot Edition

I recently received an email asking about a network boot version of my Asterisk Live! CD/CF card. Within about 30 minutes of reading it I had a box booting and running using PXE, so as always here it is.

If you find any of the Editions I've produced useful then how about taking a look at my wishlist and either donating towards an item or even buying me something off it :D

What you need to get it running

A DHCP server
A TFTP server with the pxelinux boot image (image included in tarball)
A PXE bootable PC


If you are using MS Windows and/or want a quick start then I can heartily recommend haneWIN DHCP Server which has a dhcp server and tftp server all wrapped in a simple and easy interface.


Download the following file:

asterisk-live-pxe-main-build-1.tar.gz Thanks again to Stropharia


and extract the content to your tftproot directory. This file contains everything you need (other that the dhcp/tftp server) to get you running.

Things to remember:

1. CHANGE the password! The default username is root and the default password is EPPING (all caps) CHANGE IT!! .
2. It is NOT recommended that you try to PXE boot over the Internet. Aside form the potential slowness of boot when doing this there are security implications too.
3. This version is built using asterisk/zaptel/libpri 1.0.7 - The CF/CD use an earlier version, I will be updating those as I get the time
4. You will need to modify the image, if only to add your config files/trigger remote update/change the password etc...
5. You can have different boot files (kernel and main image) for each machine, simply create a boot config file in pxelinux.cfg/ with 01- - where is the target machine's MAC address in LOWER CASE. If you want to see what pxelinux looks for simply rename or move pxelinux.cfg/default to say, xxxx - On boot pxelinux with report on the booting machine the search order of files...


Modifying the ramdisk image

You will want to modify the ramdisk image. In its present state the machine should boot and give you a login prompt, you can then login and start sshd, asterisk etc. In a live environment you are going to want this all to take place automatically.

#Unzip the image, somewhere eg /tmp/ramdisk
gunzip asterisk-live-pxe-v1.img.gz
#should leave you with asterisk-live-pxe-v1.img.gz
#Create a dir at /mnt/ramdisk
mkdir /mnt/ramdisk
#then mount it
mount /tmp/ramdisk/asterisk-live-pxe-v1.img /mnt/ramdisk/ -t ext2 -o loop

/mnt/ramdisk will contain the content of the image, you can modify this as you see fit. Remember to unmount it when you are done

#unmount it
umount /mnt/ramdisk

You should then zip up the image file. This is not a mandatory step, but it makes sense to compress the image as much as possible since it's going to be copied to the booting machine over the network.
#zip the image
gzip -c -9 asterisk-live-pxe-v1.img > asterisk-live-pxe-v1.img.gz

Copy this file to your tftproot directory and do a test boot.

Hints:

Take a look at /etc/remoteconfig for grabbing configs/updates from a remote http server and /etc/updateconfigs for usb based reading. If you want to use the usb reading modify /etc/sysinit and remove the comment maker, #, from the lines:

#/etc/load_usb >&/dev/null
#/etc/updateconfigs
to give

/etc/load_usb >&/dev/null
/etc/updateconfigs


Enjoy...