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

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

ubuntu與centos中更換ip的shell代碼

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

代碼一
ubuntu與centos

復制代碼 代碼如下:

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代碼,自己寫的,比較拙,請指正
復制代碼 代碼如下:

#! /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 靜態IP地址設置(NAT方式)
  • 詳解ubuntu14.04如何設置靜態IP的方法
  • ubuntu 設置靜態IP的實現方法
  • 基于Ubuntu 16.04設置固定IP的方法教程

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

巨人網絡通訊聲明:本文標題《ubuntu與centos中更換ip的shell代碼》,本文關鍵詞  ubuntu,與,centos,中,更換,的,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《ubuntu與centos中更換ip的shell代碼》相關的同類信息!
  • 本頁收集關于ubuntu與centos中更換ip的shell代碼的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 巴南区| 汉沽区| 繁昌县| 安乡县| 稷山县| 灵宝市| 万盛区| 吉林市| 吐鲁番市| 富阳市| 庄河市| 东源县| 志丹县| 宁夏| 册亨县| 天全县| 高尔夫| 津南区| 浮山县| 柳江县| 渑池县| 类乌齐县| 浦江县| 古浪县| 滕州市| 晴隆县| 罗平县| 淳化县| 定兴县| 兴仁县| 东方市| 泰和县| 天台县| 汉川市| 年辖:市辖区| 禄劝| 惠东县| 武清区| 常熟市| 利辛县| 太仆寺旗|