The Problem
Cannot reliably get networking to start on a server when using DHCP:
# sudo /etc/init.d/network restart 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. [FAILED]
# journalctl -xe Nov 29 18:57:42 hostaname.domain.com dhclient[37653]: exiting. Nov 29 18:57:42 hostaname.domain.com network[37498]: [FAILED] Nov 29 18:57:42 hostaname.domain.com network[37498]: RTNETLINK answers: File Nov 29 18:57:42 hostaname.domain.com network[37498]: RTNETLINK answers: File Nov 29 18:57:42 hostaname.domain.com network[37498]: RTNETLINK answers: File Nov 29 18:57:42 hostaname.domain.com network[37498]: RTNETLINK answers: File Nov 29 18:57:42 hostaname.domain.com network[37498]: RTNETLINK answers: File Nov 29 18:57:42 hostaname.domain.com network[37498]: RTNETLINK answers: File Nov 29 18:57:42 hostaname.domain.com network[37498]: RTNETLINK answers: File Nov 29 18:57:42 hostaname.domain.com network[37498]: RTNETLINK answers: File Nov 29 18:57:42 hostaname.domain.com network[37498]: RTNETLINK answers: File Nov 29 18:57:42 hostaname.domain.com systemd[1]: network.service: control pr Nov 29 18:57:42 hostaname.domain.com systemd[1]: Failed to start LSB: Bring -- Subject: Unit network.service has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit network.service has failed. -- -- The result is failed. Nov 29 18:57:42 hostaname.domain.com systemd[1]: Unit network.service entere Nov 29 18:57:42 hostaname.domain.com systemd[1]: network.service failed. Nov 29 18:57:42 hostaname.domain.com polkitd[36998]: Unregistered Authentica
# sudo systemctl status -l 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 2016-12-12 12:48:04 EST; 28s ago Docs: man:systemd-sysv-generator(8) Process: 17797 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS) Process: 18067 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE) Dec 12 12:47:58 hostname.domain.com network[18067]: [FAILED] Dec 12 12:47:58 hostname.domain.com network[18067]: Bringing up interface eth1: Dec 12 12:48:04 hostname.domain.com network[18067]: Determining IP information for eth1... failed; no link present. Check cable? Dec 12 12:48:04 hostname.domain.com network[18067]: [FAILED] Dec 12 12:48:04 hostname.domain.com network[18067]: /etc/rc.d/init.d/network: line 88: ifcfg-eth0:DEVICE=eth0: command not found Dec 12 12:48:04 hostname.domain.com network[18067]: /etc/rc.d/init.d/network: line 89: ifcfg-eth0:TYPE=Ethernet: command not found Dec 12 12:48:04 hostname.domain.com systemd[1]: network.service: control process exited, code=exited status=1 Dec 12 12:48:04 hostname.domain.com systemd[1]: Failed to start LSB: Bring up/down networking. Dec 12 12:48:04 hostname.domain.com systemd[1]: Unit network.service entered failed state. Dec 12 12:48:04 hostname.domain.com systemd[1]: network.service failed.
network config file:
# less /etc/sysconfig/network-scripts/ifcfg-eth0 # Generated by parse-kickstart IPV6INIT=yes BOOTPROTO=dhcp DEVICE=eth0 ONBOOT=yes UUID=ccb107d4-4be6-453b-80f2-f803acc5f897 TYPE=Ethernet DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no NAME="System eth0" PEERDNS=yes PEERROUTES=yes DHCP_HOSTNAME=IPV6_PEERDNS=yes IPV6_PEERROUTES=yes
The Solution
A CentOS/RHEL system configured for DHCP networking fails to acquire an IP address whilst restarting the network service. Adding parameter PERSISTENT_DHCLIENT to the network interface configuration file ensures the Oracle Linux DHCP client (dhclient) consistently requests an IP address lease from the DHCP server.
1. Append PERSISTENT_DHCLIENT directive in /etc/sysconfig/network file as follows:
# vi /etc/sysconfig/network NETWORKING=yes PERSISTENT_DHCLIENT=yes
2.Restart Network services:
# /sbin/service network restart ## For CentOS/RHEL 5/6 # /usr/bin/systemctl restart network ## For CentOS/RHEL 7/8