Ubuntu中設定靜態IP和DNS

2021-08-01 11:27:32 字數 840 閱讀 8448

vmware 中使用nat網路,對虛擬機器設定靜態ip:

在ubuntu中設定靜態ip共兩步:1>設定ip;2>設定dns

1>設定ip

sudo vi /etc/network/inte***ces

auto eth0                               //eth0可替換為當前網絡卡,網絡卡名可通過ifconfig檢視

iface eth0 inet static 

//  指定為靜態ip

address 192.168.239.20 

//  ip位址

netmask 255.255.255.0 

//  子網掩碼

gateway 192.168.239.2 

//  閘道器

配置好後,重啟網路

sudo /etc/init.d/networking restart

#有些文件裡有配置網路號和廣播位址,這裡不配置也沒關係

2>設定dns

在/etc/resolvconf/resolv.conf.d/目錄下新建乙個tail檔案

sudo vi /etc/resolvconf/resolv.conf.d/tail

nameserver 223.5.5.5 

// dns的ip,這裡選用兩個阿里巴巴公用的dns伺服器

nameserver 223.6.6.6 

#儲存即可

#直接在/etc/resolv.conf檔案中新增dns,重啟後,檔案會被重寫,原來配置的dns會消失,所以我們在/etc/resolvconf/resolv.conf.d/目錄下新建乙個tail檔案,填寫需要的dns伺服器便可解決此問題

Ubuntu中設定靜態IP和DNS

ubuntu中設定靜態ip和dns holly vmware 中使用nat網路,對虛擬機器設定靜態ip 在ubuntu中設定靜態ip共兩步 1 設定ip 2 設定dns 1 設定ip sudo vi etc network inte ce auto eth0 iface eth0 inet stat...

ubuntu設定靜態ip

ubuntu10.04設定靜態ip 2010 12 20 09 39 step1 設定ip vi etc network inte ces 檔案內容修改為 auto eth0 iface eth0 inet static address 192.168.1.2 gateway 192.168.1.1...

ubuntu設定靜態ip

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