Nov 25, 2012

Setting Up ISC DHCP Server to Load the Solaris OS and Red Hat Linux Systems

http://techsupportpk.blogspot.com/2013/07/setting-up-isc-dhcp-server-to-load.html

This article describes how to install a server that supports loading the following:
  • The Solaris 8 or 10 Operating System for SPARC platforms, using Dynamic Host Configuration Protocol (DHCP)
  • The Solaris 10 OS for x86/x64 platforms, using Preboot Execution Environment (PXE)/DHCP and JumpStart software
  • Red Hat Linux clients, using PXE and Kickstart

Notes:
  • I tested this on Solaris 8 and 10 releases. I didn't test it on the Solaris 9 OS, but I think it would work.
  • I used this procedure with Red Hat Enterprise Linux 3 and 4, but the instructions should also work with any Linux distribution that uses Kickstart and supports PXE.
This procedure uses the open source Internet Systems Consortium, Inc. (ISC) DHCP server, which is available at the ISC web site or from Blastwave.org.

Contents
  • Prerequisites
  • Set Up the dhcpd.conf Configuration File
  • Make DHCP Configurations for Each Platform
  • Create sysidcfg Files
  • Modify the Default GRUB menu.lst File on the JumpStart Server
  • Set Up Linux Configurations
  • Load the Systems
Prerequisites
1. Install the Solaris media to your JumpStart server. This is all very straightforward following the instructions available on docs.sun.com.

2. Run add_install_client for each Solaris OS version you are running. This is also straightforward except for clients using the Solaris 10 OS on x86 platforms. For DHCP clients with the Solaris 10 OS on x86 platforms, use the following:
  ./add_install_client -d -c
soljumpsvr:/export/JUMPSTART/sol10/11_06_x86/boot SUNW.i86pc i86pc
I highly recommend that you rename the boot images placed in /tftpboot to reflect the OS version, so you can load different OS versions. You will need to know the names of these files later so they can be put into the dhcpd.conf file.

3. For clients not on the same subnet as your JumpStart server, configure DHCP forwarders so their subnet forwards DHCP requests to your JumpStart server.

4. If your JumpStart server runs the Solaris 8 OS, either upgrade to the Solaris 9 or 10 OS or replace the in.tftpd binary with the one from the Solaris 9 OS. You need to do one of these actions to provide the features that are required by PXE clients for Linux and the Solaris 10 OS for x86 platforms.

5. Install the ISC DHCP server.

Set Up the dhcpd.conf Configuration File
After you make any changes to the dhcpd.conf file or to any "include" files that dhcpd.conf references, you must stop and start dhcpd again for the changes to take effect.
# dhcpd.conf file for DHCP Jumpstart and PXE Kickstart
#
# Options common to all supported networks
ddns-update-style ad-hoc;
option domain-name-servers 10.1.1.3, 10.1.1.4;
allow bootp;
allow booting;

# Ignore all hosts we don't have MAC addresses for
ignore unknown-clients;

default-lease-time 1600;
max-lease-time 7200;

# Jumpstart Support
option space SUNW;
option SUNW.root-mount-options code 1 = text;
option SUNW.root-server-ip-address code 2 = ip-address;
option SUNW.root-server-hostname code 3 = text;
option SUNW.root-path-name code 4 = text;
option SUNW.swap-server-ip-address code 5 = ip-address;
option SUNW.swap-file-path code 6 = text;
option SUNW.boot-file-path code 7 = text;
option SUNW.posix-timezone-string code 8 = text;
option SUNW.boot-read-size code 9 = unsigned integer 16;
option SUNW.install-server-ip-address code 10 = ip-address;
option SUNW.install-server-hostname code 11 = text;
option SUNW.install-path code 12 = text;
option SUNW.sysid-config-file-server code 13 = text;
option SUNW.JumpStart-server code 14 = text;
option SUNW.terminal-name code 15 = text;
option SUNW.SbootURI code 16 = text;


# Declare all UNIX subnets with only basic information

subnet 10.1.30.0 netmask 255.255.254.0 {
        option broadcast-address 10.1.31.255;
        option routers 10.1.30.1;
        option domain-name "foo.bar.com";
}

subnet 10.1.32.0 netmask 255.255.254.0 {
        option broadcast-address 10.1.33.255;
        option routers 10.1.32.1;
        option domain-name "foo.bar.com";
}

subnet 10.91.34.0 netmask 255.255.254.0 {
        option broadcast-address 10.1.35.255;
        option routers 10.1.34.1;
        option domain-name "foobar.example.com";
}

# This is optional. I prefer to have scripts.
# Modify the separate configs for each platform.
include "/export/JUMPSTART/DHCP/linux_dhcpd.conf";
include "/export/JUMPSTART/DHCP/sol8_dhcpd.conf";
include "/export/JUMPSTART/DHCP/sol10_sparc_dhcpd.conf";
include "/export/JUMPSTART/DHCP/sol10_x86_dhcpd.conf";

Make DHCP Configurations for Each Platform
The DHCP configurations are the files referenced by the include statements in the dhcpd.conf file described in the previous Set Up the dhcpd.conf Configuration File section. The dhcpd.conf configuration file is very flexible. One way to logically group systems together is using the group keyword, as shown in the following examples.
sol8_dhcpd.conf
# Solaris 8 hosts go here
group {
   filename "inetboot.SUN4U.Solaris_8-1";
   next-server 10.1.67.11;
   use-host-decl-names on;
   vendor-option-space SUNW;
   option SUNW.JumpStart-server
"soljumpsvr:/export/JUMPSTART/sol8/configs";
   option SUNW.install-server-hostname "soljumpsvr";
   option SUNW.install-server-ip-address 10.1.67.11;
   option SUNW.install-path "/export/JUMPSTART/sol8/current";
   option SUNW.root-server-hostname "soljumpsvr";
   option SUNW.root-server-ip-address 10.1.67.11;
   option SUNW.root-path-name
"/export/JUMPSTART/sol8/current/Solaris_8/Tools/Boot";

  host css358 { hardware ethernet 00:03:ba:09:04:56;
fixed-address 10.1.30.121; option SUNW.sysid-config-file-server =
"soljumpsvr:/export/JUMPSTART/sol8/configs/sparc/my-nis-dom"; }
  host ens175 { hardware ethernet 00:03:ba:12:50:b9;
fixed-address 10.1.30.107; option SUNW.sysid-config-file-server =
"soljumpsvr:/export/JUMPSTART/sol8/configs/sparc/my-nis-dom"; }
}


sol10_sparc_dhcpd.conf
# Solaris 10 SPARC 11/06 (update 3)
group {

   use-host-decl-names on;
   filename "inetboot.SUN4U.Solaris_10-u3";
   next-server 10.1.67.11;
   vendor-option-space SUNW;
   option SUNW.JumpStart-server
"soljumpsvr:/export/JUMPSTART/sol10/configs";
   option SUNW.install-server-hostname "soljumpsvr";
   option SUNW.install-server-ip-address 10.1.67.11;
   option SUNW.install-path
"/export/JUMPSTART/sol10/11_06_sparc";
   option SUNW.root-server-hostname "soljumpsvr";
   option SUNW.root-server-ip-address 10.1.67.11;
   option SUNW.root-path-name
"/export/JUMPSTART/sol10/11_06_sparc/Solaris_10/Tools/Boot";
   option SUNW.sysid-config-file-server =
"soljumpsvr:/export/JUMPSTART/sol10/configs/sysids/default"; }

  host testproxy { hardware ethernet 00:03:ba:27:59:8b;
fixed-address 10.1.51.45; option SUNW.sysid-config-file-server =
"soljumpsvr:/export/JUMPSTART/sol10/configs/sysids/testproxy"; }
}


sol10_x86_dhcpd.conf
# Solaris 10 x86 11/06 (update 3) systems
group {

  use-host-decl-names on;
  filename "pxegrub.I86PC.Solaris_10-u3";
  next-server 10.1.67.11;
  vendor-option-space SUNW;
  option SUNW.JumpStart-server
"10.1.67.11:/export/JUMPSTART/sol10/configs";

  # BE WARNED: No hostnames. Must use IP addresses for Sol 10 x86!
  host solx8622 { hardware ethernet 00:14:4f:24:09:3c;
fixed-address 10.1.31.177; option SUNW.sysid-config-file-server =
"10.1.67.11:/export/JUMPSTART/sol10/configs/sysids/my-nis-dom"; }
  host solx8612 { hardware ethernet 00:12:3f:97:2e:af;
fixed-address 10.1.30.17; option SUNW.sysid-config-file-server =
"10.1.67.11:/export/JUMPSTART/sol10/configs/sysids/your-nis-dom"; }

}


linux_dhcpd.conf
  # Kickstart using boot CD on client
  host lnx167 { hardware ethernet 00:13:72:de:52:fe;
fixed-address 10.1.42.69; filename
"/export/KS/install/kickstart/hosts/lnx167";
next-server nfsserver01; }

  # Kickstart using PXE
  host lnx20 { hardware ethernet 00:14:4f:3b:8e:1e;
fixed-address 10.1.51.111; filename "pxelinux.0";
next-server tftpserver01; }
  host lnx163 { hardware ethernet 00:13:72:7d:13:30;
fixed-address 10.1.32.39; filename "pxelinux.0";
next-server tftpserver01; }

Create sysidcfg Files
For the most part, sysidcfg files are the same across Solaris versions. The only exception is that clients for the Solaris 10 OS on SPARC platforms will not work unless you add default_route=NONE to the network configuration, as in the following examples:
  # Solaris 10 SPARC sysidcfg
  system_locale=C
  security_policy=NONE
  name_service=NIS {domain_name=your-nis-dom
name_server=nis02(10.1.51.12)}
  network_interface=primary {protocol_ipv6=no
default_route=NONE netmask=255.255.254.0}
  terminal=vt100
  timezone=US/Central
  timeserver=localhost
  root_password=27wEn59niIbhM

  # Solaris 8 SPARC sysidcfg
  timezone=US/Central
  timeserver=localhost
  terminal=vt100
  system_locale=C
  network_interface=primary {protocol_ipv6=no
netmask=255.255.254.0}
  name_service=NIS {domain_name=my-nis-dom
name_server=nis01(10.1.60.14)}
  security_policy=NONE
  root_password=24bz8B.xa1rZw

  # Solaris 10 x86 sysidcfg
  system_locale=C
  security_policy=NONE
  network_interface=primary {protocol_ipv6=no}
  name_service=NIS {domain_name=my-nis-dom
name_server=nis01(10.1.51.12)}
  terminal=vt100
  timezone=US/Central
  timeserver=localhost
  root_password=27wEn59niIbhM

Modify the Default GRUB menu.lst File on the JumpStart Server
The default menu.lst file does not provide a choice to install the system (very strange). In /tftpboot/boot/grub, you need to edit the menu.lst file. Here is a working one:
  default=0
  timeout=30
  title Custom Solaris 10 Jumpstart (11/06) - framebuffer
  # Ensure this is all one line!
  # I think install_config is unnecessary here (in dhcpd.conf)
  kernel /I86PC.Solaris_10-u3/multiboot kernel/unix -B
install_media=10.1.67.11:/export/JUMPSTART/sol10/11_06_x86,
install_config=10.1.67.11:/export/JUMPSTART/sol10/configs - install
module /I86PC.Solaris_10-u3/x86.miniroot

  title Custom Solaris 10 Jumpstart (11/06) - ttya
  kernel /I86PC.Solaris_10-u3/multiboot kernel/unix -B
console=ttya,install_media=10.1.67.11:/export/JUMPSTART/sol10/11_06_x86,
install_config=10.1.67.11:/export/JUMPSTART/sol10/configs - install
module /I86PC.Solaris_10-u3/x86.miniroot

Set Up Linux Configurations
I did this process with various versions of Red Hat Linux using Kickstart, but it should apply to most any Linux distribution. The basics of setting up Linux PXE loading are as follows:
1. Copy your Linux distribution to an NFS-shared directory.
2. Download the latest syslinux RPM from the RPM directory at http://www.kernel.org/pub/linux/utils/boot/syslinux/ and install it to a Linux system. Find the pxelinux.0 file that it installs to /usr/lib/syslinux and copy it into your /tftpboot directory.

3. Copy the initrd.img and vmlinuz files from the Linux distribution you copied in Step 1 to the /tftpboot directory. Each Linux version you load needs to use the corresponding pxeboot files.

Therefore, name the files with the version information, for example:
/tftpboot/intrd.img-RHEL4_i386_u4
/tftpboot/vmlinuz-RHEL4_i386_u4
 
4. Make a PXE configuration directory: /tftpboot/pxelinux.cfg.

5. Put configuration files for each Linux system you plan to PXE boot into the /tftpboot/pxelinux.cfg directory. The names of the files are significant. A configuration file for one system will be its MAC address using dashes, for example:

/tftpboot/pxelinux.cfg/01-00-13-72-2b-a5-3e
 
You may also have a file called default that all systems will use. For example:
default linux
label linux
  kernel vmlinuz-RHEL4_i386_u4
  append ksdevice=eth0 load_ramdisk=1
initrd=initrd.img-RHEL4_i386_u4 network
ks=nfs:nfsserver:/export/KS/hosts/lnx167
 
6. Put a standard Kickstart configuration file on the NFS server for each host. In the example default file in Step 5, it's the lnx167 file.

7. Put the necessary configurations in the DHCP configuration file. See the Make DHCP Configurations for Each Platform section for more information.

8. Once you figure out the format of the DHCP configuration files, consider making a script that regenerates the files and restarts dhcpd when you add a new host that needs to use JumpStart or Kickstart. Using a script will ensure the format is correct and prevent you from having to edit the files and restart dhcpd manually every time a host is added.

Load the Systems
For Solaris systems using the SPARC platform, run boot net:dhcp - install from the EEPROM. You must be at version 3.25 or greater for DHCP support. You can also reboot from the Solaris prompt to get the same result, for example:

# reboot -- "net:dhcp - install"
 
On systems running Linux or the Solaris OS for x86 platforms, you need to initiate a PXE boot. On many systems, including Sun's systems built on AMD Opteron processors, you initiate a PXE boot by pressing F12 when the system is coming up.
 
TECH SUPPORT © 2012-2016