Let’s Encrypt Could not obtain directory: cURL error 7: Failed to connect to problem resolution

When we request Let’s Encrypt certificate, we encounter a problem like below on your server.

https://acme-v02.api.letsencrypt.org Let's Failed to connect to the encrypted server.
Please try again later or report the issue to support it.
Could not obtain directory: cURL error 7: Failed to connect to 2606:4700:60:0:f53d:5624:85c7:3a2c: Network is unreachable (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

If an error is received, chances are that on your ethernet card ipv6 is open and a default ipv6 is defined and the connection with the curl is not possible.

In order to close this, it is useful to solve the problem by doing the following operations in Centos 6 and 7 versions;

nano /etc/sysctl.conf open it and type the following commands;

#turns off ipv6 support for all interfaces.
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

# If you only want to turn off 1 interface’s ipv6 support, please follow the below step;

net.ipv6.conf.em1.disable_ipv6 = 1

just type it, em1 will be your interface name, ens1, eth0, etc.

Save and exit sysctl.conf and

sysctl -p

Make changes with the help of the command.

Generally, the problem you encounter will solve, but if your problem still continues;
* Check if you have an A record with ipv6 in your DNS zone table.
* If you have a control panel, view your IP addresses on the control panel and delete it if you have an ipv6 address.

I hope it was a useful article.