CentOS7.2 虚拟机网卡无法启动

Posted pigwan7

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS7.2 虚拟机网卡无法启动相关的知识,希望对你有一定的参考价值。

在开机之后,发现网卡没有启动起来,进行了如下操作
1、ifup ens33
Bringing up interface ens33: Error: Connection activation failed: No suitable device found for this connection.
2、接着想重启网络服务
[[email protected] network-scripts]# systemctl start network
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
3、根据提示查看报错
[[email protected] network-scripts]# systemctl status network.service
● 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 Thu 2017-11-02 21:21:15 CST; 4s ago
Docs: man:systemd-sysv-generator(8)
Process: 4550 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)

Nov 02 21:21:15 client01 network[4550]: RTNETLINK answers: File exists
Nov 02 21:21:15 client01 network[4550]: RTNETLINK answers: File exists
Nov 02 21:21:15 client01 network[4550]: RTNETLINK answers: File exists
Nov 02 21:21:15 client01 network[4550]: RTNETLINK answers: File exists
Nov 02 21:21:15 client01 network[4550]: RTNETLINK answers: File exists
Nov 02 21:21:15 client01 network[4550]: RTNETLINK answers: File exists
Nov 02 21:21:15 client01 systemd[1]: network.service: control process exited, code=exited status=1
Nov 02 21:21:15 client01 systemd[1]: Failed to start LSB: Bring up/down networking.
Nov 02 21:21:15 client01 systemd[1]: Unit network.service entered failed state.
Nov 02 21:21:15 client01 systemd[1]: network.service failed.
4、bing搜索报错信息,一般可能有两种解决措施
4.1、网卡配置文件中没有添加MAC地址信息,处理过程如下
4.1.1、查看网卡对应MAC地址
[[email protected] network-scripts]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 00:0c:29:9b:e7:51 brd ff:ff:ff:ff:ff:ff
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
link/ether 52:54:00:a7:c4:9b brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 1000
link/ether 52:54:00:a7:c4:9b brd ff:ff:ff:ff:ff:ff
4.1.2、将MAC地址添加在配置文件中
echo "HWADDR=00:0c:29:9b:e7:51" >> /etc/sysconfig/network-scripts/ifcfg-ens33
4.1.3、重启网络服务systemctl start network

在尝试了上述方法后,问题依然没有解决,尝试第二种方案

4.2、停止NetworkManager服务
停止
[[email protected] network-scripts]# systemctl stop NetworkManager
取消开机启动
[[email protected] network-scripts]# systemctl disable NetworkManager
重启网络
[[email protected] network-scripts]# service network restart
Restarting network (via systemctl): [ OK ]

至此,问题解决


NetworkManager和network的区别

简单说network适合使用于网路设定后固定不变的服务器,而NetworkManager则适合使用于笔记型电脑上必须常常在有线及无线网路环境切换时使用,并且这二个服务所读取及写入的设定档是不同的。
network :读取的设定档路径为「/etc/sysconfig/network-scripts/*」下的设定档。
NetworkManager :读取的设定档路径为「/etc/sysconfig/networking/*」下的设定档。
CentOS7 在预设情况下会启动NetworkManager 服务(包含开机启动),因为个人习惯传统的network设定,因此建议将NetworkManager 服务停用后再继续后续设定作业,否则在二个服务都启动的情况下将会造成互相干扰的麻烦状况。

以上是关于CentOS7.2 虚拟机网卡无法启动的主要内容,如果未能解决你的问题,请参考以下文章

067_查看 KVM 虚拟机中的网卡信息(不需要进入启动或进入虚拟机)

为啥VM虚拟机安装系统之后会网卡启动?

shell脚本:查看KVM虚拟机中的网卡信息(不需要进入启动或进入虚拟机)

vmware克隆Centos6.9虚拟机网卡无法启动问题

VMware Centos中创建克隆虚拟机导致网卡设备无法启动的问题

vmware的虚拟机的centos无法启动网卡