autochangeipandhostname
#!/bin/sh
成都创新互联专业IDC数据服务器托管提供商,专业提供成都服务器托管,服务器租用,南充服务器托管,南充服务器托管,成都多线服务器托管等服务器托管服务。
ETHCONF=/etc/sysconfig/network-scripts/ifcfg-eth0
HOSTS=/etc/hosts
NETWORK=/etc/sysconfig/network
NETMASK=255.255.255.0
###
function Change_ip ()
{
grep "dhcp" $ETHCONF
if [ $? -eq 0 ];then
read -p "Please insert ip Address:" IPADDR
sed -i 's/dhcp/static/g' $ETHCONF
echo -e "IPADDR=$IPADDR\nNETMASK=$NETMASK\nGATEWAY=`echo $IPADDR|awk -F. '{print $1"."$2"."$3}'`.2" >>$ETHCONF
echo "This IP address Change success !"
网页名称:autochangeipandhostname
分享网址:http://azwzsj.com/article/piocgj.html