shell脚本之dhcp的配置
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 "Are 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
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。