Wednesday, July 28, 2010

FC10 How to setup a PXEboot + Tftp + Dhcp Server

I want to be able to boot over the network to install Fedora 10 on several machines at the same time.
And I have a hardware firewall, a Netscreen NS50, which has a dhcpserver configured in it.

The solution is to confiure a tftp server (so the client will be able to boot on through PXE), a dhcp server different from the one in my firewall and an NFS server.
The NFS server is called nfsserver (, the dhcp and the tftp server are on the same server, called pxeserver ( These server can reside on different machines.

Here are the packages to be installed:

  • system-config-netboot
  • system-config-netboot-cmd
  • tftp
  • tftp-server
  • dhcpd
Configuration of the NFS server on nfsserverDownload the DVD iso image of the Fedora 10 distribution.
Then mount it in a directory /mnt/f10tmp:
# mkdir /mnt/f10tmp
# mount Fedora-10-i386-DVD.iso /mnt/f10tmp -o loop

Copy the content of /mnt/f10tmp into /mnt/f10.
# mkdir /mnt/f10
# cp -r /mnt/f10tmp/* /mnt/f10

Add the following line in /etc/exports:
/mnt/f10 *(rw,async,no_root_squash)

Then run
# exportfs -va

Configuration of the tftp server on pxeserver
Run system-config-netboot and configure a network installation:
  • Oprating system identifier: name of your distribution (Fedora10)
  • Description: some desciption!
  • Select protocol for installation: choose NFS
  • Kickstart: if you have a kickstart file, put the path to it here, if not, leave empty
  • Server IP address :
  • Location: /mnt/f10
Click OK. This creates a directory /tftpboot/linux-install/Fedora10 with files like initrd.img and vmlinuz downloaded from your nfsserver (/mnt/f10/images/pxeboot/).

Create a New PXE configuration file:
  • Hostname of IP Address/subnet: the IP of your hosts
  • Operating system: Fedora10 should be there. It is auto-populated from the previous step.
Click OK. A file named default is created in /tftpboot/linux-install/pxelinux.cfg.

Edit the file /etc/xinetd.d/tftp and change the line containing server_args:

service tftp
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot -v -v
per_source = 11
cps = 100 2
flags = IPv4

Check that the server is on:
# chkconfig --list tftp
tftp on

If off, set it on:
# chkconfig tftp on

and the start the server xinetd:
# /etc/init.d/xinetd restart

You can test your tftp server with the tftp client from your home directory:
$ tftp pxeserver
get linux-install/pxelinux.0

You should have the file pxelinux.0 in your home directory.

Configuration of the dhcp server on pxeserver
Edit the file /etc/dhcpd.conf and add the following lines:

subnet netmask {
allow booting;
allow bootp;
class "pxeclients" {
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
filename "linux-install/pxelinux.0";

Even if you have a running dhcp server somewhere, this will work.

Start the dhcp server:
# /etc/init.d/dhcpd restart

Check in /var/log/messages:
Dec 5 11:49:06 pxeserevr dhcpd: Listening on LPF/eth0/00:15:c5:53:fd:f5/
Dec 5 11:49:06 pxeserver dhcpd: Sending on LPF/eth0/00:15:c5:53:fd:f5/
Dec 5 11:49:06 pxeserver dhcpd: Sending on Socket/fallback/fallback-net

Restart now your client (target) pc to boot over the network.

You should see something like this in /var/log/messages:

Dec 5 11:49:32 pxeserver dhcpd: DHCPDISCOVER from 00:04:76:51:2e:d8 via eth0
Dec 5 11:49:33 pxeserver dhcpd: DHCPOFFER on to 00:04:76:51:2e:d8 via eth0
Dec 5 11:49:36 pxeserver dhcpd: DHCPREQUEST for ( from 00:04:76:51:2e:d8 via eth0
Dec 5 11:49:36 pxeserver dhcpd: DHCPACK on to 00:04:76:51:2e:d8 via eth0
Dec 5 11:49:36 pxeserver in.tftpd[6567]: RRQ from filename linux-install/pxelinux.0
Dec 5 11:49:36 pxeserver in.tftpd[6567]: tftp: client does not accept options

If it does not work, either disable the firewall (system-config-firewall) on pxeserver or allow port 69 to be accessible to any hosts accessing the tftp server.
If you get an error, please have a look here to fix it.

You will have a prompt to boot either on Fedora10 or on your local installation.