Could not resolve host error

25,043

Problem is that sometimes dhcpcdor other processes overwrite the content of the resolv.conf file, which is where DNS library resolver configuration is stored, inserting the DNS servers from your internet service provider, which may not work in some cases.

In case of problems it may be a good idea to change the content of resolv.conf to point to Open DNS servers (which should work better than your service provider servers):

# OpenDNS servers
nameserver 208.67.222.222
nameserver 208.67.220.220

or

# Google nameservers
nameserver 8.8.8.8
nameserver 8.8.4.4

and then protect the content of resolv.conf from dhcpcd adding the line nohook resolv.conf to /etc/dhcpcd.conf See the mighty Arch wiki for more details

Share:
25,043

Related videos on Youtube

gerky
Author by

gerky

Linux enthusiast.

Updated on September 18, 2022

Comments

  • gerky
    gerky over 1 year

    I'm using Arch Linux and I have a dynamic ip address with the use of dhcpcd. I can access websites through the google chrome but the problem is that I get 'could not resolve host' error when I run some commands on the terminal (like git clone).

    I've tried pinging github.com and doing nslookup and it returns the correct ip. Any ideas?

    • Old Nick
      Old Nick about 11 years
      have you tried this?
    • gerky
      gerky about 11 years
      @dcmst Cool, works fine now. You should post that as an answer. Thanks!
  • Old Nick
    Old Nick about 11 years
    @beefjerky, you're welcome, maybe this was actually caused by the same DNS problem?
  • gerky
    gerky about 11 years
    Yup, it was the same issue. I'm closing it.