Le problème
Impossible de démarrer la mise en réseau de manière fiable sur un serveur lors de l'utilisation de 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.
fichier de configuration réseau :
# 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
La solution
Un système CentOS/RHEL configuré pour la mise en réseau DHCP ne parvient pas à acquérir une adresse IP lors du redémarrage du service réseau. Ajout du paramètre PERSISTENT_DHCLIENT au fichier de configuration de l'interface réseau garantit que le client DHCP Oracle Linux (dhclient) demande systématiquement un bail d'adresse IP au serveur DHCP.
1. Ajoutez PERSISTENT_DHCLIENT directive dans /etc/sysconfig/network fichier comme suit :
# vi /etc/sysconfig/network NETWORKING=yes PERSISTENT_DHCLIENT=yes
2.Redémarrez les services réseau :
# /sbin/service network restart ## For CentOS/RHEL 5/6 # /usr/bin/systemctl restart network ## For CentOS/RHEL 7/8