ubuntu網路設定

2021-08-08 02:48:07 字數 990 閱讀 8520

pip install 總是出現pip connection failure: cannot fetch index base url 造成安裝不了軟體包,真的很頭疼。。。。

找了一圈問題,發現連eth0網絡卡都沒有,網路根本就不連通,**也上不了

問題一. ifconfig之後只顯示lo,沒有看到eth0

問題二. ifconfig之後顯示eth0,但是沒有顯示靜態ip位址,即無inet、位址、廣播、掩碼。

問題一:ifconfig之後只顯示lo,沒有看到eth0 ?

eth0設定不正確,導致無法正常啟動,修改eth0配置檔案就好

ubuntu 12.04的網路設定檔案是/etc/network/inte***ces,開啟檔案,會看到

auto lo

iface lo inet loopback

這邊的設定是本地迴路。在後面加上

auto eth0

iface eth0 inet static

address 192.168.1.230 //(ip位址)

netmask 255.255.255.0 //(子網掩碼)

gateway 192.168.1.1 //(閘道器)

其中eth0就是電腦的網絡卡,如果電腦有多塊網絡卡,比如還會有eth1,都可以在這裡進行設定。iface eth0 inet 設定為dhcp是動態獲取ip,設定為static則用自定義的ip。

一般就設定成iface eth0 inet dhcp(推薦)

auto lo 

iface lo inet loopback

auto eth0

iface eth0 inet dhcp

然後輸入命令列:ifconfig eth0 up #開啟eth0

先用sudo dhclient eth0更新ip位址

然後執行sudo ifconfig eth0

3.reboot

ubuntu網路設定

主要檔案 etc network inte ces,這裡是ip 閘道器 掩碼等的一些配置 etc resolv.conf這個檔案儲存dns的有關資訊 主要命令 sudo etc init.d networking restart重啟網路,使配置檔案的配置生效 通過配置檔案配置 1 配置ip閘道器 s...

ubuntu網路設定

a,ubuntu系列網路配置資訊儲存在 etc network inte ces中 b,dns資訊儲存在 ect resolv.conf中.note 如果只是臨時性的改變ip位址,則不用修改inte ces檔案,只用ifconfig即可,不過當系統重啟後,系統會恢復inte ces中的配置.ifco...

ubuntu 設定網路

1.以dhcp方式配置網絡卡 編輯檔案 etc network inte ces sudo vi etc network inte ces 並用下面的行來替換有關eth0的行 the primary network inte ce use dhcp to find our address auto ...