PXEboot: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
Brian Wilson (talk | contribs)
Line 48: Line 48:
so that I have control over what happens when a given machine connects.
so that I have control over what happens when a given machine connects.
The critical lines to add to dhcpd.conf are
The critical lines to add to dhcpd.conf are
# PXE-specific configuration directives...
  next-server 192.168.123.130; # that's this server or could be elsewhere...
  filename "/pxelinux.0";


  host ''clientname'' {
  host ''clientname'' {
   hardware ethernet ''mac-address'';
   hardware ethernet ''mac-address'';
   fixed-address ''ip address of your choosing'';
   fixed-address ''ip address of your choosing'';
   filename "pxelinux.0";
 
  # Uncomment next two lines to boot from network.
  next-server 192.168.123.130; # Ip address of TFTP server
   filename "pxelinux.0"; # name of file to load from TFTP server
  }
  }



Revision as of 17:31, 24 June 2006

I set up my Via EPIA 800 to run Debian using this method. I use it to configure servers at remote locations with just a little bit of help from local people. ("...Now push the reset button. Thanks.")


Network cards

Recent PC's (especially with the network interface on the motherboard) support PXEboot right out of the box. Most computers I work with are not 'recent;. Unfortunately most of the ethernet cards that I own don't have support for PXEboot, either. I bought a lot of 5 Intel EtherPro 100 cards from Ebay for $15 including shipping. Check http://www.candelatech.com/ for more information on what ethernet card you should be using.

BIOS Setup

Some systems have only a boot option called "LAN" or "Network". One of my systems (Intel SE440 BX2) probes for the boot rom on any network cards and they show up as options like "UNDI slot 0"

Put the appropriate boot option at the top of the list so that PXEboot takes precendence over the hard drive and CDROM drive.

Put a separate setting for each client system into dhcpd.conf. Enable PXEboot in DHCP for the client when you need it to boot from PXE and disable when you need to boot from hard drive or CDROM. When the system comes up, it will try PXEboot and then continue on. This makes booting take a few second longer, but gives you the option to get it to boot even when it is headless or remotely located.

Using PXEboot with Debian

  1. Client requests network information from BOOTP / DHCP server
  2. Client requests a file containing boot code via tftp
  3. The file instructs the client what to do next; load a file pxelinux.cfg/* where * is either a piece of its MAC address or 'default' (which is what I use)
  4. 'default' gives you boot menu stuff; you have to select something or hit Enter
  5. The kernel loads and the Debian installer starts up.

Notes on working with PXEboot.

'PXEboot' is what you get when you enable 'Network' or 'LAN' as the boot option in ya PC's BIOS settings.

I use it for two things. (1) To install Linux on systems that can't boot from a CDROM (2) and as a rescue system. Most of this page deals with (2).

Setting up the Debian boot server

Install these packages

dhcp server: dhcp3-server

tftp server: tftpd
tftpd runs from inetd, so configure it in /etc/inetd.conf

tftp client: tftp-hpa useful for testing the server

Configuration

Generally I put a configuration for each machine into /etc/dhcp3/dhcpd.conf so that I have control over what happens when a given machine connects. The critical lines to add to dhcpd.conf are

host clientname {
  hardware ethernet mac-address;
  fixed-address ip address of your choosing;
  # Uncomment next two lines to boot from network.
  next-server 192.168.123.130; # Ip address of TFTP server
  filename "pxelinux.0"; # name of file to load from TFTP server
}

This tells the client what file to grab via tftp. The files for tftp should be installed in /var/lib/tftpboot (see comment above on symlinks)

Linux installer

Many Linux distributions (including Redhat, Debian, Trustix, Ubuntu, and SuSe) have network install support. You just have to poke around to find the files.

For example, to install Debian on the client, you poke around in the Debian FTP archives until you find netboot.tgz. Download it and unpack it in your /var/lib/tftpboot directory. Then make symlinks from /var/lib/tftpboot/pxelinux.0 and pxelinux.cfg to the real ones lurk in the debian_installer tree. That's it.

When you boot a client, it will get an IP address from the DHCP server and find the other TFTP settings. Then it will use those settings to download the pxelinux.0 file and run it. That file will tell the client to get and load a boot loader which in turn will load and start Linux on the client.

Booting the client

Set the client to boot from LAN or Network. Then boot it. If you are near the client and can look at the console,

  • you should see the "UNDI" boot stuff. Notably you should see the client get the IP address that you set up for it in dhcpd.conf.
  • next you should see it connect to the tftp server. It will show a series lines as it tries to find a pxelinux.cfg file; it will uses its MAC address piece by piece and then give up and load pxelinux.cfg/default
  • if the pxelinux.cfg loads then it should fire up the installer and from then on, the screens are what you'd see if you booted from a cdrom.

System Rescue mode

But wait! I want to do a remote bare metal rescue mode! Currently I have to instruct someone to push the "magic cd" into the computer and reboot it. This taxes everyone's patience because later I have to call them and ask them to remove it and stand by to see if the system will reboot correctly. The "magic cd" is a customized version of SystemRescueCD with ssh enabled on it and a root password of my choosing stored in it.

The SystemRescueCD project has died by the way. So it's only a matter of time until we cannot use the magic disk anymore. Look at FrozenTech for alternatives.

Olive looks like fun.

I want PXEboot into the SystemRescue tool kit and I want the result to have a serial console. I use a serial console. This is set up already. I just want to ask someone to push the reset button (or automate that too someday) and have the system come up. In theory I can just ssh in once the system pxeboots; I know it has a functional network card if it pxebooted, right? But I want it anyway. I am not guaranteed that the operating system will be able to find the network card after the kernel loads, now am I?

Then I can control whether it boots from network or not by modifying my dhcp server settings. If I uncomment the 'file' line it netboots, otherwise it boots from its own hard drive. If this works well enough I might quit having anything boot from a hard drive ever again! :-)

So how about a Debian diskless/NFS installation?

http://homex.subnet.at/~max/diskless/index.php

Make the server do NFS. Apply appropriate security measures, I choose to use the nfs-kernel-server package.

I intend to work with the 2.6.8-3 kernel since that's what I get in the current Debian stable release for a 2.6 kernel. I have a VMware machine running with it for development and test purposes.

The initrd image has to have the nfs pieces added to it so it can mount root via nfs.

nfs
lockd
sunrpc
af_packet

Be sure to check nfsboot.txt in /usr/src/linux/Documentation.

See "Rescue is possible" PXEboot version http://www.tux.org/pub/people/kent-robotti/looplinux/rip/

More information

General information on PXEboot for Linux

Remote Network Boot via PXE

Installing Debian via PXE

Related systems

LinBox is a complete system for backup and bare metal restores of systems

Damn Small Linux is based on Knoppix and can be upgraded to Debian

[RIP] aka "Recovery Is Possible" is based on Slackware. There are CD and PXE versions. It uses the latest kernel.