Ubuntu10.04網路問題解決記錄 以前的虛擬機器環境,由於時間長了網路設定變化導致現在上不網,現把解決過程記錄如下: 前提: 本機window7:Ip為192.168.1.5;網關為192.168.1.1; 虛擬機器通過Bridge與本機進行橋接上網。 過程:1、建立Bridge橋接配置: Edit -> Virtual network editor, 添加一個Bridged類型的網路或直接修改其中一個為Bridged類型,並在Bridged to位置選擇本機使用的網卡;確定退出。 2、設定虛擬系統的網路為Bridged: 通過VM -> Settings -> hardware -> Network adapter中,選擇network connection類型中的Bridged;確定退出。 3、啟動虛擬機器,通過命令ifconfig 查看現在啟動的網路裝置及其配置 如有裝置如下,則跳過第4、5步,直接進行第6步配置網路ip和網關就行。 eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx inet6 addr: xxxx:xxxx:xxxx:xxxx:xxxx/64 Scope:Link ...lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Hos ...如 只能看到一個lo項(如下),則按照第4步用ifconfig -a繼續查看本機有的網卡裝置 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Hos ...4、通過ifconfig -a命令 可以查看所有網卡裝置即使沒有啟動;如下 eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx inet6 addr: xxxx:xxxx:xxxx:xxxx:xxxx/64 Scope:Link ...lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Hos5、通過命令vi /etc/network/interfaces修改網路設定auto eth0iface eth0 inet dhcp把自動設定ip改成如下,其中#後為注釋項auto eth0iface eth0 inet staticaddress 192.168.1.10gateway 192.168.1.1netmask 255.255.255.0#nameserver 8.8.8.8nameserver 8.8.8.8#這裡是DNS網域名稱,具體情況其ip不一樣。#network 192.168.1.0#broadcast 192.168.1.2556、通過vi /etc/resolv.conf命令修改DNS配置nameserver 8.8.8.8#保持與上面的nameserver配置一致domain localdomainsearch localdomain7、重啟網卡裝置 用命令/etc/init.d/networking restart重啟網卡裝置。8、用命令reboot重啟虛擬機器系統 重啟後用ifconfig命令查看下,網路設定已經配好且可以上網了。如果沒有用命令ifconfig eth0 up/down 啟動/關閉網卡 eth0試下。 (1)/etc/network/interfaces 這個檔案中可以進行IP/掩碼/預設閘道的配置 (2)/etc/resolv.conf 這個檔案包含DNS網域名稱解析的伺服器位址 (3)/etc/init.d/networking 這個檔案可以重新啟動網卡的配置 /etc/init.d/networking restart具體使用到的命令主要有如下命令: (1)ifconfig -------查看網卡資訊 (2)ifconfig eth0 up/down 啟動/關閉網卡 eth0 (3)ifconfig eth0 125.0.0.0 netmask 255.0.0.0 -----配置網卡IP地址 (4)route add default gw 192.168.1.1 -------配置預設路由 (5)/etc/init.d/networking restart 重啟網路設定