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.