#!/bin/bash
#dhcp-script
read -p "请输入本机ip地址: " IP
IPNET=$(echo $IP |awk -F. '{print $1"."$2"."$3}')
IPD="/etc/sysconfig/network-scripts/ifcfg-eth0"
sed -i 's/IPADDR=.*/IPADDR='"$IP"'/' $IPD
sed -i 's/GATEWAY=.*/GATEWAY='"$IPNET"'.1/' $IPD
service network restart &> /dev/null
rpm -q dhcp &> /dev/null
[ $? -eq 0 ] || yum -y install dhcp &> /dev/null
cd /usr/share/doc/dhcp-3.0.5
grep -v "#" dhcpd.conf.sample |grep -v "^$"|sed -e 's/192.168.0/'"$IPNET"'/g' > /etc/dhcpd.conf
service dhcpd start
yanglong985 于 2012-08-12 10:29:30发表:
很好
lanlinux2012 于 2012-07-27 09:10:01发表:
学习下
浣熊daddy 于 2012-07-09 13:39:48发表:
改一下脚本,在ubuntu上用
相思爱文 于 2012-06-23 21:01:53发表:
楼主的好名字
iopto 于 2012-06-23 08:56:04发表:
学习了