centos7不能上網,重新啟動網路卡報錯怎麼辦

2020-09-29 18:00:37

問題:

VMWare虛擬機器器安裝了CentOS7 ,突然發現連線不上,進入系統使用ifconfig命令檢視網路裝置,發現無外網網路卡。

(推薦教學:)

如下:

[root@localhost ~]# ifconfig
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 1000  (Local Loopback)
        RX packets 12  bytes 1068 (1.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12  bytes 1068 (1.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:f6:af:41  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

重新啟動網路卡試試看。結果報錯了!報錯資訊如下:

[root@localhost ~]# systemctl status network
● network.service - LSB: Bring up/down networking
   Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2020-09-28 09:59:00 CST; 9s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 13344 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)

Sep 28 09:59:00 localhost.localdomain network[13344]: RTNETLINK answers: File...
Sep 28 09:59:00 localhost.localdomain network[13344]: RTNETLINK answers: File...
Sep 28 09:59:00 localhost.localdomain network[13344]: RTNETLINK answers: File...
Sep 28 09:59:00 localhost.localdomain network[13344]: RTNETLINK answers: File...
Sep 28 09:59:00 localhost.localdomain network[13344]: RTNETLINK answers: File...
Sep 28 09:59:00 localhost.localdomain network[13344]: RTNETLINK answers: File...
Sep 28 09:59:00 localhost.localdomain systemd[1]: network.service: control pr...
Sep 28 09:59:00 localhost.localdomain systemd[1]: Failed to start LSB: Bring ...
Sep 28 09:59:00 localhost.localdomain systemd[1]: Unit network.service entere...
Sep 28 09:59:00 localhost.localdomain systemd[1]: network.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

出現此現象的原因一般是系統的 NetworkManager 管理套件出現了問題

Sep 28 09:59:00 localhost.localdomain systemd[1]: Failed to start LSB: Bring ...

所以我們要停止這個套件的服務

[root@localhost ~]# systemctl stop NetworkManager

然後重新啟動網路卡試試

[root@localhost ~]# systemctl restart network.service

沒有報錯,是不是可以了呢?我們檢視網路裝置

[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.100.15  netmask 255.255.255.0  broadcast 192.168.100.255
        inet6 fe80::20c:29ff:fe35:e8d7  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:35:e8:d7  txqueuelen 1000  (Ethernet)
        RX packets 9  bytes 626 (626.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 32  bytes 4309 (4.2 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 1000  (Local Loopback)
        RX packets 12  bytes 1068 (1.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12  bytes 1068 (1.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:f6:af:41  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

出現外網網路卡了,為了防止重新啟動後 NetworkManager 再次開啟,我們這是不讓它開機啟動

systemctl disable NetworkManager

完成!

以上就是centos7不能上網,重新啟動網路卡報錯怎麼辦的詳細內容,更多請關注TW511.COM其它相關文章!