Search code examples
linuxubuntudns

Linux command line error message: Temporary failure in name resolution


I'm getting error message "Temporary failure in name resolution" when trying to ping a domain name such as a website. When I ping a discrete IP address then ping works normally.

ping: google.com: Temporary failure in name resolution

This problem only happens when trying to ping a domain instead of an IP, so this seems to be a DNS problem.

My /etc/resolve.conf specifies DNS server 127.0.0.57. After I added nameserver 8.8.8.8 and restarted the service that seemed to fix the problem. However this may be only short term, it may break again, So I need a long term solution. If anyone has a solution to this issue, it could be awesome.


Solution

  • I've faced the exactly same problem but I've fixed it with another approache.

    Using Ubuntu 18.04, first disable systemd-resolved service.

    sudo systemctl disable systemd-resolved.service

    Stop the service

    sudo systemctl stop systemd-resolved.service

    Then, remove the link to /run/systemd/resolve/stub-resolv.conf in /etc/resolv.conf

    sudo rm /etc/resolv.conf

    Add a manually created resolv.conf in /etc/

    sudo vim /etc/resolv.conf

    Add your prefered DNS server there

    nameserver 208.67.222.222

    I've tested this with success.