Mucho credit goes to Nick 'Franga' Fratangelo - colleague and Unix guru, for most of the research and experimentation on developing and tweaking the PXE system..
Prerequisites
- A working DHCP Server - the DHCP service must be installed and working
- A working PXE Server - the PXE service must be installed and working
As promised in the PXE Installation, the following includes a number of tweaks to the PXE system that Nick and I have implemented.
1. PXE Floppy - lmhosts & autoexec.net
The addition of an
lmhosts file to
A:\etc allows for the resolution of hostnames to IP Addresses (see
DNS). It's just a plain text file with a list of ip to hostname mappings, thus..
192.168.0.101 router1
192.168.0.100 andybox
One of the things about Bart's Network Boot Disk (hereto referred to as the NBDisk), which our PXE system is based on, is that it doesn't allow for the mapping of drives using IP Addresses in the NET USE command. So to map drives, insert an entry in the
lmhosts file to resolve the file server's hostname to its IP Address. That way mappings can be performed using the UNC path thus..
NET USE X: \\HOSTNAME\SHARENAME
Chucking an
autoexec.net file into
A:\etc allows for commands to be run batch file fashion, at the end of the PXE boot process. This clear text file is just an extension of the more usual
autoexec.bat and if present, it will be parsed by the system. Examples of its use include automatically mapping drives or Ghosting a hard disk.
Once the above modifications have been performed it will be necessary to replace the erstwhile
.img file on the PXE Server with a new one, encompassing these changes. Insert the modified Network Boot Disk into the server and run the
dd command again..
dd if=/dev/fd0 of=/tftpboot/pxelinux/images/booter.img
The PXE Server will now deliver the new features of the modified disk.
2. Create a Boot Profile on the Network Boot Disk
Keen observers will also note the presence of an
A:\etc\profile in the above screenshot. The main issue with Bart's Network Boot Disk is that by default, it keeps pausing to prompt the user about which settings to use and the username/password prompt window doesn't timeout. This may not be a problem and in fact, may be desirable in instances where varying configurations are required.
However our PXE setup was designed mainly for automatically ghosting a workstation's hard disk in a training environment, with varying levels of user skills.
To automate the process with a specific configuration and no pauses, we needed to create a profile on the disk, before using it on the PXE Server..
Let the disk boot right through to the
Identification Settings screen, shown below. Insert a username and password (to match a network share perhaps) and tab to
Save..
Choose a profile name..
In the
Save Profile dialogue box, set Network Detection to AUTO (use spacebar), then X to skip the two dialogues and save the password (remember it will be embedded into a floppy disk image, so it's pretty safe) and set the Dialogue Timeout to 0 seconds..
Finally save the information on the floppy..
Following this the disk chucks you back into a second Identification Settings dialogue, however just insert the username/password and select OK this time. The settings are still saved for speedy subsequent boots. The dialogues will whizz by next time around.
Further configuration is possible by directly editing the newly-created profile file,
A:\etc\profile\*.pro..
Once the above modification has been performed it will be necessary to replace the erstwhile
.img file on the PXE Server with a new one, encompassing these changes. Insert the modified Network Boot Disk into the server and run the
dd command again..
dd if=/dev/fd0 of=/tftpboot/pxelinux/images/booter.img
The PXE Server will now deliver the new features of the modified disk.
3. Speed up the config.sys menu
Edit
a:\config.sys and set the desired
menudefault to AUTO and the timeout to 0. The system will no longer pause at this menu screen..
[menu]
menuitem=AUTO, Boot with emm386 (most compatible)
menuitem=MAX, Boot with emm386 (max memory)
menuitem=NOEMM, Boot without emm386
menuitem=CLEAN, Clean boot
menudefault=AUTO,0
Once the above modification has been performed it will be necessary to replace the erstwhile
.img file on the PXE Server with a new one, encompassing these changes. Insert the modified Network Boot Disk into the server and run the
dd command again..
dd if=/dev/fd0 of=/tftpboot/pxelinux/images/booter.img
The PXE Server will now deliver the new features of the modified disk.
4. Get rid of that "Starting Windows 98.." banner
Although the NBDisk is based on a Windows 98 boot disk, in the spirit of coolness you probably don't want to advertise this fact nor be constantly reminded of it. This mod is gonna require the modification of a non-text file, using a hex-editor. Make sure the floppy disk is backed up to a copy before starting.
I like to use a hex editor called XVI32 - Google it and download the file
hexEditXVI32.exe (466K) or its updated equivalent.
After extracting the archive to an appropriate directory, run
XVI32.exe and insert the NBDisk. Open the file
A:\io.sys and perform a search (CTL F) for the string "
Starting".
Edit that classic
Starting Windows 98.. string by directly replacing those letters with something less embarrassing. Remember with a text hexedit, you can only replace a single character with another, you cannot add or remove extra characters or spaces, otherwise the file will get screwed..
I found that the much bolder, COMMENCING PXE BOOT directly replaces the standard naff message, character for character. Save and exit after finishing.
Once the above modification has been performed it will be necessary to replace the erstwhile
.img file on the PXE Server with a new one, encompassing these changes. Insert the modified Network Boot Disk into the server and run the
dd command again..
dd if=/dev/fd0 of=/tftpboot/pxelinux/images/booter.img
The PXE Server will now deliver the new features of the modified disk.
5. Speed up frequent floppy image creation
I like to create what I call 'mini-scripts' for managing common tasks. I put them in the
/bin directory which is in the system path, meaning they can be run from within any directory. Here's a little script called
pxeflop for managing the creation of new or replacement
.img files from the NBDisk..
vi /bin/pxeflop
Edit the file with the following text..
dd if=/dev/fd0 of=/tftpboot/pxelinux/images/$1.img
ls -la /tftpboot/pxelinux/images
As usual, don't forget to make the file executable afterwards..
chmod 755 /bin/pxeflop
The
$1 is an input variable which takes its input from what the user types after the
pxeflop command itself. Thus the
pxeflop command is invoked, followed by the desired name to give to the
.img file. So running the command..
pxeflop andy
..would create an image file called
andy.img in the usual
/tftpboot/pxelinux/images/ directory..
[root] $ pxeflop andy
2880+0 records in
2880+0 records out
1474560 bytes transferred in 48.554019 secs (30369 bytes/sec)
total 4372
drwxr-xr-x 2 root wheel 512 Jun 25 12:54 .
drwxr-xr-x 5 root wheel 512 Jun 23 17:43 ..
-rw-r--r-- 1 root wheel 1474560 Jun 25 12:55 andy.img
-rw-r--r-- 1 root wheel 1474560 Jun 23 19:33 ghost.img
-rw-r--r-- 1 root wheel 1474560 Jun 24 14:01 netboot.img
[root] $
PXE Boot..
- A&N.