Linux自动修改IP脚本(手动编写)

时间:2014-05-08 12:59:48   收藏:0   阅读:318

#!/bin/bash
netmask=255.255.255.0
IP_PATH=/etc/sysconfig/network-scripts/ifcfg-eth0
GM_PATH=/etc/sysconfig/network
echo -e "Please input IP(FORMAT:192.168.46.88):\c"
read ip
echo -e "Please input GateWay(FORMAT:192.168.46.1):\c"
read gateway
#change ipaddress
echo "DEVICE=eth0">$IP_PATH
echo "BOOTPROTO=static">>$IP_PATH
echo "IPADDR=$ip">>$IP_PATH
echo "NETMASK=255.255.255.0">>$IP_PATH
echo "GATEWAY=$gateway">>$IP_PATH
echo "ONBOOT=yes">>$IP_PATH
/etc/init.d/network restart

 

Linux自动修改IP脚本(手动编写),布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!