Tag Archives: service network restart

Linux: CentOS 7 executes service network restart error [Solved]

Today, we plan to build a Greenplum cluster environment with VirtualBox virtual machine, and the host agrees to install CentOS 7. As a result, an error is reported by Yum install after CentOS 7, indicating that there is no way to connect to the address of the image library, that is, there is no way to surf the Internet. Then curl www.baidu.com prompts that the target cannot be found. The first thing I think about is the network problem. Let’s take a look at the ifconfig command first. The result prompts an unknown command, which is indeed a minimized installation. First, change the network settings of the virtual machine to bridge to ensure that cable connect is checked, and then go to the/etc/sysconfig/network scripts directory to check the settings of the eth0 network port. As a result, the ifcfg-eth0 file was not found.

First, use the IP address command to check the MAC address (that is, the string after link/ether)

Then VI/Etc/sysconfig/network scripts/ifcfg-eth0 add eth0 network port configuration

Save and exit, execute service network restart, and an error is directly reported

Restarting network (via systemctl):   Job  for  network.service failed because the control process exited with error code.

See  "systemctl status network.service"  and  "journalctl -xe"  for  details.     

After entering systemctl status network.service command according to the prompt, the following error message appears:

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 五 2017-07-14 19:01:47 CST; 1min 16s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 4681 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
   CGroup: /system.slice/network.service
           └─1192 /sbin/dhclient -H mini1 -1 -q -lf /var/lib/dhclient/dhclient--ens33.lease -pf /v...
7月 14 19:01:47 mini1 network[4681]: RTNETLINK answers: File exists
7月 14 19:01:47 mini1 network[4681]: RTNETLINK answers: File exists
7月 14 19:01:47 mini1 network[4681]: RTNETLINK answers: File exists
7月 14 19:01:47 mini1 network[4681]: RTNETLINK answers: File exists
7月 14 19:01:47 mini1 network[4681]: RTNETLINK answers: File exists
7月 14 19:01:47 mini1 network[4681]: RTNETLINK answers: File exists
7月 14 19:01:47 mini1 systemd[1]: network.service: control process exited, code=exited status=1
7月 14 19:01:47 mini1 systemd[1]: Failed to start LSB: Bring up/down networking.
7月 14 19:01:47 mini1 systemd[1]: Unit network.service entered failed state.
7月 14 19:01:47 mini1 systemd[1]: network.service failed.

Set startup to start a service named networkmanager-wait-online. The command is:
systemctl enable networkmanager-wait-online.service

Reboot restart the host

It is normal to re execute systemctl status network.service. Note that the MAC address behind the hwaddr of the newly created eth0 must be consistent with the local machine

Run curl baidu.com again