歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> Ubuntu10.04網絡問題解決記錄

Ubuntu10.04網絡問題解決記錄

日期:2017/3/1 15:32:01   编辑:關於Linux
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:Hos 5、通過命令vi /etc/network/interfaces修改網絡配置 auto eth0 iface eth0 inet dhcp 把自動配置ip改成如下,其中#後為注釋項 auto eth0 iface eth0 inet static address 192.168.1.10 gateway 192.168.1.1 netmask 255.255.255.0 #nameserver 8.8.8.8 nameserver 8.8.8.8#這裡是DNS域名,具體情況其ip不一樣。 #network 192.168.1.0 #broadcast 192.168.1.255 6、通過vi /etc/resolv.conf命令修改DNS配置 nameserver 8.8.8.8#保持與上面的nameserver配置一致 domain localdomain search localdomain 7、重啟網卡設備 用命令/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 重啟網絡配置
Copyright © Linux教程網 All Rights Reserved