#!/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
时间: 2024-11-05 14:59:21