This shell script forces acme-v02.api.letsencrypt.org to resolve via IPv4 on servers with IPv6 interfaces that are enabled but dysfunctional in any number of ways.
It works by updating an entry in the server’s /etc/hosts file on a schedule, to the latest IPv4 address found for that domain. This is necessary because the IP address rotates regularly.
Download the shell script
wget -O /usr/local/sbin/forceleipv4.sh "https://pastebin.com/raw/ETsD9D9W"
chmod 700 /usr/local/sbin/forceleipv4.sh
Installing a cron task
echo '0 * * * * root /usr/local/sbin/forceleipv4.sh' > /etc/cron.d/forceleipv4
Forcefully update LE IPv4
/usr/local/sbin/forceleipv4.sh
The output of the hosts file
cat /etc/hosts
That's it.