Network Install via PXE and TFTP on RHEL6 (X86_64)
This is a step by step on how I deployed Red Hat Enterprise Linux 6 via PXE and HTTP leveraging exclusively RHEL6.1, my focus will be on the PXE/TFTP-DHCP part as the HTTP based installation is well documented by Red Hat. In terms of hardware I had available 2 DELL Precision 5400 (2 NICs per machine), and an HP Procurve 2824 Switch (yes overkill).
Deployment server setup
The server from which the other machines will be able to install RHEL6 is initially a default RHEL6.1 installation connected to the Red Hat Network. If you're not able to have a machine base RHEL6 install at this point this post is not for you, as I'd recommend to go with a basic install from disk which is well documented by Red Hat.
Outside of booting on the PXE NIC everything that needs to be installed/configured/started happens on this machine. To make my life easier I deactivated SElinux and the firewall as I was testing in a closed environment (i.e. private network with no outside access), those 2 will definitively make all sorts of trouble if they're not configured properly to allow the required traffic and services communications.
$>echo 0 >/selinux/enforce #to disable selinux $>system-config-firewall-tui# to config/disable firewall
Let the fun begin
1)Install and start DHCP
$>yum install dhcp $>service start dhcp $>chkconfig dhcpd on #Starts at boot
2)Configure DHCP for PXE/TFTP
$>cat /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# see 'man 5 dhcpd.conf'
#
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.150;
}
#This part came right out of Red Hat Installation guide
allow booting;
allow bootp;
class "pxeclients" {
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
next-server 192.168.1.1; # REPLACE WITH THE TFTP SERVER IP
filename "linux-install/pxelinux.0"; #PAY MUCH ATTENTION TO THIS AS "LINUX-INSTALL/" IS TO BE APPENDED TO TFTP REQUESTS FROM THE PXE CLIENT
}
$>service dhcpd restart #restart DHCP
3)Install and start TFTP
$>yum install tftp-server $>chkconfig --levl 345 xinetd on #tftp is xinet based see Red Hat doc $>service xinetd restart
4)Configure TFTP for a RHEL6 Install boot over PXE (that's where the real fun begins...)
a)I had to bind my TFTP service to the right NIC, this is because my Install server has 2 NICs, the idea is to serve DHCP and TFTP on the same NIC whatever path you choose to achieve that.
$>cat /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
disable = no #Default is Yes
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
per_source = 11
cps = 100 2
flags = IPv4
bind =192.168.1.1#Second NIC on Install server
}
$>tcpdump port 69 -v -i eth1# THIS IS WHAT SAVED ME AS I WAS ABLE TO SEE WHAT REQUEST THE PXE CLIENT WAS SENDING TO THE TFTP SERVER (-i eth1 is to listen on the correct NIC)
b)Place the correct files in the correct directory for the TFTP server to distribute them according to what the PXE client will request (this is where the fun continues as I did not find exhaustive documentation from Red Hat for this critical step)
$>yum install syslinux # I could not make it work without this package despite the fact Red Hat doesn't mention it in the RHEL6-PXE doc $>mkdir -p /var/lib/tftpboot/linux-install/pxelinux.cfg/ #I WAS ABLE TO SEE WRONG PATHS REQUEST FROM PXE-TFTP CLIENT AND MAKE CORRECTIONS THANKS TO THE TCPDUMP ON PORT 69 THIS IS DIRECTLY LINKED TO THE /etc/dhcp/dhcpd.conf EDIT OF STEP 2 $>cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/linux-install #no syslinux=no pxelinux.0 so this is one of the reasons I needed syslinux, also check the path to the tftp boot dir. (i.e. /var/lib/tftpboot) as I've seen /tftpboot as a variant $>cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot/linux-install #same as for pxelinux.0 $>cp <RHEL6_ISO>/images/pxeboot/* /var/lib/tftpboot/linux-install #wherever you go to find your RHEL ISO (DVD, .iso,...) there is an images dir. with a "pxeboot" subdir containing the needed files i.e. initrd.img, vmlinuz $>cat /var/lib/tftpboot/linux-install/pxelinux.cfg/default #This is the 2nd file that goes to the PXE client after it gets the pxelinux.0, it must be in the pxelinux.cfg directory timeout 100 default menu.c32 menu title $$$$$$Boot Menu$$$$$$ label 1 menu label ^ 1) RHEL6 kernel vmlinuz append initrd=initrd.img $>service xinetd restart $>service dhcp restart
This is what the tftp directory looks like:
$>ls -R /var/lib/tftpboot/ /var/lib/tftpboot/: linux-install /var/lib/tftpboot/linux-install: initrd.img menu.c32 pxelinux.0 pxelinux.cfg README TRANS.TBL vmlinuz /var/lib/tftpboot/linux-install/pxelinux.cfg: default
At this point I was able to boot the PXE client and got to the RHEL6 "ask method" first install screen. After that it was just a matter of pointing to my webserver that is exporting the RHEL Install tree, that second part (the http distribution of RHEL6 ISO for network installs) is well documented and pretty straight forward so I will not cover it here, unless I get tons of comments requesting it that is...In any case once you've booted and got to the first install screen (language selection) you're pretty much done with the PXE/TFTP-DHCP part of the process and after that any method should work if you have the correct setup (ftp,local drive,etc).
A couple comments
-The tcpdump -port 69 -v was the first trick of the day as without it I couldn't have figured out what requests the PXE client was making to the TFTP server.
-The "linux-install/" root directory for the PXE-TFTP-DHCP doesn't seem to be necessary, just went with the RH Docs on this.
- A "step by step" blog post from Ajay Singh that describes configuration for Kickstart over PXE with an http based install
-Red Hat Enterprise Linux 6 Installation Guide (look for PXE)
-Red Hat Enterprise Linux 6 Deployment Guide
-Here is what the tcpdump listening on the tftp port (i.e. 69) until the RHEL6 install boot looks like, after this PXE and TFTP are out of the loop. The ### represent hardware specific data (i.e. MAC address of PXE client)
$>tcpdump port 69 -v -i eth1 tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes 06:11:46.090902 IP (tos 0x0, ttl 20, id 2, offset 0, flags [none], proto UDP (17), length 69) 192.168.1.100.ah-esp-encap > home-router.mydomain.org.tftp: 41 RRQ "linux-install/pxelinux.0" octet tsize 0 06:11:46.096354 IP (tos 0x0, ttl 20, id 4, offset 0, flags [none], proto UDP (17), length 74) 192.168.1.100.acp-port > home-router.mydomain.org.tftp: 46 RRQ "linux-install/pxelinux.0" octet blksize 1456 06:11:46.239293 IP (tos 0x0, ttl 20, id 25, offset 0, flags [none], proto UDP (17), length 121) 192.168.1.100.49152 > home-router.mydomain.org.tftp: 93 RRQ "linux-install/pxelinux.cfg/##############" octet tsize 0 blksize 1408 06:11:46.250903 IP (tos 0x0, ttl 20, id 26, offset 0, flags [none], proto UDP (17), length 105) 192.168.1.100.49153 > home-router.mydomain.org.tftp: 77 RRQ "linux-install/pxelinux.cfg/##############" octet tsize 0 blksize 1408 06:11:46.262491 IP (tos 0x0, ttl 20, id 27, offset 0, flags [none], proto UDP (17), length 93) 192.168.1.100.49154 > home-router.mydomain.org.tftp: 65 RRQ "linux-install/pxelinux.cfg/C0A80164" octet tsize 0 blksize 1408 06:11:46.274077 IP (tos 0x0, ttl 20, id 28, offset 0, flags [none], proto UDP (17), length 92) 192.168.1.100.49155 > home-router.mydomain.org.tftp: 64 RRQ "linux-install/pxelinux.cfg/C0A8016" octet tsize 0 blksize 1408 06:11:46.285660 IP (tos 0x0, ttl 20, id 29, offset 0, flags [none], proto UDP (17), length 91) 192.168.1.100.49156 > home-router.mydomain.org.tftp: 63 RRQ "linux-install/pxelinux.cfg/C0A801" octet tsize 0 blksize 1408 06:11:46.297251 IP (tos 0x0, ttl 20, id 30, offset 0, flags [none], proto UDP (17), length 90) 192.168.1.100.49157 > home-router.mydomain.org.tftp: 62 RRQ "linux-install/pxelinux.cfg/C0A80" octet tsize 0 blksize 1408 06:11:46.309767 IP (tos 0x0, ttl 20, id 31, offset 0, flags [none], proto UDP (17), length 89) 192.168.1.100.49158 > home-router.mydomain.org.tftp: 61 RRQ "linux-install/pxelinux.cfg/C0A8" octet tsize 0 blksize 1408 06:11:46.321351 IP (tos 0x0, ttl 20, id 32, offset 0, flags [none], proto UDP (17), length 88) 192.168.1.100.49159 > home-router.mydomain.org.tftp: 60 RRQ "linux-install/pxelinux.cfg/C0A" octet tsize 0 blksize 1408 06:11:46.332952 IP (tos 0x0, ttl 20, id 33, offset 0, flags [none], proto UDP (17), length 87) 192.168.1.100.49160 > home-router.mydomain.org.tftp: 59 RRQ "linux-install/pxelinux.cfg/C0" octet tsize 0 blksize 1408 06:11:46.344543 IP (tos 0x0, ttl 20, id 34, offset 0, flags [none], proto UDP (17), length 86) 192.168.1.100.49161 > home-router.mydomain.org.tftp: 58 RRQ "linux-install/pxelinux.cfg/C" octet tsize 0 blksize 1408 06:11:46.356134 IP (tos 0x0, ttl 20, id 35, offset 0, flags [none], proto UDP (17), length 92) 192.168.1.100.49162 > home-router.mydomain.org.tftp: 64 RRQ "linux-install/pxelinux.cfg/default" octet tsize 0 blksize 1408 06:11:46.360056 IP (tos 0x0, ttl 20, id 38, offset 0, flags [none], proto UDP (17), length 80) 192.168.1.100.49163 > home-router.mydomain.org.tftp: 52 RRQ "linux-install/menu.c32" octet tsize 0 blksize 1408 06:11:46.370514 IP (tos 0x0, ttl 20, id 84, offset 0, flags [none], proto UDP (17), length 92) 192.168.1.100.49164 > home-router.mydomain.org.tftp: 64 RRQ "linux-install/pxelinux.cfg/default" octet tsize 0 blksize 1408 06:12:19.688454 IP (tos 0x0, ttl 20, id 87, offset 0, flags [none], proto UDP (17), length 79) 192.168.1.100.49165 > home-router.mydomain.org.tftp: 51 RRQ "linux-install/vmlinuz" octet tsize 0 blksize 1408 06:12:20.023492 IP (tos 0x0, ttl 20, id 2846, offset 0, flags [none], proto UDP (17), length 82) 192.168.1.100.49166 > home-router.mydomain.org.tftp: 54 RRQ "linux-install/initrd.img" octet tsize 0 blksize 1408
-A series of screenshots showing the client boot sequence (from left to right)
2.








