The company I work for seems to hire installers that think setting up SCO UNIX servers as DHCP Hosts is a great idea ( thus they are installers and not technicians !!!!)
So I wrote this to help discover what IP addresses from the defined DHCP Pool are active at the time the script is run.
I am sending this to basically give back to the group as you have helped me countless times!
#!/bin/ksh
#Script to discover devices using DHCP addresses as assigned by SCO UNIX DHCP Host
#
B=`more /etc/dhcpd.conf | grep "subnet" | nawk '{ print $2 }' | nawk -F . '{ print $1"."$2"."$3 }'`
s=`more /etc/aasd.conf | grep "${B}" | nawk -F . '{print $1"."$2"."$3 }'`
i=`more /etc/aasd.conf | grep "${B}" | nawk -F . '{print $4}'| nawk -F - '{ print $1 }'`
e=`more /etc/aasd.conf | grep "${B}" | nawk -F - '{print $2}'| nawk -F . '{ print $4 }'`
#
#B=Base IP Subnet Used By DHCP as Defined in /etc/dhcpd.conf
#s=First 3 Octets of Base IP as definded in /etc/aasd.conf
#i=Initial Device Octet as defined in /etc/aasd.conf
#e=Ending Device Octet as defined in /etc/aasd.conf
#
#
#Prepares output file /tmp/addys.out for writing
if [ -f /tmp/addys.out ]; then
rm /tmp/addys.out
else
touch /tmp/addys.out
chmod 777 /tmp/addys.out
fi
#
#Pings DHCP Scope to see whose active
#
while [[ ${i} -lt ${e} ]]
do
ping -c 3 ${s}.${i} >> /tmp/addys.out
i=`expr ${i} + 1 `
done
So I wrote this to help discover what IP addresses from the defined DHCP Pool are active at the time the script is run.
I am sending this to basically give back to the group as you have helped me countless times!
#!/bin/ksh
#Script to discover devices using DHCP addresses as assigned by SCO UNIX DHCP Host
#
B=`more /etc/dhcpd.conf | grep "subnet" | nawk '{ print $2 }' | nawk -F . '{ print $1"."$2"."$3 }'`
s=`more /etc/aasd.conf | grep "${B}" | nawk -F . '{print $1"."$2"."$3 }'`
i=`more /etc/aasd.conf | grep "${B}" | nawk -F . '{print $4}'| nawk -F - '{ print $1 }'`
e=`more /etc/aasd.conf | grep "${B}" | nawk -F - '{print $2}'| nawk -F . '{ print $4 }'`
#
#B=Base IP Subnet Used By DHCP as Defined in /etc/dhcpd.conf
#s=First 3 Octets of Base IP as definded in /etc/aasd.conf
#i=Initial Device Octet as defined in /etc/aasd.conf
#e=Ending Device Octet as defined in /etc/aasd.conf
#
#
#Prepares output file /tmp/addys.out for writing
if [ -f /tmp/addys.out ]; then
rm /tmp/addys.out
else
touch /tmp/addys.out
chmod 777 /tmp/addys.out
fi
#
#Pings DHCP Scope to see whose active
#
while [[ ${i} -lt ${e} ]]
do
ping -c 3 ${s}.${i} >> /tmp/addys.out
i=`expr ${i} + 1 `
done