ping: Temporary failure in name resolution

In this article, we will see the solution for “ping: Temporary failure in name resolution”.

ping: Temporary failure in name resolution

Resolution:
Note: In production Linux server, before running below steps take proper approval from your System Administration otherwise you will be in trouble. If you face this issue in your home/testing server go ahead and perform below steps.

Rename /etc/resolv.conf and create new /etc/resolv.conf manually.

1. Disable and Stop the systemd-resolved.service.

sudo systemctl disable systemd-resolved.service

sudo systemctl stop systemd-resolved.service

2. Then, rename /etc/resolv.conf

sudo mv /etc/resolv.conf /etc/resolv.conf.old

3. Then, create /etc/resolv.conf and add your name server(nameserver 8.8.8.8) and Enter and Ctrl+D from your keyboard. If you have any confusion go through the below video.

sudo cat > /etc/resolv.conf

nameserver 8.8.8.8

4. Enable and Stop the systemd-resolved.service.

sudo systemctl enable systemd-resolved.service

sudo systemctl startsystemd-resolved.service

5. Ping try to ping to the hostname(google.com). It will work properly.