centos7不能上网,重启网卡报错怎么办


本文摘自PHP中文网,作者V,侵删。

问题:

VMWare虚拟机安装了CentOS7 ,突然发现连接不上,进入系统使用ifconfig命令查看网络设备,发现无外网网卡。

(推荐教程:centos教程)

如下:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

[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

重启网卡试试看。结果报错了!报错信息如下:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

[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 管理套件出现了问题

1

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

所以我们要停止这个套件的服务

1

[root@localhost ~]# systemctl stop NetworkManager

然后重启网卡试试

1

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

没有报错,是不是可以了呢?我们查看网络设备

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

[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 再次开启,我们这是不让它开机启动

1

systemctl disable NetworkManager

完成!

以上就是centos7不能上网,重启网卡报错怎么办的详细内容,更多文章请关注木庄网络博客

相关阅读 >>

vmware里部署CentOS7共享目录

CentOS7安装zabbix的详细介绍

CentOS7下无法ping通网关怎么解决

centos不识别网卡怎么办

CentOS7如何启动ftp服务

CentOS7使用ftp上传文件中文名显示乱码怎么办

tomcat日志中文乱码怎么解决?

centos下找不到网卡怎么办

CentOS7系统如何彻底关闭防火墙

centos 7如何安装qq?

更多相关阅读请进入《CentOS7》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...