#!/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
原文地址:http://www.cnblogs.com/jinjiangongzuoshi/p/3714112.html