So what's the big deal with PXE? It allows you to boot operating system directly from the network with zero-touch configuration on the machine that you want to boot itself. Its quite easy to setup and with this guide you'll be able to set it up within 15 minutes.
What you need:
- dhcp server
- tftp server
- pxelinux distribution
How it works?
- Machine boots up, and its set to PXE network boot
- It issues DHCPDISCOVER and waits for the reply
- DHCP server assigns IP address, tftp server and tftp image path to it
- It configures network stack using provided informations
- Then it download specified boot image from tftp server and fire it up
Easy, huh? Let's go straight ahead to the configuration.
I tried two different dhcp servers for this purpose - IOS and (of course) ISC dhcp server. I have also used static dhcp binding to my MAC address.
IOS DHCP:
ip dhcp pool pool-name
host 192.168.102.20 255.255.255.0
hardware-address aaaa.bbbb.cccc
bootfile pxeboot/pxelinux.0
next-server 192.168.102.10
domain-name domain.name
dns-server 8.8.8.8 8.8.8.4
default-router 192.168.102.1
ISC DHCP: (dhcpd.conf)
allow booting;
allow bootp;
option domain-name "domain.name";
default-lease-time 600;
ddns-update-style none;
authoritative;
log-facility local7;
subnet 192.168.102.0 netmask 255.255.255.0 {
host hostname {
hardware ethernet aa:bb:cc:dd:ee:ff;
fixed-address 192.168.102.20;
filename "pxeboot/pxelinux.0";
next-server 192.168.102.10;
}
}
Setting up IOS dhcp is as simple as entering those commands provided you have IOS device on your network. ISC DHCP may be a little more complicated - you may need to download and configure it from source package but it's a part of probably every single linux distribution. I set it on my macbook using osx ports:
port install dhcp
<edit config file>
launchctl load -F /opt/local/etc/LaunchDaemons/org.macports.dhcpd/org.macports.dhcpd.plist
launchctl start org.macports.dhcpd
Note that if you have any issues with your dhcp.conf it will just silently fail, so it's always a good idea to test it on the very beginning using
/path/to/dhcpd -cf /path/to/dhcpd.conf -d
It will run in foreground and show you what dhcpd is actually doing.
Ok, so far so good. Now its time for tftp!
Again, most linux distributions should include one so you need to refer to your documentation to set it up, on os X its a part of the system, so its just a matter of enabling it:
launchctl start com.apple.tftpd
Now it listens for incoming connections and servers files found under /private/tftpboot directory.
Okay, so our infrastructure is basically ready for PXE applications. You will find required package here: http://www.syslinux.org. You just need to download latest package and thats it. Then it's time to setup tftp files required to netboot your station.
Without going too much into details, this is what I've done and works for me:
./pxeboot/ldlinux.c32
./pxeboot/libcom32.c32
./pxeboot/libutil.c32
./pxeboot/mboot.c32
./pxeboot/memdisk
./pxeboot/menu.c32
./pxeboot/pxelinux.0
./pxeboot/pxelinux.cfg
./pxeboot/pxelinux.cfg/default
./pxeboot/VMware
./pxeboot/VMware/VMware-VMvisor-Installer-5.5.0.update02-2068190.x86_64.iso
First and most important file is pxelinux.0. Like all of the files in /pxeboot directory, it was copied out from syslinux distribution package. It is boot loader for your host. Then you need to create pxelinux.cfg directory and put config file for your host inside it. If you boot a host from PXE it will look for its configuration file at this directory (details). I want universal configuration, so I just put my config into "default" filename, so it can be eventually loaded by all PXE-enabled hosts.
This is the content of this file:
DEFAULT menu.c32
MENU TITLE PXE Boot Menu
NOHALT 1
PROMPT 0
TIMEOUT 80
LABEL hddboot
LOCALBOOT 0x80
MENU LABEL ^Boot from local disk
LABEL install
KERNEL memdisk
APPEND iso initrd=VMware/VMware-VMvisor-Installer-5.5.0.update02-2068190.x86_64.iso raw
MENU LABEL ^ESXi-5.5U2 Install ISO
Again, this is still quite simple if you have any linux boot loader (grub, lilo) background. There are two options specified - local boot and VMware ESXi installer-iso boot.
And this is it! All you need to make sure now is to copy all required files into required places and it's done. Set up your test box for PXE booting and enjoy all new possibilities. I just booted & installed vmware on my WhiteBox using this setup.
No comments:
Post a Comment