How Do You Troubleshoot the Error “curl: (6) Could not resolve host: Unknown error”?

Problem scenario
You are using RedHat Enterprise Linux in AWS.  curl commands are not working.  DNS names are not resolving accurately.  For example, you try this command:  curl http://icanhazip.com

You get this error:
"curl: (6) Could not resolve host: icanhazip.com; Unknown error"
How do you fix this to get curl commands to work (and make sure that FQDNs resolve properly)?

Solution
Do these four things:

1.  sudo cp /etc/modprobe.d/disableipv6.conf /etc/modprobe.d/bak.disableipv6.conf.bak
2.  sudo su -
3.  echo "install ipv6 /bin/true" >> /etc/modprobe.d/disableipv6.conf
4.  Reboot the server.

Join the Conversation

2 Comments

    1. If this did not work, was there an error message? If there was no error message, what step did you get to when there was a problem?

Leave a comment

Your email address will not be published. Required fields are marked *