ubuntu配置靜態ip

2021-08-07 04:33:09 字數 899 閱讀 7500

一.配置靜態ip的意義:

檢視本地ip,注意配置的ip必須和本機的ip在同乙個網段,如本機是192.168.1.103,那麼ubuntu可以配置為192.168.1.104.(虛擬機器選用橋接模式);

配置靜態ip:sudo /etc/network/inte***ces

在原檔案 auto lo

iface lo inet loopback

後面追加:

auto eth0

iface eth0 inet static

address 192.168.1.103(與虛擬機器的物理機在同一網段)

gateway 192.168.1.1

netmask 255.255.255.0

儲存後退出(network,broadcast 可以不設定)

配置dns:sudo /etc/resolv.conf

nameserver 202.98.192.67

nameserver 8.8.8.8

(不知道dns改寫那個ip的,可以查詢本機的dns設定就好,ipconfig /all)

注意:重啟ubuntu後發現又不能上網了,問題出在/etc/resolv.conf。重啟後,此檔案配置的dns又被自動修改為預設值。所以需要永久性修改dns。方法如下:

vim /etc/resolvconf/resolv.conf.d/base

nameserver 202.98.192.67

nameserver 8.8.8.8

生成配置,重啟網絡卡

sudo /etc/init.d/networking restart

sudo ifconfig eth0 down

sudo ifconfig eth0 up

Ubuntu配置靜態IP

在ubuntu上設定ip的方法和centos上有所不同,主要有兩種 直接用命令改,暫時性方案 sudo ifconfig eth0 192.168.150.137 netmask 255.255.255.0一勞永逸的方法,就是修改 etc network inte ces 修改eth0的位址,如下 ...

ubuntu配置靜態IP位址

我本人使用的linux為深度的發行版,其核心仍然是ubuntu,並且我的使用環境是vmware中。其靜態ip配置如下 1.首先sudo vim etc network inte ces 2.然後輸入如下內容 auto lo iface lo inet loopback 前兩行是系統自帶的。auto ...

Ubuntu靜態IP簡單配置

1.編輯檔案 etc network inte ces 加入以下內容 the primary network inte ce auto eth0 iface eth0 inet static address 192.168.1.22 填入更改的ip位址 gateway 192.168.1.1 net...