克隆虚拟机(centos7)时启动网卡报错(Failed to start LSB: Bring up/down networking)

当我克隆出一台新的centos7的虚拟机的时候,修改了网卡配置文件启动时,报错。

[root@centos7 ~]# systemctl restart network
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
[root@centos7 ~]#

按照提示输入systemctl status network.service查看

[root@centos7 ~]# 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 Mon 2017-03-13 23:24:37 CST; 16s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2878 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)

Mar 13 23:24:37 centos7 network[2878]: RTNETLINK answers: File exists
Mar 13 23:24:37 centos7 network[2878]: RTNETLINK answers: File exists
Mar 13 23:24:37 centos7 network[2878]: RTNETLINK answers: File exists
Mar 13 23:24:37 centos7 network[2878]: RTNETLINK answers: File exists
Mar 13 23:24:37 centos7 network[2878]: RTNETLINK answers: File exists
Mar 13 23:24:37 centos7 network[2878]: RTNETLINK answers: File exists
Mar 13 23:24:37 centos7 systemd[1]: network.service: control process exited, code=exited status=1
Mar 13 23:24:37 centos7 systemd[1]: Failed to start LSB: Bring up/down networking.
Mar 13 23:24:37 centos7 systemd[1]: Unit network.service entered failed state.
Mar 13 23:24:37 centos7 systemd[1]: network.service failed.

无奈去百度了一下,找到解决方法,说是centos7没有70-persistent-net.rules这个文件,所以新克隆的机器需要配置mac地址。
通过ip a命令查看mac地址是00:0c:29:06:67:17
在这里插入图片描述
在配置文件中修改HWADDR

vi /etc/sysconfig/network-scripts/ifcfg-ens32

在这里插入图片描述

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens32
HWADDR=00:0C:29:06:67:17
IPADDR=192.168.152.174
NETMASK=255.255.255.0
GATEWAY=192.168.152.110
DNS1=114.114.114.114
UUID=86f468b0-1625-499f-9a13-4cd4f7c46f3a
DEVICE=ens32
ONBOOT=yes

重启生效

systemctl restart network.service

如果依然不行的话

#给NetworkManager-wait-online服务设置开机自启动
systemctl enable NetworkManager-wait-online.service

#NetworkManager关闭,然后重启网卡
systemctl stop NetworkManager
systemctl disable NetworkManager
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值