Ubuntu14 04設定靜態IP

2021-09-24 15:41:58 字數 936 閱讀 8191

第一步:

auto lo

iface lo inet loopback

auto eth0

iface eth0 inet dhcp

以上表示預設使用dhcp分配ip,如果想指定靜態ip,則需要如下的修改

auto lo

iface lo inet loopback

auto eth0

iface eth0 inet static *******定義為靜態ip

address 192.168.2.29 *******所要設定的ip位址

netmask 255.255.255.0 *******子網掩碼

gateway 192.168.2.1 *******閘道器(路由位址)

然後儲存此檔案

第二步:

手動設定dns伺服器

開啟檔案/etc/resolv.conf,設定內容如下

nameserver 192.168.2.1  ******閘道器(同上)

// 202.96.128.86

第三步:

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

開啟檔案/etc/resolvconf/resolv.conf.d/base,寫入一下內容:

nameserver 192.168.2.1

nameserver 202.106.0.20

第四步:

重啟networking服務,使其生效,命令為:

/etc/init.d/networking restart
(親身經歷為:重啟此服務無效,還是重啟系統給力)

Ubuntu1404設定靜態ip

設定固定ip前先檢視系統自動分配的ip所屬網段,通過命令ifconfig檢視。這裡假設看到的是192.168.134網段,那麼你可以設定固定ip為192.168.134.138或192.168.134.139等 auto lo iface lo inet loopback iface eth0 in...

ubuntu14 04設定靜態ip

1.找到檔案並作如下修改 sudo vim etc network inte ces 修改如下部分 auto eth0 iface eth0 inet static address 192.168.0.117 gateway 192.168.0.1 這個位址你要確認下 閘道器是不是這個位址 netm...

ubuntu14 04設定靜態ip

ubuntu14.04設定靜態ip 1.找到檔案並作如下修改 sudo vim etc network inte ces 修改如下部分 auto eth0 iface eth0 inet static address 192.168.0.117 gateway 192.168.0.1 這個位址你要確...