#!/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
"bootproto=static">>$ip_path
echo "ipaddr=$ip">>$ip_path
"netmask=255.255.255.0">>$ip_path
"gateway=$gateway">>$ip_path
"onboot=yes">>$ip_path
/etc/init.d/network restart