Set the dhclient timeout to match DIB_DHCP_TIMEOUT
On initial boot when networking is brought up by cloud-init this is the timeout that dhclient adheres to. Centos configures "timeout 300" (for an EC2 bug) in their cloud image, which results in a 5 minutes delay to boot in cases where no dhcp available (e.g. IPv6 SLAAC). To reduce this boot delay and to provide consistency with places where we have set other dhcp timeouts set this to DIB_DHCP_TIMEOUT. Change-Id: I119a002070501c3dfe7c6730b07ee25f422b85b0 Related-Bug: #1758324
This commit is contained in:
parent
20be250b2a
commit
97399e9bb1
@ -24,6 +24,7 @@ Environment Variables
|
|||||||
DIB_DHCP_TIMEOUT
|
DIB_DHCP_TIMEOUT
|
||||||
:Required: No
|
:Required: No
|
||||||
:Default: 30
|
:Default: 30
|
||||||
:Description: Amount of time in seconds that the systemd service will
|
:Description: Amount of time in seconds that the systemd service(or dhclient)
|
||||||
wait to get an address. Should be increased in networks such as Infiniband.
|
will wait to get an address. Should be increased in networks such as
|
||||||
|
Infiniband.
|
||||||
:Example: DIB_DHCP_TIMEOUT=300
|
:Example: DIB_DHCP_TIMEOUT=300
|
||||||
|
@ -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
|
sed -i "s/DIB_DHCP_TIMEOUT/${DIB_DHCP_TIMEOUT:-30}/" /usr/local/sbin/dhcp-all-interfaces.sh
|
||||||
fi
|
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 [ "$DIB_INIT_SYSTEM" == "upstart" ]; then
|
||||||
if [ -e "/etc/redhat-release" ] ; then
|
if [ -e "/etc/redhat-release" ] ; then
|
||||||
# the init system is upstart but networking is using sysv compatibility (i.e. Centos/RHEL 6)
|
# the init system is upstart but networking is using sysv compatibility (i.e. Centos/RHEL 6)
|
||||||
|
Loading…
Reference in New Issue
Block a user