最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

ubuntu與centos中更換ip的shell代碼

 更新時(shí)間:2013年02月24日 11:16:19   作者:  
ubuntu與centos中更換ip的shell代碼,需要的朋友可以參考下

代碼一
ubuntu與centos

復(fù)制代碼 代碼如下:

ubuntu:
#!/bin/bash
echo "ipaddr:"
read line
echo $line
sed "s/address.*$/address=${line}/g" /etc/network/interfaces
centos(未測(cè)試):
#!/bin/bash
echo "ipaddr:"
read line
echo $line
sed "s/IPADDR.*$/IPADDR=${line}/g" /etc/sysconfig/network-scipts/ifcfg-eth0

代碼二
ubuntu更改IP的shell代碼,自己寫的,比較拙,請(qǐng)指正
復(fù)制代碼 代碼如下:

#! /bin/sh

echo "Use gateway at 192.168.0.1 (Y) or 192.168.1.1 (N)
or detail set (O)\nPlease choose Y/N/O"
read OP
if [ "$OP" = Y ] || [ "$OP" = y ] ; then
 GATEWAY=192.168.0.1
 IP=192.168.0.215
elif [ "$OP" = N ] || [ "$OP" = n ] ; then
 GATEWAY=192.168.1.1
 IP=192.168.1.215
else
 echo "Please input the ip:"
 read IP
 echo "Please input the gateway"
 read GATEWAY
fi
echo "auto lo
iface lo inet static

auto eth0
iface eth0 inet static
netmask 255.255.255.0
address $IP
gateway $GATEWAY" > /tmp/interfaces
clear
echo "Init File interfaces Successfully!"
echo "*************************************"
cat /tmp/interfaces
echo "*************************************"
echo "Change the file in /etc/networks/interfaces?(Y/N)"
read OP
if [ "$OP" = Y ] || [ "$OP" = y ] ; then
 echo "Set OK!"
 cp /tmp/interfaces /etc/network/interfaces
 /etc/init.d/networking restart
else
 echo "Give up"
fi
rm /tmp/interfaces
echo "Whether change the DNS(/etc/resolv.conf)(Y/N)"
read OP
if [ "$OP" = Y ] || [ "$OP" = y ];then
 echo "Input the DNS server IP:"
 read IP
 echo "Now change the DNS IP"
 mv /etc/resolv.conf /etc/resolv.conf.bak
 echo "nameserver $IP" >/etc/resolv.conf
 echo "Done!"
fi

相關(guān)文章

最新評(píng)論

江门市| 郑州市| 冷水江市| 阳泉市| 卓尼县| 右玉县| 柞水县| 阿拉尔市| 错那县| 卓尼县| 嘉善县| 灌南县| 元江| 望都县| 蓬安县| 双桥区| 建湖县| 淮滨县| 荥阳市| 远安县| 武平县| 丹江口市| 巴里| 叙永县| 丘北县| 金坛市| 南皮县| 镇沅| 宁强县| 葵青区| 深水埗区| 军事| 汝阳县| 凤庆县| 伊通| 江川县| 嘉定区| 麟游县| 麟游县| 嘉荫县| 壤塘县|