ubuntu連有線網 無法連接外網


問題:連上網線后,有ip,但是無法訪問外網。

我的解決方案是:

1.通過命令行ifconfig命令查看以太網(即網線插口)的名稱,如下圖,'enp3s0'是網線插口(Ethernet以太網):

zhuml@zhuml-Latitude-3350:~$ ifconfig  
enp3s0    Link encap:Ethernet  HWaddr 14:18:77:a5:24:3d    
          inet addr:10.58.101.247  Bcast:10.58.103.255  Mask:255.255.252.0  
          inet6 addr: fe80::2883:9232:3f1e:fe3/64 Scope:Link  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1  
          RX packets:13212 errors:0 dropped:0 overruns:0 frame:0  
          TX packets:1696 errors:0 dropped:0 overruns:0 carrier:0  
          collisions:0 txqueuelen:1000   
          RX bytes:3760852 (3.7 MB)  TX bytes:238743 (238.7 KB)  
  
lo        Link encap:Local Loopback    
          inet addr:127.0.0.1  Mask:255.0.0.0  
          inet6 addr: ::1/128 Scope:Host  
          UP LOOPBACK RUNNING  MTU:65536  Metric:1  
          RX packets:558 errors:0 dropped:0 overruns:0 frame:0  
          TX packets:558 errors:0 dropped:0 overruns:0 carrier:0  
          collisions:0 txqueuelen:1000   
          RX bytes:72352 (72.3 KB)  TX bytes:72352 (72.3 KB)  
  
wlp4s0    Link encap:Ethernet  HWaddr a4:02:b9:0a:76:b1    
          UP BROADCAST MULTICAST  MTU:1500  Metric:1  
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0  
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0  
          collisions:0 txqueuelen:1000   
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)  
2.命令行添加或修改網絡參數
zhuml@zhuml-Latitude-3350:~$ sudo gedit /etc/network/interfaces  
彈出一個文本窗,如下:
# interfaces(5) file used by ifup(8) and ifdown(8)  
auto lo  
iface lo inet loopback  
在里面添加以太網的相關信息
# interfaces(5) file used by ifup(8) and ifdown(8)  
auto lo  
iface lo inet loopback  
  
auto esp3s0  
iface esp3s0 inet dhcp  

3.重啟網絡
zhuml@zhuml-Latitude-3350:~$ sudo /etc/init.d/networking restart  
現在應該能夠恢復插上網線,能夠上網;

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM