Ошибка temporary failure in name resolution

8:51 AM

Hello everyone, on this occasion, I will share my experience about the problem I faced, when my server using the Ubuntu 20.04.1 LTS linux operating system could not ping google.com.

ping google.com Temporary failure in name resolution
ping google.com Temporary failure in name resolution

Issue

with the error displayed is ping: google.com: Temporary failure in name resolution

Cause

Third party programs must not access this file directly, but only through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way, replace this symlink by a static file or a different symlink.

Resolution

I only use an easy solution, which is to backup the original file first and make a manual resolv.conf directed to the google ip.

Disable systemd-resolved

# systemctl disable systemd-resolved.service

Stop Service systemd-resolved

# systemctl stop systemd-resolved.service

Move File resolv.conf to resolv.conf.ori

# mv resolv.conf resolv.conf.ori

Make file resolv.conf manual

# vi resolv.conf

nameserver 8.8.8.8

save & quit

Trying

# ping 8.8.8.8
# ping google.com
successful ping to google.com
successful ping to google.com

Bangkit Ade Saputra

Bangkit Ade Saputra
Hard-working professional with experience and a proven knowledge of operating system, server architecture and system configuration.

Иногда, когда вы пытаетесь проверить связь с веб-сайтом, обновить систему или выполнить какую-либо задачу, требующую активного подключения к Интернету, вы можете получить сообщение об ошибке “temporary failure in name resolution” на вашем терминале.

Например, когда вы пытаетесь проверить связь с веб-сайтом, вы можете столкнуться с указанной ошибкой:

ping itisgood.ru
ping: itisgood.ru: Temporary failure in name resolution

Обычно это ошибка разрешения имен, которая показывает, что ваш DNS-сервер не может преобразовать доменные имена в соответствующие IP-адреса.

Это может стать серьезной проблемой, поскольку вы не сможете обновлять или даже устанавливать какие-либо программные пакеты в вашей системе Linux.

В этой статье мы рассмотрим некоторые из причин ошибки «temporary failure in name resolution» и решения этой проблемы.

1. Отсутствующий или неправильно настроенный файл resolv.conf

Файл /etc/resolv.conf – это файл конфигурации резолвера в системах Linux.

Он содержит записи DNS, которые помогают вашей системе Linux преобразовывать доменные имена в IP-адреса.

Если этот файл отсутствует или существует, но ошибка разрешения имени все еще возникает, создайте его и добавьте общедоступный DNS-сервер Google, как показано далее:

nameserver 8.8.8.8

Сохраните изменения и перезапустите службу systemd-resolved, как показано.

$ sudo systemctl restart systemd-resolved.service

Также целесообразно проверить состояние резолвера и убедиться, что он активен и работает должным образом:

$ sudo systemctl status systemd-resolved.service

Затем попробуйте проверить связь с любым веб-сайтом, и проблема должна быть решена.

ping google.com

2. Ограничения межсетевого экрана

Если первое решение вам не помогло, значит ограничения брандмауэра могут помешать вам успешно выполнять DNS-запросы.

Проверьте свой брандмауэр и убедитесь, что порт 53 (используется для DNS ) и порт 43 (используется для поиска whois) открыты.

Если порты заблокированы, откройте их следующим образом:

Для брандмауэра UFW (Ubuntu / Debian и Mint)

Чтобы открыть порты 53 и 43 на брандмауэре UFW, выполните следующие команды:

$ sudo ufw allow 53/tcp
$ sudo ufw allow 43/tcp
$ sudo ufw reload

Для firewalld (RHEL / CentOS / Fedora)

$ sudo firewall-cmd --add-port=53/tcp --permanent
$ sudo firewall-cmd --add-port=43/tcp --permanent
$ sudo firewall-cmd --reload

Мы надеемся, что теперь у вас есть представление об ошибке “temporary failure in name resolution” и о том, как ее исправить, выполнив несколько простых шагов.

Как всегда, мы будем благодарны за ваши отзывы и комментарии.

Introduction

The «Temporary failure in name resolution» error occurs when the system cannot translate a website name into an IP address. While the error sometimes appears due to a lost internet connection, there are multiple reasons why it may show up on your system.

This tutorial will guide you through troubleshooting and fixing the «Temporary failure in name resolution» error.

How to resolve the "Temporary failure in name resolution" error

Prerequisites

  • Sudo or root privileges
  • A working internet connection

The error appears when a user attempts to communicate with a website using a command such as ping:

ping phoenixnap.com

The system cannot communicate with the DNS server and returns the error.

Pinging a website unsuccessfully.

The most common cause of this error are the resolv.conf network configuration file and a misconfigured firewall. The steps to fix the error in both cases are given below.

Method 1: Badly Configured resolv.conf File

resolv.conf is a file for configuring DNS servers on Linux systems.

To start, open the file in a text editor such as nano.

sudo nano /etc/resolv.conf

Make sure the resolv.conf file contains at least one nameserver. The lines listing nameservers should look like this:

nameserver 8.8.8.8

If you do not have a nameserver listed in the file, add at least one. 8.8.8.8 and 8.8.4.4 are the popular nameservers owned by Google, but you can add any functional DNS server to this list.

The /etc/resolv.conf file in nano editor.

Save the file and exit.

Then, restart the DNS resolver service.

sudo systemctl restart systemd-resolved.service

If successful, the command above returns no output. Test that your new nameservers are correctly configured by pinging a website:

ping phoenixnap.com

If you see the ping command transmitting and receiving data, your DNS server is working properly.

Successfully pinging a website.

Misconfigured Permissions

If your resolv.conf file contains valid DNS servers, but the error persists, it may be due to misconfigured file permissions. Change ownership of the file to the root user with the following command:

sudo chown root:root /etc/resolv.conf

Modify the user permissions to allow everybody on the system to read the file:

sudo chmod 644 /etc/resolv.conf

Ping a website again.

ping phoenixnap.com

If wrong file permissions caused the error, the commands above successfully resolve it.

Method 2: Firewall Restrictions

Another reason for the «Temporary failure in name resolution» error may be a firewall blocking one or both of the following ports:

  • port 43, used for whois lookup
  • port 53, used for domain name resolution

Open the ports in UFW Firewall

Type the following command to allow traffic on port 43 using UFW firewall:

sudo ufw allow 43/tcp

UFW confirms the rule is successfully updated.

Allowing port 43 in UFW.

Repeat the command for port 53.

sudo ufw allow 53/tcp

Reload UFW with the following command:

sudo ufw reload

The output confirms the operation was successful.

Reloading UFW firewall.

Open the ports in firewalld

Some Linux distributions such as CentOS use firewalld as their default firewall. The syntax to open port 43 in firewalld is:

sudo firewall-cmd --add-port=43/tcp --permanent

firewalld outputs the word success.

Allowing port 43 in firewalld.

Repeat the command for port 53.

sudo firewall-cmd --add-port=53/tcp --permanent

Reload the firewall.

sudo firewall-cmd --reload
Reloading firewalld firewall.

Test the connection by pinging a website.

ping phoenixnap.com

Conclusion

This article provided ways to troubleshoot and fix the «Temporary failure in name resolution» error on Linux. To learn more about diagnosing DNS-related problems, read How to Use Linux dig Command.

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.

A temporary failure in name resolution is a common issue that Linux users may encounter when their system cannot resolve a hostname to an IP address. This problem can occur due to various reasons, such as network connectivity issues, DNS configuration problems, or issues with the local hosts file. In this article, we will discuss several steps you can take to troubleshoot and resolve this issue on your Linux system.

1. Check your internet connection

Before diving into the technical aspects of resolving the issue, it is crucial to ensure that your system is connected to the internet and that the network is functioning properly. Verify your system’s network connection by attempting to access a website or using the ping command to check the connectivity to a known IP address or domain.

Try to ping an IP address eg: 8.8.8.8 and see the results:

ping 8.8.8.8 -c 4 

If the ping is successful, that means internet is working properly on your system.

2. Verify DNS settings

The first step in troubleshooting temporary failure in name resolution is to verify your system’s DNS settings. The /etc/resolv.conf file contains the DNS server IP addresses, which are usually provided by your Internet Service Provider (ISP) or network administrator. This is the most common error we encouding for this error.

To view the contents of the /etc/resolv.conf file, run the following command:

cat /etc/resolv.conf 

If the file is empty or does not contain valid DNS server IP addresses, you can add them manually. To edit the file, run:

sudo nano /etc/resolv.conf 

Add the following lines with the appropriate DNS server IP addresses, such as Google’s public DNS servers:

nameserver 8.8.8.8

nameserver 8.8.4.4

Save and exit the file using Ctrl+X, then Y, and finally Enter.

3. Check the local hosts file

The /etc/hosts file contains hostname and IP address mappings for your local system. Ensure that this file has the correct entries for your system’s hostname and IP address. You can view the file using:

cat /etc/hosts 

If the file is incorrect or missing entries, edit it using:

sudo nano /etc/hosts 

Add or correct entries as needed, following this format:

127.0.0.1   localhost

192.168.1.100 local.example.com

<yoursystemip>        <yourhostname>

Save and exit the file.

4. Restart the network service

After making changes to the DNS or hosts files, you need to restart the networking service to apply the changes. Run one of the following commands, depending on your Linux distribution:

sudo systemctl restart networking 

or

sudo /etc/init.d/networking restart 

5. Clear the DNS cache

If your system uses a DNS caching service like nscd or dnsmasq, you should clear the cache to ensure that the latest DNS information is used. Run the appropriate command to restart the service:

sudo systemctl restart nscd 

For dnsmasq:

sudo systemctl restart dnsmasq 

6. Test the name resolution

After completing the above steps, test the name resolution using the ping, host, or nslookup commands:

ping example.com 
host example.com 
nslookup example.com 

If the issue persists after following these steps, you may need to consult your network administrator or ISP for further assistance.

Conclusion

Resolving a temporary failure in name resolution on Linux systems involves checking network connectivity, verifying DNS settings, inspecting the local hosts file, restarting network services, and clearing the DNS cache. By following the steps outlined in this article, you should be able to troubleshoot and resolve most cases of temporary failure in name resolution. However, if the issue persists, it is essential to seek help from your network administrator or ISP, as there may be underlying problems with the network infrastructure or configuration that need to be addressed.

In some cases, the issue may also be related to firewall settings or security software on your system that is blocking DNS requests. Make sure to check your firewall rules and security software settings to ensure that they are not interfering with your system’s ability to resolve hostnames.

Furthermore, it is important to keep your system updated and ensure that all packages, including DNS-related tools and services, are up to date. Regularly updating your system can help prevent issues related to outdated or incompatible software components.

By following these steps and maintaining a healthy system, you can minimize the occurrence of temporary failures in name resolution and ensure smooth operation of your Linux system on the network.

Понравилась статья? Поделить с друзьями:
  • Ошибка temporarily not available
  • Ошибка temp high
  • Ошибка tcp подключения код c00000b5 номер 3
  • Ошибка tcp error code 10061
  • Ошибка tco на ивеко еврокарго