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
评论(0)