Pxe server setup and configuration

9
PXE Server Configuration and Documentation This server will be used to PXE boot workstations and assign them IP addresses (utilizing Wake-On-Lan capable NICs on workstations), point to ESXi installation media and scripts (via a specially configured kickstart file) and to automatically install and run ESXi 5.1. These ESXi hosts will then in turn “host” Virtual Machines. These VMs are administered and configured using VMware vSphere and vCenter server appliance, and NETLAB+ is used as a front-end for remote access for students and faculty to use or configure the VM pods (“pod” is a pre- configured group of VMs configured for NETLAB) and environments. The server must provide: TFTP Server (to server the ESXi install media and the other necessary configuration files to the target hosts to start boot/installation, DHCP Server (provide target ESXi hosts with IP addresses, points to PXE boot file Web Server (hosts the custom Kickstart script which automates the ESXi install, and possibly other files if using gpxelinux.0) Access to the ESXi 5.1 files from .iso or other source, available to allow copies of the files SYSLINUX (using either pxelinux.0 or gpxelinux.0 configuration files to boot) Kickstart configuration script (automates install among other settings)

Transcript of Pxe server setup and configuration

Page 1: Pxe server setup and configuration

PXE Server Configuration and Documentation

This server will be used to PXE boot workstations and assign them IP addresses (utilizing Wake-On-Lan capable NICs on workstations), point to ESXi installation media and scripts (via a specially configured kickstart file) and to automatically install and run ESXi 5.1. These ESXi hosts will then in turn “host” Virtual Machines. These VMs are administered and configured using VMware vSphere and vCenter server appliance, and NETLAB+ is used as a front-end for remote access for students and faculty to use or configure the VM pods (“pod” is a pre-configured group of VMs configured for NETLAB) and environments.

The server must provide:

TFTP Server (to server the ESXi install media and the other necessary configuration files to the target hosts to start boot/installation,

DHCP Server (provide target ESXi hosts with IP addresses, points to PXE boot file

Web Server (hosts the custom Kickstart script which automates the ESXi install, and possibly other files if using gpxelinux.0)

Access to the ESXi 5.1 files from .iso or other source, available to allow copies of the files

SYSLINUX (using either pxelinux.0 or gpxelinux.0 configuration files to boot)

Kickstart configuration script (automates install among other settings)

Page 2: Pxe server setup and configuration

If you use PXELINUX with the pxelinux.0 file, the pxelinux.0 binary file itself, the configuration file (in our case the boot.cfg), the kernel, and other files are transferred by TFTP. When using gPXE, only the gpxelinux.0 binary file and configuration file are transferred by TFTP. With gPXE, you can use a Web server to transfer the kernel and other files required to boot the ESXi installer. Because of this, gpxe can provide better performance in some cases, although both work effectively in testing and pxelinux.0 is simpler to implement.

** This has only been tested using a Linux environment using SYSLINUX to provide the PXE boot functions. There are Microsoft Windows solutions available, although those solutions are more complex and bloated, heavily relying third- party applications. **

Test environment consisted of:

SusSE 11 Server SP3 VM with the following services/packages/configurations;

20GB HD

2GB RAM

TFTP, DHCP, HTTP

SYSLINUX (using pxelinux.0)

APACHE2

TFTP Setup and Configuration

In SuSE Linux by the default this is located off the root at /tftpboot. *This location can be different on different distros of Linux.

This directory will contain all the files needed for PXE booting (except for the DHCP file – see instructions on DHCP setup)

This includes:- The contents of the ESXi .iso (installation files)

- The SYSLINUX file(s) used to boot clients

- The configuration file (boot.cfg)

A copy of the pxelinux.0 file needs to be copied into the tftp directory so it is located at;

/tftpboot/pxelinux.0

Page 3: Pxe server setup and configuration

pxelinux.0 is used by SYSLINUX to boot the hosts. The following directory needs to be created;

/tftpboot/pxelinux.cfg

This directory contains the file that pxelinux.0 uses to boot. This file needs to be created and named default, and is located at;

/tftpboot/pxelinux.cfg/default

This points the host the configuration file (boot.cfg), which then points to the kickstart script located on the web server. ESXi installation begins automatically after host has been booted. Specifically, there are two vital files;

mboot.c32 -Main part of installer

boot.cfg -contains additional settings, one of which is vital: LOCATION OF KICKSTART SCRIPT is here – see example from test lab below;

The generic template for this file is isolinux.cfg –which is located in ESXi installation media.

Page 4: Pxe server setup and configuration

DHCP Setup and Configuration

The DHCP configuration file is called dhcpd.conf and is located at;

/etc/sysconfig/dhcpd.conf

This file defines how the hosts will receive IP addresses, what that range of addresses will be, and points to the boot files, among other settings.

Specifically, it points to the PXELINUX file used (pxelinux.0 or gpxelinux.0) which will boot the kickstart script and then automatically start the ESXi installation. The bolded data below is the contents the dhcpd.conf file used in the test environment.

option subnet-mask 255.255.255.0;option broadcast-address 169.254.0.255;option domain-name "pxeserver.local";option domain-name-servers 169.254.1.1;option routers 169.254.0.1;max-lease-time 604800;authoritative ;filename "pxelinux.0";ddns-update-style none;default-lease-time 86400;ddns-update-style ad-hoc;allow booting;allow bootp;

# the following defines the IP pool that DHCP will provide for the hosts

subnet 169.254.0.0 netmask 255.255.255.0 { range 169.254.0.100 169.254.0.150;}class pxeclients { match if substring(option vendor-class-indentifier, 0, 9) = "PXEClient";}

# The following will give each host the same IP address every time it boots. This entry needs to be repeated in this config file for each host machine. The MAC addresses of the hosts will be needed. So for the production environment this would be 20 machines

host ESXi_1 {

Page 5: Pxe server setup and configuration

hardware ethernet BA:DF:00:DF:C0:FF; fixed-address 169.254.0.101; option host-name ESXi_1; }

Hosting Kickstart file using HTTP/Apache2

The kickstart file mentioned above must be hosted using HTTP on the default web server. It needs to be located on the web server root. For SuSE Linux this location is;

/srv/www/htdocs/ /srv/www/htdocs/kickstart.ks.cfg

For this environment the kickstart files is named ks, although it can be named anything.

Finishing Setup and Test.

After completing the above steps, making sure all files are in the correct directories and contain the correct data the system can now be tested.

Begin by restarting DHCP, TFTP, and HTTP services.

Launch a host ( blank VM in VMware workstation was used in test environment) that is set to boot form NIC and is on correct network. If all is correct, ESXi installation will begin.

# Remember, the kickstart file dictates how the machine will behave while installing ESXi, such as rebooting, license agreements, and diskless hosts. The appropriate syntax must be added/adjusted to conform to specific network needs.

Page 6: Pxe server setup and configuration