Ubuntu網(wǎng)絡(luò)配置靜態(tài)IP與hostname使用命令
Ubuntu網(wǎng)絡(luò)配置的常用系統(tǒng),于是我學(xué)習(xí)研究了Ubuntu網(wǎng)絡(luò)配置,在這里對(duì)大家詳細(xì)介紹下Ubuntu網(wǎng)絡(luò)配置應(yīng)用,希望對(duì)大家有用Ubuntu網(wǎng)絡(luò)配置包含了非常好的翻譯和容易使用的架構(gòu).為網(wǎng)卡配置DHCP地址:如果你想配置DHCP地址,你需要編輯/etc/network/interfaces,并輸入以下幾行(假設(shè)你的網(wǎng)卡是eth0):sudo vi /etc/network/interfaces
# The primary network interface - use DHCP to find our address
auto eth0
iface eth0 inet dhcp   //指定為dhcp
在輸入這幾行后,你需要通過(guò)以下命令重新啟動(dòng)你的網(wǎng)絡(luò)設(shè)備:sudo /etc/init.d/networking restart
為網(wǎng)卡配置靜態(tài)IP
如果你想配置靜態(tài)IP地址,你需要編輯/etc/network/interfaces,并輸入以下幾行(假設(shè)你的網(wǎng)卡是eth0):sudo vi /etc/network/interfaces
# The primary network interface
auto eth0
iface eth0 inet static   //指定為static
address 192.168.3.90   //IP地址
gateway 192.168.3.1   //網(wǎng)關(guān)
netmask 255.255.255.0   //子網(wǎng)掩碼
network 192.168.3.0   //這個(gè)……網(wǎng)絡(luò)?
broadcast 192.168.3.255   //廣播
在輸入這幾行后,你需要通過(guò)以下命令重新啟動(dòng)你的網(wǎng)絡(luò)設(shè)備:sudo /etc/init.d/networking restart
設(shè)置第二個(gè)IP地址或虛擬IP如果你是一個(gè)服務(wù)器管理員或者只是普通用戶(hù),有時(shí)你需要為系統(tǒng)指派第二個(gè)IP,那么你可以這樣做,同樣編輯/etc/network/interfaces文件(假設(shè)你的網(wǎng)卡是eth0):
- sudo vi /etc/network/interfaces
 - auto eth0:1
 - iface eth0:1 inet static
 - address 192.168.1.60
 - netmask 255.255.255.0
 - network x.x.x.x
 - broadcast x.x.x.x
 - gateway x.x.x.x
 
在輸入這幾行后,你需要通過(guò)以下命令重新啟動(dòng)你的網(wǎng)絡(luò)設(shè)備:sudo /etc/init.d/networking restart
設(shè)置Ubuntu網(wǎng)絡(luò)配置系統(tǒng)的hostname使用以下命令格式來(lái)改系統(tǒng)的hostname,或者直接編輯/etc/hostname sudo hostname newname
設(shè)置DNS
- sudo vi /etc/resolv.conf
 - enter the following details
 - search test.com
 - nameserver 192.168.3.2
 
以上介紹Ubuntu網(wǎng)絡(luò)配置。
【編輯推薦】















 
 
 
 
 
 
 