当我克隆出一台新的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