Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Network (PXE) Booting Guide/Discussion
New Posts  All Forums:Forum Nav:

Network (PXE) Booting Guide/Discussion

post #1 of 3
Thread Starter 
Network (PXE) Booting Guide/Discussion -- Draft

This thread came out of a tangent from a conversation I was having with Plan9. I hope someone finds this helpful.

What is PXE booting? Basically it's your PCs ability to look at the network card ("NIC" hereafter) as a "boot device" the same way your PC's startup procedure would look to a CD, USB thumb drive drive a internal hard drive.

What can this be used for?

The same thing you might have a stack of CDs/thumb drives only instead it's conveniently located on the desktop. For instance perhaps you have a multitude of PCs you may want to run memtest86+ on, wipe the hard drive with dban, or check for hard drive faults with spinrite. It is easy to set up those examples to instantly boot into without digging around for the CD or thumb drive. You can also boot into pre-execution environments such as Bart's PE, or the Vista-and-later WinPE 2/etc. for installing operating systems.

The initial setup is actually relatively simple: the dhcp server tells your PC where to find a boot sector (pxelinux.0 for one example) which in turn points to a config file. At that point you're dealing with a boot manager not much different from created a custom boot manager for a CD or USB drive: config files, menus, backgrounds and passing parameters to the kernel in the case of linux.

It's more than possible to setup a menu with choices for various Windows installs, various Linux distros/versions installs, and utilities and have it all start installing from one convenient place.

Windows Servers actually have this feature available, just has to be toggled on. I just happened to start practing using Ubuntu server (just easier than setting up a whole domain controller, that was my understanding at the time).

To begin with I'll start with getting a basic setup up and going and booting into memtest86+. I'll be using a physical machine as both the server and the device I'm trying to boot. It's supposed to be possible to do this entirely virtualized (using virtualbox on windows for instance) but since I haven't done that I'll leave that as a "beyond the scope of this thread".

I'll be using the latest version of Ubuntu Server 12.04 -- as of this writing this is 12.04.2
Reasoning for the version (Click to show)
I started learning about pxe booting on 12.04 last november since it was the "LTS" version and I needed to standardize on one linux server version/distro to simplify my not taking for various projects. It's not inferior just because it's a year old and it will hypothetically keep getting updates for another 4 years. These steps should work for any Debian-derived distro as well as the x-windows GUI-version of ubuntu.

Note the below is a rough draft. I was able to test "indirectly" (the config files were re-organized slightly). I will be more thoroughly testing it this week.
An example: memtest86 (Click to show)
Starting from a fresh install of ubuntu server 12.04.2 (assuming you've already run apt-get update and apt-get upgrade) the first thing you may want to do is assign this server a static IP. This can be done with your router (if the PC you're using for this is getting an IP via DHCP) or through the network config file, /etc/network/interfaces. Since it's a bit of a tangent I'll post more details on doing this upon request.

The first two steps are to install a DHCP server -- dnsmasq in the this case -- and a TFTP daemon -- I'm partial to tftpd-hpa -- via the following:
apt-get -y install dnsmasq
apt-get -y install tftpd-hpa

Next is configuring both of these programs:

Configure DNSMasq via /etc/dnsmasq.conf by uncommenting lines (using your favorite editor take out the lead '#' symbol of each line)
The IP addressed will obviously vary depending on your network. This is the IP range I happen to choose.
dhcp-range=192.168.0.50,192.168.0.150,12h
dhcp-boot=pxelinux.0


For tftpd-hpa, just add the following lines to /etc/default/tftpd-hpa:
RUN_DAEMON="yes"
OPTIONS="-l -s /var/lib/tftpboot"


Next you can either reboot the whole machine or restart those two services:
For DNS mask
/etc/init.d/dnsmasq restart

and the tftp daemon:
service tftpd-hpa restart

For setting up the boot sectors and config files there's actually a number of choices (grub/grub4dos for instance) but everybody's fall back/defacto standard (if all the documentation I've found is any indicator) seems to be pxelinux.

pxelinux, and it took my a while to realize this, is actually just a directory structure, some sample configuration files and a boot sector called pxelinux.0 that simply points to the first in what can a long labyrinth of sym-linked config files. Fortunately it's included with the ubuntu "net install" file.

Since we pointed our TFTP daemon at /var/lib/tftpboot, change to that directory (cd /var/lib/tftpboot) and conveniently grab the ubuntu netinstall "tar ball" via wget: (about 22 Megs)
wget http://archive.ubuntu.com/ubuntu/dists/raring/main/installer-i386/current/images/netboot/boot.img.gz

Next, decompress the tarball:
tar -xzvf netboot.tar.gz

Result is...well this would be that labyrinth of sym-linked config files previously mentioned. To conveniently cut to the end of said sea of confusing config files, the config file you edit to actually add the things you want to boot to to it is:
/var/lib/tftpboot/ubuntu-installer/i386/boot-screens/txt.cfg

First we need a few things: the memtest ISO, a directory to store said ISO and a way of extracting said ISO.

We'll need a convenient directory for our new ISO:
mkdir /var/lib/tftpboot/ISOs
And change to that directory, cd /var/lib/tftpboot/ISOs

Then grab the ISO zip file (I was having trouble extracting the gz version of the archive but the zip works)
wget http://www.memtest.org/download/4.20/memtest86+-4.20.iso.zip

To extract we'll need unzip:
apt-get install unzip

Now it's easy to extract:
unzip memtest86+-4.20.iso.zip
And finally we're left with mt420.iso

Now all we have to do is add this to the
/var/lib/tftpboot/ubuntu-installer/i386/boot-screens/txt.cfg
file.
Quote:
LABEL memtest86+
LINUX memdisk
INITRD memtest/mt420.iso
APPEND iso

I tried for literally months to figure out how to just point pxelinux at the ubuntu server install ISO have it just boot up and work. Never did figure it out. All the documentation out there either refers to ubuntu live CDs or installing ubuntu server via NFS. NFS seems to be the primary way people use network booting to install operating systems.

My goal is to eventually have it setup so I can boot one or more PCs on my network, select which operating system or utility I want to install or run and just have it start installing. I'm still working on the delivery method so this is still a goal right now along with a local HTTP installation source (so I don't have to download all the updates from the internet over and over again) and kickstart/preseed files for no-interaction required Linux installs.
Edited by subassy - 6/6/13 at 3:24pm
 
VM Server
(17 items)
 
 
CPUGraphicsRAMHard Drive
Intel Ivy Bridge Core i7-3630QM nVidia GeForce GTX 680M 16GB DDR3 1600MHz Dual Channel Memory (2 SODIMMS) Hard Drive: Serial-ATA II 3GB/s 
Hard DriveOSMonitorPower
Hard Drive: Serial-ATA II 3GB/s Windows 10 Pro x64 17.3" FHD 16:9 (1920x1080) Battery: Smart Li-ion Battery (8-Cell) 
Audio
Sound Blaster Compatible 3D Audio 
CPUMotherboardGraphicsRAM
Intel Core i7 860 Biostar T5 XE Radeon HD 5870 Corsair 16GB  
Hard DriveHard DriveOptical DriveOS
Western Digital hard drive wd1001fals-00e8b0 Maxtor 300GB I don't need no stinking optical drive Microsoft Windows 7 Ultimate x64 
MonitorMonitorKeyboardPower
HP ZR24w 24'' Samsung SyncMaster 24" logitech wireless k360 Seventeam ST-850ZAF 850W ATX 
CaseMouseAudioAudio
Thermaltake V9 Black Edition Logitech G500 Programmable Gaming Mouse FiiO E7 USB DAC and Portable Headphone Amplifier Sennheiser HD555 Professional Headphones 
  hide details  
Reply
 
VM Server
(17 items)
 
 
CPUGraphicsRAMHard Drive
Intel Ivy Bridge Core i7-3630QM nVidia GeForce GTX 680M 16GB DDR3 1600MHz Dual Channel Memory (2 SODIMMS) Hard Drive: Serial-ATA II 3GB/s 
Hard DriveOSMonitorPower
Hard Drive: Serial-ATA II 3GB/s Windows 10 Pro x64 17.3" FHD 16:9 (1920x1080) Battery: Smart Li-ion Battery (8-Cell) 
Audio
Sound Blaster Compatible 3D Audio 
CPUMotherboardGraphicsRAM
Intel Core i7 860 Biostar T5 XE Radeon HD 5870 Corsair 16GB  
Hard DriveHard DriveOptical DriveOS
Western Digital hard drive wd1001fals-00e8b0 Maxtor 300GB I don't need no stinking optical drive Microsoft Windows 7 Ultimate x64 
MonitorMonitorKeyboardPower
HP ZR24w 24'' Samsung SyncMaster 24" logitech wireless k360 Seventeam ST-850ZAF 850W ATX 
CaseMouseAudioAudio
Thermaltake V9 Black Edition Logitech G500 Programmable Gaming Mouse FiiO E7 USB DAC and Portable Headphone Amplifier Sennheiser HD555 Professional Headphones 
  hide details  
Reply
post #2 of 3
Thread Starter 
Reserved
 
VM Server
(17 items)
 
 
CPUGraphicsRAMHard Drive
Intel Ivy Bridge Core i7-3630QM nVidia GeForce GTX 680M 16GB DDR3 1600MHz Dual Channel Memory (2 SODIMMS) Hard Drive: Serial-ATA II 3GB/s 
Hard DriveOSMonitorPower
Hard Drive: Serial-ATA II 3GB/s Windows 10 Pro x64 17.3" FHD 16:9 (1920x1080) Battery: Smart Li-ion Battery (8-Cell) 
Audio
Sound Blaster Compatible 3D Audio 
CPUMotherboardGraphicsRAM
Intel Core i7 860 Biostar T5 XE Radeon HD 5870 Corsair 16GB  
Hard DriveHard DriveOptical DriveOS
Western Digital hard drive wd1001fals-00e8b0 Maxtor 300GB I don't need no stinking optical drive Microsoft Windows 7 Ultimate x64 
MonitorMonitorKeyboardPower
HP ZR24w 24'' Samsung SyncMaster 24" logitech wireless k360 Seventeam ST-850ZAF 850W ATX 
CaseMouseAudioAudio
Thermaltake V9 Black Edition Logitech G500 Programmable Gaming Mouse FiiO E7 USB DAC and Portable Headphone Amplifier Sennheiser HD555 Professional Headphones 
  hide details  
Reply
 
VM Server
(17 items)
 
 
CPUGraphicsRAMHard Drive
Intel Ivy Bridge Core i7-3630QM nVidia GeForce GTX 680M 16GB DDR3 1600MHz Dual Channel Memory (2 SODIMMS) Hard Drive: Serial-ATA II 3GB/s 
Hard DriveOSMonitorPower
Hard Drive: Serial-ATA II 3GB/s Windows 10 Pro x64 17.3" FHD 16:9 (1920x1080) Battery: Smart Li-ion Battery (8-Cell) 
Audio
Sound Blaster Compatible 3D Audio 
CPUMotherboardGraphicsRAM
Intel Core i7 860 Biostar T5 XE Radeon HD 5870 Corsair 16GB  
Hard DriveHard DriveOptical DriveOS
Western Digital hard drive wd1001fals-00e8b0 Maxtor 300GB I don't need no stinking optical drive Microsoft Windows 7 Ultimate x64 
MonitorMonitorKeyboardPower
HP ZR24w 24'' Samsung SyncMaster 24" logitech wireless k360 Seventeam ST-850ZAF 850W ATX 
CaseMouseAudioAudio
Thermaltake V9 Black Edition Logitech G500 Programmable Gaming Mouse FiiO E7 USB DAC and Portable Headphone Amplifier Sennheiser HD555 Professional Headphones 
  hide details  
Reply
post #3 of 3
Thread Starter 
Reserved
 
VM Server
(17 items)
 
 
CPUGraphicsRAMHard Drive
Intel Ivy Bridge Core i7-3630QM nVidia GeForce GTX 680M 16GB DDR3 1600MHz Dual Channel Memory (2 SODIMMS) Hard Drive: Serial-ATA II 3GB/s 
Hard DriveOSMonitorPower
Hard Drive: Serial-ATA II 3GB/s Windows 10 Pro x64 17.3" FHD 16:9 (1920x1080) Battery: Smart Li-ion Battery (8-Cell) 
Audio
Sound Blaster Compatible 3D Audio 
CPUMotherboardGraphicsRAM
Intel Core i7 860 Biostar T5 XE Radeon HD 5870 Corsair 16GB  
Hard DriveHard DriveOptical DriveOS
Western Digital hard drive wd1001fals-00e8b0 Maxtor 300GB I don't need no stinking optical drive Microsoft Windows 7 Ultimate x64 
MonitorMonitorKeyboardPower
HP ZR24w 24'' Samsung SyncMaster 24" logitech wireless k360 Seventeam ST-850ZAF 850W ATX 
CaseMouseAudioAudio
Thermaltake V9 Black Edition Logitech G500 Programmable Gaming Mouse FiiO E7 USB DAC and Portable Headphone Amplifier Sennheiser HD555 Professional Headphones 
  hide details  
Reply
 
VM Server
(17 items)
 
 
CPUGraphicsRAMHard Drive
Intel Ivy Bridge Core i7-3630QM nVidia GeForce GTX 680M 16GB DDR3 1600MHz Dual Channel Memory (2 SODIMMS) Hard Drive: Serial-ATA II 3GB/s 
Hard DriveOSMonitorPower
Hard Drive: Serial-ATA II 3GB/s Windows 10 Pro x64 17.3" FHD 16:9 (1920x1080) Battery: Smart Li-ion Battery (8-Cell) 
Audio
Sound Blaster Compatible 3D Audio 
CPUMotherboardGraphicsRAM
Intel Core i7 860 Biostar T5 XE Radeon HD 5870 Corsair 16GB  
Hard DriveHard DriveOptical DriveOS
Western Digital hard drive wd1001fals-00e8b0 Maxtor 300GB I don't need no stinking optical drive Microsoft Windows 7 Ultimate x64 
MonitorMonitorKeyboardPower
HP ZR24w 24'' Samsung SyncMaster 24" logitech wireless k360 Seventeam ST-850ZAF 850W ATX 
CaseMouseAudioAudio
Thermaltake V9 Black Edition Logitech G500 Programmable Gaming Mouse FiiO E7 USB DAC and Portable Headphone Amplifier Sennheiser HD555 Professional Headphones 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Operating Systems
Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Network (PXE) Booting Guide/Discussion