1. 程式人生 > >LINUX安裝好後無法訪問網絡

LINUX安裝好後無法訪問網絡

自動 題解 插入模式 art 啟動網卡 local text borde 模式

LINUX安裝好後無法訪問網絡

在虛擬機安裝好新的LINUX系統後,ping www.baidu.com ,發現無法ping通。

鍵入ifconfig查詢配置:

eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

  ether 00:0c:29:3e:ad:2d txqueuelen 1000 (Ethernet)

  RX packets 0 bytes 0 (0.0 B)

  RX errors 0 dropped 0 overruns 0 frame 0

  TX packets 0 bytes 0 (0.0 B)

  TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536

  inet 127.0.0.1 netmask 255.0.0.0

   inet6 ::1 prefixlen 128 scopeid 0x10<host>

   loop txqueuelen 0 (Local Loopback)

   RX packets 942 bytes 79580 (77.7 KiB)

   RX errors 0 dropped 0 overruns 0 frame 0

   TX packets 942 bytes 79580 (77.7 KiB)

   TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

得到本機的網卡是eno16777728

然後,重啟網卡服務:service network restart

再次查詢:ifconfig,發現依舊如上所示,並且無法訪問網絡。

修改網卡配置: root模式下vim /etc/sysconfig/network-scripts/ifcfg-eno16777728(最後的數字不一定一致,不要照搬,根據查詢出來的配置信息靈活替換),然後將文件裏最後一項的ONBOOT=no

在插入模式中修改為yes並保存退出,以後計算機自動啟動網卡。

現在手動啟動網卡服務ifup eno16777736

重新鍵入ifconfig:

eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

  inet 192.168.81.134 netmask 255.255.255.0 broadcast 192.168.81.255

   inet6 fe80::20c:29ff:fe3e:ad2d prefixlen 64 scopeid 0x20<link>

   ether 00:0c:29:3e:ad:2d txqueuelen 1000 (Ethernet)

   RX packets 125 bytes 14963 (14.6 KiB)

   RX errors 0 dropped 0 overruns 0 frame 0

   TX packets 147 bytes 15265 (14.9 KiB)

   TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536

   inet 127.0.0.1 netmask 255.0.0.0

   inet6 ::1 prefixlen 128 scopeid 0x10<host>

   loop txqueuelen 0 (Local Loopback)

   RX packets 946 bytes 80000 (78.1 KiB)

   RX errors 0 dropped 0 overruns 0 frame 0

   TX packets 946 bytes 80000 (78.1 KiB)

   TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

問題解決,網卡服務成功啟動,並且後續不需要每次都手動啟動網卡服務

本文參照:http://114193107.blog.51cto.com/3025337/1676433

LINUX安裝好後無法訪問網絡