S18dhcp

Synopsys


#
# DHCP config
#

Script


echo "%Post: Configuring DHCPd"

cat > /etc/dhcpd.sunw <<EOF
       # Solaris Workstations
       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;
EOF

net=`echo $HOSTIP | cut -d"." -f1,2,3`

cat > /etc/dhcpd.conf <<EOF
log-facility local1;
ddns-update-style ad-hoc;
ignore client-updates;

include "/etc/dhcpd.failover";

include "/etc/dhcpd.sunw";

subnet $NETWORK netmask 255.255.255.0 {

	option domain-name		"$DOMAINNAME";
	option subnet-mask		$NETMASK;
	option domain-name-servers	$net.100;
	option routers			$net.1;
        use-host-decl-names		on;
	default-lease-time		900;          # 15 mins
	max-lease-time			1800;         # 30 mins
	# Small dynamic pool (dynamic01 - dynamic 30 in dns)
	range				$net.201 $net.230;

group {
	next-server			$net.100;
	filename			"/pxelinux.0";

	# Linux servers - these PXE boot by default
	
#	host itx-rack {
#                       hardware ethernet 00:40:63:C4:6C:03;
#                       fixed-address     172.16.0.50;
#                      }

} # end of Linux boxes

group {
	# Devices
#        host switch {
#                      hardware ethernet 00:01:42:46:a0:c0;
#                      fixed-address   172.16.0.5;
#                    }

} # end of devices group

#group {
        #option netbios-name-servers 	192.168.0.1;
        #option netbios-dd-server 	192.168.0.1;
        #option netbios-node-type 	8;
        #option netbios-scope 		"";

	# Windows servers are given details of the WINS (samba) server

	#host windowsserver {
	#  hardware ethernet 12:34:56:BC:DE:F1;
	#  fixed-address 123.123.123.160;
	#}
#}

group {
       filename    "pxeboot/Solaris/inetboot";
       next-server $net.100;
       class "solaris-sun4u" {
       match if substring (option vendor-class-identifier, 0, 4) = "SUNW";
       vendor-option-space SUNW;
       option SUNW.root-server-ip-address 		$net.100;
       option SUNW.root-server-hostname 		"watts";
       option SUNW.root-path-name 
       # This is the location of the root file system for network boot
       # It should point at the <os-version>/Tools/Boot directory under the
       # jumpstart tree 
       "/export/solaris/install/Solaris_9/Tools/Boot";
       #"/export/solaris/install/Solaris_10/Tools/Boot";
       option SUNW.boot-file-path
       # This is the name of the kernel. 
       # It points to a location in the root-path-name
          "/platform/sun4u/kernel/sparcv9/unix";
       option SUNW.install-server-hostname 		"watts";
       option SUNW.install-server-ip-address 		$net.100;
       option SUNW.install-path 
       # This should point to the top of the jumpstart tree
       # The best way to identify this is that it will contain a hidden
       # file called ".cdtoc", which is the table of contents for the tree
         "/export/solaris/install";
         #"/solaris/install";
       option SUNW.sysid-config-file-server
          "$net.100:/solaris/jumpstart/sysidcfg/Solaris_9";
          #"$net.100:/solaris/jumpstart/sysidcfg/Solaris_10";
       option SUNW.JumpStart-server
          "$net.100:/solaris/jumpstart";
       option SUNW.terminal-name "xterm";
       } # end of solaris-sun4u class

#	host netra  {
#		     # Sun 4u Netra t105 with 512Mb and 9Gb Diks
#                     hardware ethernet 08:00:20:b2:c3:31;
#		     fixed-address     172.16.0.120;
#		    }
     } # end of the Sun kit

} # end of the subnet?

EOF

SRV=`host -t SRV _dhcp._tcp.$DOMAINNAME | grep $NODENAME\.`
if [ "$OS" == "fc4" ]; then
    PRIORITY=`echo $SRV | cut -d" " -f5`
else
    PRIORITY=`echo $SRV | cut -d" " -f3`
fi

if [ "$PRIORITY" == "5" ]; then
   cat > /etc/dhcpd.failover <<EOF
failover peer "dhcp" { 
  primary; 
  address dhcp1.$DOMAINNAME;
  port 33; 
  peer address dhcp2.$DOMAINNAME;
  peer port 34; 
  max-response-delay 60;
  max-unacked-updates 10;
  mclt 600;
  split 128;
  load balance max seconds 3;
}
EOF
elif [ "$PRIORITY" == "10" ]; then
   cat > /etc/dhcpd.failover <<EOF
failover peer "dhcp" { 
  secondary;
  address dhcp2.$DOMAINNAME;
  port 34;
  peer address dhcp1.$DOMAINNAME;
  peer port 33;
  max-response-delay 60;
  max-unacked-updates 10;
}
EOF
else
   touch /etc/dhcpd.failover
fi

# edit dhcp logging location => /var/log/dhcp

# enable logrotation in S03logrotate.sh


Examples and Testing





Marked up in XHTML - ©2005 Thoughtful Solutions Ltd.