婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > ubuntu與centos中更換ip的shell代碼

ubuntu與centos中更換ip的shell代碼

熱門標簽:昆明電話外呼系統(tǒng)好么 電話機器人每天搜索多少次 艾比利外呼系統(tǒng) 衡水外呼線路解決 免費門店地圖標注注冊入駐 陜西便宜電銷機器人軟件 外呼系統(tǒng)一天耗費多少流量 海口智能語音電銷機器人好用嗎 杞縣地圖標注app

代碼一
ubuntu與centos

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

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

代碼二
ubuntu更改IP的shell代碼,自己寫的,比較拙,請指正
復(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

您可能感興趣的文章:
  • Ubuntu16.04 靜態(tài)IP地址設(shè)置(NAT方式)
  • 詳解ubuntu14.04如何設(shè)置靜態(tài)IP的方法
  • ubuntu 設(shè)置靜態(tài)IP的實現(xiàn)方法
  • 基于Ubuntu 16.04設(shè)置固定IP的方法教程

標簽:昌都 營口 南京 臨滄 海口 宿遷 泰安 西寧

巨人網(wǎng)絡(luò)通訊聲明:本文標題《ubuntu與centos中更換ip的shell代碼》,本文關(guān)鍵詞  ubuntu,與,centos,中,更換,的,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《ubuntu與centos中更換ip的shell代碼》相關(guān)的同類信息!
  • 本頁收集關(guān)于ubuntu與centos中更換ip的shell代碼的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 板桥市| 吴忠市| 垫江县| 云龙县| 报价| 双江| 克拉玛依市| 建昌县| 汶上县| 安阳县| 平罗县| 桂林市| 丁青县| 关岭| 新津县| 汉寿县| 奉新县| 苏尼特右旗| 宁化县| 太谷县| 越西县| 六安市| 义乌市| 岑巩县| 鄂托克前旗| 乾安县| 轮台县| 旌德县| 汾西县| 蒲江县| 尉氏县| 应用必备| 延边| 灵璧县| 安岳县| 和平区| 博湖县| 敦煌市| 东城区| 丰城市| 开封县|