MAC=`ifconfig $1 | sed -n -e '/.*HWaddr \([:[:xdigit:]\-]*\).*/{s//\1/;p}'`
ifconfig $1 $2
echo "DEVICE = $1" >/etc/sysconfig/network-scripts/ifcfg-$1
echo "HWADDR = $MAC" >>/etc/sysconfig/network-scripts/ifcfg-$1
echo "BOOTPROTO=static" >>/etc/sysconfig/network-scripts/ifcfg-$1
echo "IPADDR=$2" >>/etc/sysconfig/network-scripts/ifcfg-$1
echo "NETMASK=$3" >>/etc/sysconfig/network-scripts/ifcfg-$1
echo "BROADCAST=$4" >>/etc/sysconfig/network-scripts/ifcfg-$1
echo "GATEWAY=$5" >>/etc/sysconfig/network-scripts/ifcfg-$1
阅读(1389) | 评论(0) | 转发(0) |