ubuntu中網(wǎng)卡的設(shè)置可以通過/etc/network/interfaces文件來進(jìn)行, 具體可分為三種不同的配置方式:DHCP自動獲取、靜態(tài)分配IP地址和PPPoE寬帶撥號。 具體設(shè)置如下: 在進(jìn)行配置之前,首先進(jìn)入/etc/network目錄中,編輯interfaces文件: 1.網(wǎng)卡通過DHCP自動獲取IP地址 (適用于通過路由器上網(wǎng)的方式) # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # # The loopback network interface(配置環(huán)回口) # 開機(jī)自動激lo接口 auto lo # 配置lo接口為環(huán)回口 iface lo inet loopback # # The primary network interface (配置主網(wǎng)絡(luò)接口) #開機(jī)自動激活eth0接口 auto eth0 #配置eth0接口為DHCP自動獲取 iface eth0 inet dhcp 2.網(wǎng)卡靜態(tài)分配IP地址 # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # # The loopback network interface(配置環(huán)回口) # 開機(jī)自動激lo接口 auto lo # 配置lo接口為環(huán)回口 iface lo inet loopback # # The primary network interface (配置主網(wǎng)絡(luò)接口) #開機(jī)自動激活eth0接口 auto eth0 #配置eth0接口為靜態(tài)設(shè)置IP地址 iface eth0 inet static address 10.16.3.99 netmask 255.255.255.0 network 10.16.3.0 broadcast 10.16.3.255 gateway 10.16.3.1 # dns-* options are implemented by the resolvconf package, if installed(DNS設(shè)置) dns-nameservers 61.153.177.196 61.153.177.197 dns-search fireteam.org 3.網(wǎng)卡進(jìn)行PPPoE寬帶撥號配置 (適用于通過貓撥號上網(wǎng)方式) # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # # The loopback network interface(配置環(huán)回口) # 開機(jī)自動激lo接口 auto lo # 配置lo接口為環(huán)回口 iface lo inet loopback # # The primary network interface (配置主網(wǎng)絡(luò)接口) #開機(jī)自動激活eth0接口 auto eth0 #配置eth0接口為靜態(tài)設(shè)置IP地址 iface eth0 inet static address 10.16.3.99 netmask 255.255.255.0 network 10.16.3.0 broadcast 10.16.3.255 配置完畢后,重啟計算機(jī)或網(wǎng)絡(luò)服務(wù)即可將網(wǎng)卡配好。重啟網(wǎng)絡(luò)服務(wù)命令為: sudo /etc/init.d/networking restart |
|