diff --git a/diskimage_builder/elements/dhcp-all-interfaces/README.rst b/diskimage_builder/elements/dhcp-all-interfaces/README.rst index eb56a378..4c6c7353 100644 --- a/diskimage_builder/elements/dhcp-all-interfaces/README.rst +++ b/diskimage_builder/elements/dhcp-all-interfaces/README.rst @@ -24,6 +24,7 @@ Environment Variables DIB_DHCP_TIMEOUT :Required: No :Default: 30 - :Description: Amount of time in seconds that the systemd service will - wait to get an address. Should be increased in networks such as Infiniband. + :Description: Amount of time in seconds that the systemd service(or dhclient) + will wait to get an address. Should be increased in networks such as + Infiniband. :Example: DIB_DHCP_TIMEOUT=300 diff --git a/diskimage_builder/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces b/diskimage_builder/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces index 25018929..bbbd74e7 100755 --- a/diskimage_builder/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces +++ b/diskimage_builder/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces @@ -14,6 +14,15 @@ if [ "$DISTRO_NAME" != "gentoo" ]; then sed -i "s/DIB_DHCP_TIMEOUT/${DIB_DHCP_TIMEOUT:-30}/" /usr/local/sbin/dhcp-all-interfaces.sh fi +if [ -f /etc/dhcp/dhclient.conf ] ; then + # Set the dhclient timeout configurations to match DIB_DHCP_TIMEOUT, + if grep -o "^timeout " /etc/dhcp/dhclient.conf ; then + sed -i -e "s/^timeout .*/# \"timeout\" Value set by dhcp-all-interfaces\ntimeout ${DIB_DHCP_TIMEOUT:-30}/" /etc/dhcp/dhclient.conf + else + echo -e "# \"timeout\" Value set by dhcp-all-interfaces\ntimeout ${DIB_DHCP_TIMEOUT:-30}" >> /etc/dhcp/dhclient.conf + fi +fi + if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then if [ -e "/etc/redhat-release" ] ; then # the init system is upstart but networking is using sysv compatibility (i.e. Centos/RHEL 6)