Sunday, July 27, 2014

How to fix curl: (6) Could not resolve host in Fedora

After you installed Fedora, you may face this issue while updating the system or a any specific application. Any also while try to install new application using Terminal. There are few things you have to do to fedora before you start to work otherwise it will trouble you always.






Today I'm going to treat for these symptoms
1. curl: (6) Could not resolve host
2. curl: (6) Could not resolve host: google.com; Name or service not known
3. nolookup not working
4. Firefox doesn't have internet
5. Couldn't resolve host when installing/updating yum packages
6. Very Slow DNS Lookup
7. Very slow to load web pages in web browser.

Here is the step by step solution.

1. Most of the issues occur because of the IPV6 internet connection in the Fedora. So first we have to disable IPV6 totally. here what you have to do


  • Open Terminal
  • Type su and enter to log in as the super user
  • Enter the root password
  • Type cd /etc/modprobe.d/ to change directory to /etc/modprobe.d/
  • Type vi disableipv6.conf to create a new file there
  • Press Esc + i for insert data to file
  • Type install ipv6 /bin/true on the file to avoid loading IPV6 related modules
  • Type Esc + : and then wq for save and exit
  • Type reboot to restart fedora
  • After reboot open terminal and type lsmod | grep ipv6 
  • If no result, it means you properly disabled IPV6
2. Then you have to disable the IPV6 DNS look-up in your Firefox browser. For that you have to go true one of my step by step tutorial. below I mention the link. But remember to comeback here to continue rest of the tasks.


3. Now your Firefox ready t surf internet but one more issue there. Fedora may user your ADSL router or Modem as the DNS server. In other way Fedora may uses some less powerful DNS server for look-up. So  your DNS look-up will be slow and wrong most of the time. This will cause to Curl errors and slow loading errors. So we have to set some powerful DNS server for look-up purpose in Fedora. Here is the steps.

  • Open Terminal
  • Type su and enter to log in as the super user
  • Enter the root password
  • Type cat /etc/resolv.conf to check what DNS server your Fedora using. Mostly this will be your Modem IP address.
  • Now we have to Find a powerful DNS server. Luckily there is a open DNS server maintain by Google.
  • Go to this page and find out what are the "Google Public DNS IP addresses"
  • Today those are 8.8.8.8 and 8.8.4.4. But in future those may change.
  • Type vi /etc/resolv.conf to edit the resolv.conf file
  • Press Esc + i for insert data to file
  • Comment all the things in the file by inserting # at the begin of the each line. Do not delete anything because can be useful in future.
  • Type below two lines in the file

nameserver 8.8.8.8
nameserver 8.8.4.4

  • Type Esc + : and then wq for save and exit
  • Now you are done and everything works fine (Not necessary to restart).
  • But every time when you restart the computer your  /etc/resolv.conf will be replaced by default. So I'm let you find a way to avoid that. 

18 comments:

  1. I followed the each steps but still I am facing the same issue. Curl error (6): Couldn't resolve host name for https://mirrors.fedoraproject.org/metalink?repo=fedora-24&arch=x86_64 [Could not resolve host: mirrors.fedoraproject.org]

    ReplyDelete
    Replies
    1. I HAVE FOLLOWED EVERY SINGLE STEP BUT THIS IS NOT WORKING FOR ME. HOWEVER, I FIXED THE PROBLEM WITH RUNNING ONE TROUBLESHOOTER. HERE IS FOR THOSE WHO WANT FIX THE PROBLEM ALMOST AUTOMATICALLY>>>> THE TROUBLESHOOTER (UPDATED) . PS IT'S NOT MINE AND I AM JUST SHARING IT HERE... I HOPE IT WILL WORK FOR YOU TOO.

      Delete
    2. It worked. Thank you Adam, you just saved me a lot of time.

      Delete
    3. Thanks buddy for sharing it here. Great share

      Delete
    4. Virus avoid Mega download link like the plague

      Delete
    5. How To Fix Curl: (6) Could Not Resolve Host In Fedora ~ Code Ketchup >>>>> Download Now

      >>>>> Download Full

      How To Fix Curl: (6) Could Not Resolve Host In Fedora ~ Code Ketchup >>>>> Download LINK

      >>>>> Download Now

      How To Fix Curl: (6) Could Not Resolve Host In Fedora ~ Code Ketchup >>>>> Download Full

      >>>>> Download LINK tW

      Delete
  2. Hello,
    I tried every steps but it didn't work.

    ReplyDelete
  3. Worked fine for me, no need to reboot after IPV6 disabling. Just do a sudo service network restart

    ReplyDelete
    Replies
    1. Hello, i even tried to do a sudo service network restart but still didn't work. Do you have another way? I kinda desprate haha

      Delete
  4. thanks, it resolved my problem on my fedora machine

    ReplyDelete
  5. I tried every steps but it didn't work.

    ReplyDelete
  6. I also tried every steps but it didn't work.

    ReplyDelete
  7. Hey there! This post couldn't be written any better! Reading this post reminds me of my good old room mate! He always kept chatting about this. I will forward this write-up to him. Pretty sure he will have a good read. Thank you for sharing!

    ReplyDelete
  8. Incredible points. Great arguments. Keep up the amazing spirit.

    ReplyDelete
  9. Thanks for this. Resolved problem on Fedora Remix on WSL2. Disabling IPv6, adding other DNS servers to resolv.conf, and changing generateResolvConf = true to generateResolvConf = false under [network] in wsl.conf made it all work.

    ReplyDelete
  10. Usually when making a tutorial like this, you add images to help newcomers with the issue, once you get to to conf file part it is almost impossible to execute any commands in the file.

    ReplyDelete
  11. How To Fix Curl: (6) Could Not Resolve Host In Fedora ~ Code Ketchup >>>>> Download Now

    >>>>> Download Full

    How To Fix Curl: (6) Could Not Resolve Host In Fedora ~ Code Ketchup >>>>> Download LINK

    >>>>> Download Now

    How To Fix Curl: (6) Could Not Resolve Host In Fedora ~ Code Ketchup >>>>> Download Full

    >>>>> Download LINK

    ReplyDelete