Quantcast
Channel: Oracle Bloggers
Viewing all articles
Browse latest Browse all 19780

Setup a Jumpstart server using DHCP on an Solaris 11.2 machine

$
0
0

In this article I want to setup a Jumpstart server using DHCP on an Solaris 11.2 machine.


Jumpstart is the automation installation of Solaris 10 so that we can install Solaris 10 easily with prepared configuration. Normally a Jumpstart server is installing on a Solaris 10 server and consists of below sub-servers,


  1. RARP server: provides MAC address (Ethernet address) to IP service

  2. Boot parameter server: provides

  3. DHCP server: RARP and Boot parameter servers can be substituted by DHCP server.

  4. Boot server: provides mini boot image to boot up clients

  5. Install package server: provides software packages to client via NFS

  6. System Identity (sysidcfg) server: provides information of ip address, time zone, default locale, root password...

  7. Profile server: provides software configuration (what to install) and disk layout of this client.




In an extreme case we can divide all the services into 7 different servers, but for management consideration we often integrate all of them into one. Similarly, for management purpose we may want to integrate both Jumpstart and AI servers onto the same box, yes, that's why we have this article.


One advantage of Jumpstart on Solaris 11.2 box is Solaris 11's ISC DHCP, which can boot up x86 clients as PXE boot supports DHCP only, it doesn't support RARP. I will not talk about RARP and boot parameter servers here, only DHCP will be introduced. So please prepare an Solaris 11.2 machine with this group package solaris-large-server installed and let's start,


1. prepare a file /etc/inet/dhcpd4.conf


(my server ip: 192.168.1.115, netmask: 255.255.255.0, defaultrouter: 192.168.1.1, broadcast: 192.168.1.255


my server will provide 192.168.1.200 - 192.168.1.220 to DHCP clients)


----- begin of dhcpd4.conf -----
# cat /etc/inet/dhcpd4.conf
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#

# option definitions common to all supported networks...
#option domain-name "example.org";
#option domain-name-servers ns1.example.org, ns2.example.org;

default-lease-time 600;
max-lease-time 7200;

# Use this to enble / disable dynamic dns updates globally.
#ddns-update-style none;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;


# For Sparc clients
option space SUNW;
option SUNW.SrootIP4   code 2 = ip-address;
option SUNW.SrootNM    code 3 = text;
option SUNW.SrootPTH   code 4 = text;
option SUNW.SinstIP4   code 10 = ip-address;
option SUNW.SinstNM    code 11 = text;
option SUNW.SinstPTH   code 12 = text;
option SUNW.SbootURI   code 16 = text;
option SUNW.SjumpsCF   code 14 = text;
option SUNW.SsysidCF   code 13 = text;



# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.

subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.200 192.168.1.220;
  option broadcast-address 192.168.1.255;
  option routers 192.168.1.1;
  next-server 192.168.1.115;

   on commit {
      log("====[ START COMMIT ]====" ) ;
      log("The host name is:" ) ;
      log(host-decl-name);
      set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
      set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
      log(concat("Commit: IP: " , ClientIP, " Mac: ", ClientMac, " Hostname: " , host-decl-name));
      log("====[ END COMMIT ]====" ) ;
   }
}
----- end of dhcpd4.conf -----

then enable dhcp service by running


svcadm enable dhcp/server:ipv4

and make sure dhcp is online by


# svcs dhcp/server:ipv4
STATE          STIME    FMRI
online          9:43:25 svc:/network/dhcp/server:ipv4


2. add this line to the end of /etc/syslog.conf

local7.debug/var/adm/dhcpd.log



(Be noted to put Tab's between local7.debug and /var/adm/dhcpd.log, you will get error if Space is used.)

then run


svcadm refresh system-log


so that this server can keep dhcp logs in /var/adm/dhcpd.log


3. download Solaris 10 iso image at http://www.oracle.com/technetwork/server-storage/solaris10/downloads/index.html


for instance, sol-10-u11-ga-x86-dvd.iso is the iso image of Solaris 10 u11 for x86, then


# mount -F hsfs /root/sol-10-u11-ga-x86-dvd.iso /mnt
# cd /mnt
# ls
Copyright                         Solaris_10                        installer
Offer_to_Provide_Source_Code.txt  boot

# mkdir -p /work/jumpstart/os-image/Install-i386-10-u11_2013.01/
# find . |cpio -pud /work/jumpstart/os-image/Install-i386-10-u11_2013.01/
# ls /work/jumpstart/os-image/Install-i386-10-u11_2013.01/
Copyright                          boot/                              Offer_to_Provide_Source_Code.txt
Solaris_10/                        installer*
# umount /mnt


With above commands we put contents of this iso image to the directory /work/jumpstart/os-image/Install-i386-10-u11_2013.01/


4. retrieve /usr/sbin/install.d/chkprobe from Solaris 10 os image,

# cd /tmp
# 7z x /work/jumpstart/os-image/Install-i386-10-u11_2013.01/Solaris_10/Product/SUNWinst/archive/none.7z
# cpio -id < none
# ls -l /tmp/usr/sbin/install.d
chkprobe*    findcd*      get_mntpnt*  pfinstall*   profetch*    profind*     set_mntpnt*  stubboot*
# mkdir /usr/sbin/install.d
# cp /tmp/usr/sbin/install.d/chkprobe /usr/sbin/install.d


5. NFS share our jumpstart directory with the option ro,anon=0


on my server rpool/work/jumpstart is an ZFS dataset


# zfs list rpool/work/jumpstart
NAME                  USED  AVAIL  REFER  MOUNTPOINT
rpool/work/jumpstart  184G   619G   176G  /work/jumpstart


so I just share it by these commands,


zfs set share=name=jumpstart,path=/work/jumpstart,prot=nfs,anon=0,sec=sys,ro=* rpool/work/jumpstart
zfs set sharenfs=on rpool/work/jumpstart

then use 'share' to make sure jumpstart server has been shared correctly,

# share
jumpstart    /work/jumpstart nfs     anon=0,sec=sys,ro
IPC$            smb     -       Remote IPC


You may have to share the directory with other similar commands based on your scenario.


6. to integrate AI and Jumpstart into one server, combine /etc/netboot and /tftpboot as one,


# mkdir -m 755 /etc/netboot
# ln -s /etc/netboot /tftpboot


(this is because of that AI uses /etc/netboot but Jumpstart uses /tftpboot )


7. (optional) in case you wanna jumpstart clients to synchronize time with this server during jumpstart, run these two commands,

svcadm enable time:stream
svcadm enable time:dgram


Jumpstart server has been setup well at this stage. Now we are creating client data for a Jumpstart client, mac address of this client, say, 08:00:27:82:9D:49,


1. add a file /work/jumpstart/config/sysidcfg/08:00:27:82:9D:49/my-first-project/sysidcfg
   (you can refer to http://docs.oracle.com/cd/E26505_01/html/E28037/preconsysid-55534.html for details of sysidcfg)


# mkdir -p /work/jumpstart/config/sysidcfg/08:00:27:82:9D:49/my-first-project


# cd  mkdir -p /work/jumpstart/config/sysidcfg/08:00:27:82:9D:49/my-first-project


then add a file /work/jumpstart/config/sysidcfg/08:00:27:82:9D:49/my-first-project/sysidcfg



# cat sysidcfg
name_service=NONE
network_interface=PRIMARY {
        dhcp
        protocol_ipv6=no
}
system_locale=C
timezone=Asia/Taipei
root_password=yyPLbpUHu9bRc
security_policy=NONE
nfs4_domain=dynamic
timeserver=localhost
terminal=vt100
auto_reg=none


"timeserver=<ip address>" let Jumpstart client to synchronize time from other server while


"timeserver=localhost" keep this client to use its own time.


root_password contains an encrypted password, you can get such a string from /etc/shadow


2.  put these files profile, rules, begin_script (optional), finish_script (optional) to /work/jumpstart/config/profile/my-first-project
   ( profile you can refer to http://docs.oracle.com/cd/E26505_01/html/E28039/preparecustom-24696.html for more profile configurations)


# mkdir -p /work/jumpstart/config/profile/my-first-project


# cd /work/jumpstart/config/profile/my-first-project


 then add files profile, rules, begin_script, finish_script

# cat profile
install_type    initial_install
cluster         SUNWCXall
locale          C
geo             C_America
geo             N_America
geo             S_America
geo             Ausi
geo             C_Europe
geo             E_Europe
geo             N_Europe
geo             S_Europe
geo             W_Europe
geo             N_Africa
geo             S_Africa
geo             Asia
geo             M_East
system_type     standalone
partitioning    explicit
pool rpool auto auto auto any
package SUNWtcsh


# cat rules


any -   begin_script    profile finish_script


# cat begin_script
#!/bin/sh
echo "begin_script is beginning at `date`"
(do what you want)
echo "begin_script is ending at `date`"


# cat finish_script
#!/bin/sh
echo "finish_script is beginning at `date`"


(do what you want, such as change sshd configuration to allow root ssh login, change root's shell, install recommended patches,..... As root file system is mounted under /a after jumpstart installation is completed but a reboot was not taken place, remember to write scripts to make any modification with files under /a)


echo "finish_script is ending at `date`"


3. go to the profile directory /work/jumpstart/config/profile/my-first-project to run /work/jumpstart/os-image/Install-i386-10-u11_2013.01/Solaris_10/Misc/jumpstart_sample/check

# cd /work/jumpstart/config/profile/my-first-project
# /work/jumpstart/os-image/Install-i386-10-u11_2013.01/Solaris_10/Misc/jumpstart_sample/check
Validating rules...
Validating profile profile...
The custom JumpStart configuration is ok.

You will see a file rules.ok generated from rules.

Be noted: in Solaris 11.1 we need to change the first line of /work/jumpstart/os-image/Install-i386-10-u11_2013.01/Solaris_10/Misc/jumpstart_sample/check from  #!/bin/sh to #!/usr/sunos/bin/sh, but this step is not necessary in Solaris 11.2.


4. run add_install_client to add client information,


for x86 client,


# /work/jumpstart/os-image/Install-i386-10-u11_2013.01/Solaris_10/Tools/add_install_client \
-c 192.168.1.115:/work/jumpstart/config/profile/my-first-script \
-p 192.168.1.115:/work/jumpstart/config/sysidcfg/my-first-script/08:00:27:82:9D:49 \
-d -e 08:00:27:82:9D:49 i86pc


for sparc client,


# /work/jumpstart/os-image/Install-sparc-10-u11_2013.01/Solaris_10/Tools/add_install_client \
-c 192.168.1.115:/work/jumpstart/config/profile/my-frist-script \
-p 192.168.1.115:/work/jumpstart/config/sysidcfg/my-first-script/08:00:27:82:9D:49 \
-d -e 08:00:27:82:9D:49 sun4u
/work/jumpstart is already shared.
However, the zfs file system /work/jumpstart must be shared
read-only with root access.  Use the "zfs set" command to
set the sharenfs property for file system /work/jumpstart as follows:
Use ro and anon=0 for /work/jumpstart.  This must be
fixed and /work/jumpstart shared before 08:00:27:82:9D:49 can boot.
/work/jumpstart is already shared.
However, the zfs file system /work/jumpstart must be shared
read-only with root access.  Use the "zfs set" command to
set the sharenfs property for file system /work/jumpstart as follows:
Use ro and anon=0 for /work/jumpstart.  This must be
fixed and /work/jumpstart shared before 08:00:27:82:9D:49 can boot.

To enable 01080027829D49 in the DHCP server, ensure that
the following Sun vendor-specific options are defined
(SinstNM, SinstIP4, SinstPTH, SrootNM, SrootIP4,
SrootPTH, and optionally SbootURI, SjumpCF and SsysidCF),
and add a macro to the server named 01080027829D49,
containing the following option values:

  Install server      (SinstNM)  : toshiba-vbox
  Install server IP   (SinstIP4) : 127.0.0.1
  Install server path (SinstPTH) : /work/jumpstart/os-image/Install-sparc-10-u11_2013.01
  Root server name    (SrootNM)  : toshiba-vbox
  Root server IP      (SrootIP4) : 127.0.0.1
  Root server path    (SrootPTH) : /work/jumpstart/os-image/Install-sparc-10-u11_2013.01/Solaris_10/Tools/Boot
  Boot file           (BootFile) : 01080027829D49
  Profile location    (SjumpsCF) : 192.168.1.115:/work/jumpstart/config/profile/my-frist-script
  sysidcfg location   (SsysidCF) : 192.168.1.115:/work/jumpstart/config/sysidcfg/my-first-script/08:00:27:82:9D:49






What's the difference between x86 and sparc clients?



  • you can NOT run add_install_client from Sparc directory for an x86 client and vice versa.

  • the last argument of i386 client is "i86pc" but that of sparc client may be "sun4u", "sun4us" or "sun4v", based on the type of your sparc client.




5. add the following lines to /etc/inet/dhcpd4.conf (make sure no duplication of this MAC address)


for x86 client,


host 080027829D49 {
    hardware ethernet 08:00:27:82:9D:49;
    filename "01080027829D49";
}


for Sparc client (refer to the add_install_client output),


host 080027829D49 {
    hardware ethernet 08:00:27:82:9D:49;
    filename "01080027829D49";

    option SUNW.SinstNM "192.168.1.115";
    option SUNW.SinstIP4 192.168.1.115;
    option SUNW.SinstPTH "/work/jumpstart/os-image/Install-sparc-10-u11_2013.01";
    option SUNW.SrootNM "192.168.1.115";
    option SUNW.SrootIP4 192.168.1.115;
    option SUNW.SrootPTH "/work/jumpstart/os-image/Install-sparc-10-u11_2013.01/Solaris_10/Tools/Boot";
    option SUNW.SjumpsCF "192.168.1.115:/work/jumpstart/config/profile/my-first-project";
    option SUNW.SsysidCF "192.168.1.115:/work/jumpstart/config/sysidcfg/my-first-project/08:00:27:82:9D:49";

}


then refresh DHCP service by


svcadm refresh dhcp/server:ipv4


6. (for x86 client only) edit the file /tftpboot/menu.lst.01080027829D49

change
        kernel$ /I86PC.Solaris_10-1/multiboot kernel/$ISADIR/unix -B

to
        kernel$ /I86PC.Solaris_10-1/multiboot kernel/$ISADIR/unix - install dhcp nowin -B


7. boot up this client,

try "boot net:dhcp - install" under ok prompt for Sparc client

and for x86 client, just boot it from network (PXE boot) 


Viewing all articles
Browse latest Browse all 19780

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>