diff options
author | Michael Brown <mcb30@ipxe.org> | 2021-07-20 13:19:15 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2021-07-20 13:19:15 +0100 |
commit | 4d180be5175e176ec27680557c1d67536a847610 (patch) | |
tree | 12cb4eb72fb08db15007930fbdd8f9145f995a12 | |
parent | c64dfff0a93b5f967ae21339313e61baf0b7a3a0 (diff) | |
download | ipxe-4d180be5175e176ec27680557c1d67536a847610.zip ipxe-4d180be5175e176ec27680557c1d67536a847610.tar.gz ipxe-4d180be5175e176ec27680557c1d67536a847610.tar.bz2 |
[cloud] Retry DHCP aggressively in AWS EC2
The DHCP service in EC2 has been observed to occasionally stop
responding for bursts of several seconds. This can easily result in a
failed boot, since the current cloud boot script will attempt DHCP
only once.
Work around this problem by retrying DHCP in a fairly tight cycle
within the cloud boot script, and falling back to a reboot after
several failed DHCP attempts.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r-- | src/config/cloud/aws.ipxe | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/config/cloud/aws.ipxe b/src/config/cloud/aws.ipxe index 66ad77d..6c00739 100644 --- a/src/config/cloud/aws.ipxe +++ b/src/config/cloud/aws.ipxe @@ -3,7 +3,22 @@ echo Amazon EC2 - iPXE boot via user-data echo CPU: ${cpuvendor} ${cpumodel} ifstat || -dhcp || + +set attempt:int8 1 +:dhcp_retry +echo DHCP attempt ${attempt} +dhcp --timeout 5000 && goto dhcp_ok || +ifstat || +inc attempt +iseq ${attempt} 10 || goto dhcp_retry + +:dhcp_fail +echo DHCP failed - rebooting +reboot || +exit + +:dhcp_ok route || chain -ar http://169.254.169.254/latest/user-data || ifstat || +exit |