ucostyio

Setting up a PXE server on linux

Actually this should work on any *nix base but I have only used Linux. Infact I only used Fedora Core 3. For a PXE server you need two things:

  • DHCP server
  • TFTP server

I used ISC DHCP Server and TFTP Daemon. Both can be acquired using Apt-Get, Yum, or anywhere else quite easily.

Installing tftpd

Use your favourite package manager to install the tftpd package. Open up your favourite text editor and open the file /etc/xinetd.d/tftp and update it’s contents to reflect the following code

# 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  
{  
    socket_type	= dgram  
    protocol	= udp  
    wait	= yes  
    user	= root  
    server	= /usr/sbin/in.tftpd  
    server_args	= -v -v -v -s /tftpboot  
    disable	= no  
    per_source	= 11  
    cps	= 100 2  
    flags	= IPv4  
}

Installing Dhcpd

Again, use your favourite package manager to install the ISC Dhcp server. Then edit the file /etc/dhcpd.conf

# DHCP configuration file for DHCP ISC 3.0

ddns-update-style none;

option space PXE;  
option PXE.mtftp-ip code 1 = ip-address;  
option PXE.mtftp-cport code 2 = unsigned integer 16;  
option PXE.mtftp-sport code 3 = unsigned integer 16;  
option PXE.mtftp-tmout code 4 = unsigned integer 8;  
option PXE.mtftp-delay code 5 = unsigned integer 8;  
option PXE.discovery-control code 6 = unsigned integer 8;  
option PXE.discovery-mcast-addr code 7 = ip-address;

subnet [network-address] netmask [netmask] { #e.g 192.168.1.0 255.255.255.0

class "pxeclients" {  
    match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";  
    option vendor-class-identifier "PXEClient";  
    vendor-option-space PXE;  
    option domain-name "[domain]";  
    option PXE.mtftp-ip 0.0.0.0;

    # This is the name of the file the boot ROMs should download.  
    filename "[bootrom]"; #e.g pxelinux.0  
    # This is the name of the server they should get it from.  
    next-server [tftp-server-ip];  
}

pool {  
    max-lease-time 86400;  
    default-lease-time 86400;  
    range [start-ip-address] [end-ip-address]; #e.g: 10.0.0.2 10.0.0.254  
}

Replace the [bounded] text with the appropriate information. Basically you have to specify the start and end ip addresses and the file to load first on the client.

Once you have done all of that type in “service dhcp restart” to activate all the changes. Now any PXE capable clients will attempt to use TFTP to load the bootfile off the server.

Written Aug 1, 2005

Comments

comments powered by Disqus
Powered by Disqus