Rpm-q DHCP &>/dev/null
If [$?-ne 0]
Then
Yum-y Install DHCP
echo "
Ddns-update-style Interim;
Ignore client-updates;
Option Domain-name-servers 192.168.1.1;
Default-lease-time 21600;
Max-lease-time 43200;
">/etc/dhcpd.conf
Fi
While True
Do
Read-p "Please input network:" Network
grep $network/etc/dhcpd.conf &>/dev/null
If [$?-eq 0];then
Read-p "continue to do? (yes/no) "yn
if [$yn = yes];then
Continue
Else
Break
Fi
Fi
Read-p "Please input gateway:" Gateway
Read-p "Please input netmask:" Netmask
Read-p "Please input start_ip:" Start_ip
Read-p "Please input end_ip:" End_ip
Read-p "Is you sure?" (yes/no) "yn
if [$yn! = yes];then
Continue
Fi
echo "
Subnet $network netmask $netmask {
option routers $gateway;
Option Subnet-mask $netmask;
Range DYNAMIC-BOOTP $start _ip $end _ip;
}
">>/etc/dhcpd.conf
Read-p "Contine to do? (yes/no) "yn
if [$yn = no];then
Break
Fi
Done
Service DHCPD Restart
Configuration of DHCP for shell scripts