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
网页URL:http://scjbc.cn/article/piocgj.html