日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

Ubuntu配置和修改IP地址

發布時間:2023/12/13 综合教程 30 生活家
生活随笔 收集整理的這篇文章主要介紹了 Ubuntu配置和修改IP地址 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1、修改配置文件/etc/network/interfaces
root@ubuntu:~#sudo gedit /etc/network/interfaces

添加以下內容:
auto eth0 #設置自動啟動eth0接口
iface eth0 inet static #配置靜態IP
address 192.168.11.88 #IP地址
netmask 255.255.255.0 #子網掩碼
gateway 192.168.11.1 #默認網關

2、修改DNS
sudo gedit /etc/resolve.conf

nameserver 127.0.0.1 #記得加上
nameserver 8.8.8.8#當地dns服務器(用ipconfig /all 查看本地dns,第一個dns是默認的,共有2個dns)

注:#后面的注釋信息不要加進去。

3、重啟網絡,使配置生效
sudo /etc/init.d/networking restart

4、查看ip是否配置成功root@ubuntu:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0c:29:2d:89:40
inet addr:192.168.11.88Bcast:192.168.11.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe2d:8940/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:223 errors:0 dropped:0 overruns:0 frame:0
TX packets:253 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:24219 (24.2 KB) TX bytes:22960 (22.9 KB)
Interrupt:19 Base address:0×2024

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:48 errors:0 dropped:0 overruns:0 frame:0
TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3964 (3.9 KB) TX bytes:3964 (3.9 KB)

root@ubuntu:~#

注:紅字加粗“192.168.11.88”跟上面配置的ip一樣,表示ip配置成功。

如果網絡無法啟動或不穩定,可嘗試如下操作:

gedit /etc/NetworkManager/NetworkManager.conf

managed=false設置成managed=true

Ubuntu的網絡參數保存在文件 /etc/network/interfaces中,默認設置使用dhcp,內容如下:

# The primary network interface

auto eth0

iface eth0 inet dhcp

設置靜態ip的方法如下:

(1)編輯 /etc/network/interfaces

1.1)將dhcp 一行屏蔽

# The primary network interface

auto eth0

#iface eth0 inet dhcp

1.2)添加和靜態ip有關的參數

# The primary network interface

iface eth0 inet static

address 192.168.0.10

netmask 255.255.255.0

gateway 192.168.0.1

(2)編輯 /etc/resolv.conf,設置dns

nameserver 202.96.134.133

nameserver 202.106.0.20

(3)執行下面兩個命令,啟用新設置

$sudo ifdown eth0

$sudo ifup eth0

總結

以上是生活随笔為你收集整理的Ubuntu配置和修改IP地址的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。