Fix unreliable IPv4 internet test in alpine-install.func

Added two additional public resolver IPs (8.8.8.8 & 9.9.9.9) from diverse ASNs so that if any of the three IPs are reachable, the test will succeed.
The only condition that should fail this test is if the configuration is incorrect, and there is no internet access at all... therefore, if even one of the test destinations responds, the container network configuration is correct and the test should succeed.

Three diverse autonomous systems is the minimum number of destinations that should be checked for a connectivity test like this.
More would be better, but three will do.   If ALL fail, the test fails. If ANY respond, the test should succeed. 
The more (and more diverse) destination ASNs checked, the lower the probability that the test returns a false "fail" due to network conditions (such as routing problems on the upstream ISP, packet loss, firewall blocks, etc.) other than incorrect container configuration, which is what this test is meant to validate.
This commit is contained in:
infinisean 2024-11-24 18:10:54 -05:00 committed by GitHub
parent ad81624b6c
commit a8f2884468
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -78,7 +78,13 @@ setting_up_container() {
network_check() {
set +e
trap - ERR
if ping -c 1 -W 1 1.1.1.1 &>/dev/null; then msg_ok "Internet Connected"; else
if ping -c 1 -W 1 1.1.1.1 &>/dev/null || ping -c 1 -W 1 8.8.8.8 &>/dev/null || ping -c 1 -W 1 9.9.9.9 &>/dev/null; then
msg_ok "IPv4 Internet Connected";
ipv4_connected=true
else
msg_ok "Internet Connected";
else
msg_error "Internet NOT Connected"
read -r -p "Would you like to continue anyway? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then