Setting up a server for Linux and Windows PXE network booting on CentOS / RHEL

Intro

PXE itself stands for “Pre-boot eXecution Environment”, which describes how it works in the sense that the clients using it haven’t booted in a traditional manner.

In order to use PXE you need to setup a boot-server which will allow client systems to :

  • Request an IP address (via DHCP)
  • Download a kernel (via TFTP)

With both of these services in place any system which supports PXE/network-booting (you might need to enable it in the BIOS) should be able to gain an IP address, fetch a kernel, and boot without an installed operating system.

In short

In order to accomplish a Linux + Windows PXE environment we need the following;

  • A DCHP and TFTP server (either on Linux or Windows). This guide describes how to use DCHP on Linux or a DD-WRT based router for DCHP and TFTP on Linux.
  • To boot Linux;
    • Configuring PXE TFTP requirements using pxeos (part of RHEL based distribution).
    • Optionally; setup a local mirror for your Linux distribution (see my post “Setup local CentOS mirror” on how to do this). You can just as well use an existing remote mirror, but local of course would be faster.
  • To boot Windows;
    • Configuring PXE TFTP requirements using Unattended (this also gives you a little extra of being able to setup Windows unattended really easy).
    • Installing & configuring SMB for storing the Windows setup files.

This guide assumes a CentOS 5 i386 installation as the PXE server. You probably would be able to do the same on any other distro using some modifications.

TFTP

Install

yum install tftp-server

Installed: tftp-server.i386 0:0.42-3.1.el5.centos

Configure

Edit /etc/xinetd.d/tftp.

Change

disable                 = yes

into

disable                 =

Restart xinetd:

service xinetd restart

Check if tftp is running: netstat -an | fgrep -w 69

Run this to configure the TFTP server and download the necessary files. 

pxeos -a -i “CentOS 5 i386” -p HTTP -D 0 -s archive.cs.uu.nl -L /mirror/Linux/centos/5/os/i386/ centos-5-i386

For some reason pxeos (system-config-netboot) is not included in CentOS 5. You can get the 4 RPM, it works fine;

wget http://archive.cs.uu.nl/mirror/Linux/centos/4/os/i386/CentOS/RPMS/system-config-netboot-0.1.40-1_EL4.i386.rpm

rpm -i system-config-netboot-0.1.40-1_EL4.i386.rpm

pxeos -a -i “CentOS 5 i386” -p HTTP -D 0 -s ftp.belnet.be -L /mirror/ftp.centos.org/5/os/i386/ centos-5-i386

pxeos -a -i “CentOS 5 x86_64” -p HTTP -D 0 -s ftp.belnet.be -L /mirror/ftp.centos.org/5/os/x86_64/ centos-5-x86_64

pxeos -a -i “CentOS 4 i386” -p HTTP -D 0 -s ftp.belnet.be -L /mirror/ftp.centos.org/4/os/i386/ centos-4-i386

pxeos -a -i “CentOS 4 x86_64” -p HTTP -D 0 -s ftp.belnet.be -L /mirror/ftp.centos.org/4/os/x86_64/ centos-4-x86_64

pxeos -a -i “Fedora 8 i386” -p HTTP -D 0 -s ftp.belnet.be -L /mirror/download.fedora.redhat.com/linux/releases/8/Fedora/i386/os/ fedora-8-i386

pxeos -a -i “Fedora 8 x86_64” -p HTTP -D 0 -s ftp.belnet.be -L /mirror/download.fedora.redhat.com/linux/releases/8/Fedora/x86_64/os/ fedora-8-x86_64

 

DHCP

If you own a Router which can handle the dd-wrt firmware you don’t have to disable the dhcp service in the router. Just open the ‘Administration’->’Services’ tab and enable ‘DNSMasq’ and in the ‘Additional DNS Options’ input field enter ‘dhcp-boot=pxelinux.0,tfptd-hostnameмебели,tftpd-ip‘. Replace tfptd-hostname with the hostname of your tftpd machine and tftpd-ip with the ip-address of you tfptd. Thats all.

 

References

http://www.fedora-linux.nl/wiki/index.php/Netwerk_installatie_met_kickstart_en_PXE

http://www.google.com/translate?u=http%3A%2F%2Fwww.gentilkiwi.com%2Fdocumentations-s11-t-pxe.htm&langpair=fr%7Cen&hl=nl&ie=UTF8

http://syslinux.zytor.com/index.php

RSYNC rsync.belnet.be::
HTTP http://ftp.belnet.be