Friday 10 August 2012

PXE boot Server in Linux




1.0             Requiremens
  1. Client needs to support PXE Boot UNDI (at least 2.0) in the system BIOS.
  2. Client needs a NIC that supports PXE.
  3. DHCP server (included in the standard RedHat distro)
  4. TFTP server (included in the standard RedHat distro)
  5. PXELINUX (download and a similar tutorial are here)
2.0             Client
  1. Switch the boot order in the BIOS so that PXE is first
  2. Boot the client and copy down the MAC address while it is looking for the DHCP server
3.0             Server
  1. Install a DHCP daemon
o    [root]$ rpm -ivh dhcp-2.0pl5-8.i386.rpm
    • add the following to your /etc/dhcpd.conf file for each client:
2.  # /etc/dhcpd.conf
3.  #
4.  # 'subnet' should be defined as a route
5.  # 'hardware ethernet' is the MAC address of the client
6.  # 'fixed-address' is the IP you want to assign to the client
7.  # 'filename' is the location of the pxelinux executable on the TFTP server
8.  #
9.  subnet 10.0.0.0 netmask 255.0.0.0 {
10.  default-lease-time 600;
11.  max-lease-time 7200;
12. 
13.  host client12 {
14.    hardware ethernet  00:00:00:00:00:00;
15.    fixed-address 10.1.1.12;
16.    option host-name "client12";
17.    filename "X86PC/UNDI/linux-install/pxelinux.0";
18.  }
}
    • start the DHCP server:
[root]$ /usr/sbin/dhcpd
  1. Install a TFTP server
o    [root]$ rpm -ivh tftp-server-0.28-2.i386.rpm
    • create these directories if the default RPM install does not:
20./tftpboot
21./tftpboot/X86PC
/tftpboot/X86PC/UNDI
    • add a directory for your client type:
/tftpboot/X86PC/UNDI/linux-install
    • start the TFTP server:
[root]$ /usr/sbin/in.tftpd -l -v -s /tftpboot
-l runs it in standalone mode
-v toggles verbose output to /var/log/messages
-s [directory] sets the root directory
  1. Compile pxelinux
  2. Yum install syslinux
  3. /usr/share/syslinux/pxelinux.0 will present
    • a standard 'configure' and 'make' should build an appropriate pxelinux.0
    • move pxelinux.0 to /tftpboot/X86PC/UNDI/linux-install/pxelinux.0
    • make a directory for the pxelinux config
/tftpboot/X86PC/UNDI/linux-install/pxelinux.cfg
    • create a file called 'default' in that directory with these contents:
default linux
label linux
kernel vmlinuz
append ksdevice=eth0 load_ramdisk=1 initrd=initrd.img network
    • you can also create a file with the name of the client IP (in hex) if you want a particular client to receive certian options
  1. Install the boot images
    • use initrd.img and vmlinuz from images/pxeboot/ in the RedHat install tree
    • move them to the tftp server directory:
26./tftpboot/X86PC/UNDI/linux-install/initrd.img
/tftpboot/X86PC/UNDI/linux-install/vmlinuz
    • make sure all of the files in the tftp server directory are world readable
  1. Boot the client and do a network RedHat install

No comments:

Post a Comment