Posts Tagged ‘Network Boot’

Boot Ghost via PXE/LAN

Tuesday, August 8th, 2006

Anyone with a large number of Windows hosts (or a small number of hosts and a small number of incompetent users) in their network should be familiar with Norton Ghost. If you are like me, and use Ghost anywhere from 3-6 times in a single day, breaking out floppy disks or CD-ROMs every time a box needs to be imaged can be tedious. This article describes how to create a network bootable Ghost environment. 

Norton Ghost is a product that I have had a love/hate relationship with ever since I began using the corporate edition of Ghost 8.0. It handles the imaging and restoration of Windows based PCs and servers perfectly, whilst the Linux support leaves entirely too much to be desired. Other commercial products such as Acronis TrueImage handle Linux much better from what I’ve seen, but is also prone to destroying the occasional boot loader or two (or all?).

If you’ve never used Norton Ghost, here is a little background on the process involved. First you configure a PC or Server to be your “master client”, then you use Ghost (I always used GhostCast) to create an “Image” of the hard drive (or drives) that system is based on. What this does for you is allows you to quickly restore to a consistent baseline without having to re-install Windows, download patches, re-secure everything, and et cetera. In essence, it saves a huge amount of time.

At my current place of employment we spin-up maybe 10 boxes in a single day, which means that we had to swap sets of ghost floppies (or CD-ROMs) each time we did this, and although it was not that big of a deal, occasionally having bad media at a critical point in a system rebuild is entirely unacceptable. This is where PXE comes in.

PXE, or Pre-eXcution Environment, (assuming you have a NIC created before 2001) allows your server or workstation to boot without any disk media what so ever, and you can boot just about anything you can imagine via PXE. Here is a brief synopsis of how PXE interacts with your system and network as a whole.

The workstation boots, if PXE is selected as a boot option the workstation attempts to obtain an IP address from a DHCP or BOOTP server on your network. If the server does obtain a DHCP or BOOTP IP address, it will then look for a certain flag that your DHCP server sends out saying “I want you to boot from this image”. The workstation then looks for another DHCP flag which tells it where to find the image in question, the workstation downloads the image, and attempts (you hope) to execute it.

I am a big proponent of open source technology, I wanted to use as many open source tools as I could to complete this project. The software that I used for this particular project is: ISC DHCP 3, pxelinux, Peter Anvin’s TFTPd-hpa, there are multiple open source TFTP daemons available, but this is the best one I could find. I must admit I did steer away from open source for one component of this project, as I used WinImage to create the single image from both of the Ghost boot floppies.

I installed all of these daemons on Centos 4.2, I ran Winimage on a Windows 2003 Server, and I also used the same Windows Server to create my Ghost media. I like CentOS because of the long support cycles for patches, the fact that it works 100X better than Fedora, and the fact that it had all of the daemons I needed compiled as RPMs.

You will need:
A Linux Server (Redhat, Fedora, Debian, CentOs, Enter favorite distribution here)
ISC DHCP 3.0
Syslinux (if you have linux, you likely have this already)
tftp-hpa
WinImage or another tool to create bootable images.
A Windows PC or Server from which to generate your boot image.
An old crappy workstation to test everything on.

Since I used CentOs 4.2 to construct my setup, I will assume everyone is using CentOS 4.2, and give commands related to that particular distribution; however the configuration files for all of the server related items mentioned should be distribution independant.

First lets install the daemons we need.

yum install dhcp
yum install tftp-server
yum install syslinux

You may or may not notice that by installing tftp-server a directory named tftpboot was placed in your root. This directory is where we will be storing most of our pertinent PXE files. Now we will finish setting up your PXE server.

cp /usr/lib/syslinux/pxelinux.0 /tftpboot
mkdir pxelinux.cfg

This moves the PXE loader to the appropriate location, and creates the configuration directory. We will come back to the PXE configuration later. Now we must configure ISC DHCP. DHCPD’s configuration file is /etc/dhcpd.conf on CentOS 4.2 and other Redhat Derivitives.

Here is an example /etc/dhcpd.conf

authoritative;
allow booting;
ddns-update-style none;
next-server 10.1.5.1;
default-lease-time -1;
filename “pxelinux.0″;
subnet 10.1.5.0 netmask 255.255.255.0 {
range 10.1.5.128 10.1.5.254;
}

Caution: You do NOT want to install ISC DHCP on a server that is in a network already running another DHCP server, funky results will occur.

The last thing to do (for now) is to ensure that tftpd, and DHCPd will start at boot time. You can achieve this a number of ways. I just use the command ntsysv which is included with all RedHat Derivitive distributions of Linux.

NOTE: I will assume you are using MS-DOS bootable media, and not PC-DOS, FreeDOS or any other kind of DOS.

Now onto WinImage; our specific example of Norton Ghost 8.0 creates either 2 1.44MB floppy disks, or a CD-ROM ISO for you to boot off of. Create a folder on your Windows machine called “Ghost” or whatever else you prefer, and copy the contents of both floppy disks into this folder. You need to edit the AUTOEXEC.BAT file in your “Ghost” folder. It should look like this:

@echo off
SET TZ=GHO+05:00
prompt $p$g
\net\netbind.com
MOUSE.COM
cd \ghost
GHOST.EXE -RB -SURE -QUIET
goto END
:END

I will note that you may want to modify your GHOST.EXE command-line as mine is set to automatically reboot, and not bother me about every little detail in the GhostCast Client.

NOTE: In order to do the next step, WinImage must be running in professional mode.

At this point you should have a Ghost folder which is roughly 1.7MB in size. Load up WinImage and tell it to create a 2.88MB floppy image. Insert the contents of the “Ghost” folder into this image and click on Image > Boot Sector Properties; Click on Windows 95/98 to ensure that this image is bootable. Save the image as whatever you prefer to call it, and exit WinImage. Copy the newly created image into the /tftpboot folder on your PXE server.

Now we must create a pxelinux configuration file. For now, we will just setup a default configuration file (which means that every DHCP client will recieve the same image from pxelinux).

cd /tftpboot/pxelinux.cfg

Create a file called default, mine looks like this:

label Ghost
kernel memdisk
append initrd=ghost.img

I am assuming that you have created a file called ghost.img in your /tftpboot folder, you will also need to copy the memdisk binary. Memdisk is software that allows you to boot just about any sort of disk image (as long as it is valid, and bootable).

cp /usr/lib/syslinux/memdisk /tftpboot

Ensure that dhcpd and tftp-server are running on your server machine.

service restart dhcpd

Note: Generally TFTP daemons run under inetd, or xinetd; so you will need to make sure that those helper daemons are allowing tftpd to run on your server. The configuration file for inetd is /etc/inetd.conf, and the configuration directory for xinetd is generally /etc/xinetd.d I wont spend too much time worrying about the configuration of inetd.conf, as most modern linux systems use xinetd.

The xinetd.d folder holds multiple configuration files; all of which you can enable or disable services with. You may need to edit /etc/xinetd.d/tftp to look something like this:

service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot -r blksize

Now comes the fun part, testing this bad boy out. Get that old Pentium 3 1GHz out of your garage, and set it up for network booting. Then Fire it up, if Norton Ghost’s DOS client or whatever else you want to network boot pops up on your screen you’ve done it. If not, post in the forums, and we’ll get you straightened out.

Enjoy your Network Booting Ghost machine!