Let’s break down the process of fixing the “Temporary failure in name resolution” error by modifying the /etc/resolv.conf
file and restarting the systemd-resolved
service.
Understanding the Problem: “Temporary failure in name resolution”
This error indicates that your system cannot translate domain names (like [geçersiz URL kaldırıldı]) into IP addresses (like 172.217.160.142). This translation is the job of the Domain Name System (DNS). When your system can’t reach a DNS server or there’s a problem with the DNS configuration, you encounter this error, preventing you from accessing websites and other network resources by name.
The Solution: Modifying /etc/resolv.conf
and Restarting systemd-resolved
-
/etc/resolv.conf
– The DNS Configuration File: This file contains the DNS settings for your system. The most important setting here isnameserver
, which specifies the IP address of a DNS server. -
Adding Google Public DNS Servers: By adding
nameserver 8.8.8.8
andnameserver 8.8.4.4
to/etc/resolv.conf
, you’re instructing your system to use Google Public DNS servers. These are reliable and widely available DNS servers.8.8.8.8
: Google Public DNS primary server.8.8.4.4
: Google Public DNS secondary server.
-
The
nano
Command:sudo nano /etc/resolv.conf
opens the/etc/resolv.conf
file in thenano
text editor with root privileges (required to modify system files). -
Restarting
systemd-resolved
:sudo systemctl restart systemd-resolved.service
restarts thesystemd-resolved
service. This service is responsible for resolving domain names on systems using systemd (which is most modern Linux distributions). Restarting it ensures that the changes you made to/etc/resolv.conf
are applied.
Step-by-step Instructions:
-
Open your terminal.
-
Edit the
/etc/resolv.conf
file:Bashsudo nano /etc/resolv.conf
-
Add the following lines at the end of the file:
nameserver 8.8.8.8 nameserver 8.8.4.4
If there are other
nameserver
lines in this file, adding these lines below them will prioritize Google’s DNS servers. -
Save the file (in
nano
, press Ctrl+X, then Y, then Enter). -
Restart the
systemd-resolved
service:Bashsudo systemctl restart systemd-resolved.service
-
Test your internet connection by trying to access a website.
Important Note: On many modern Linux systems that use systemd-resolved
, directly editing /etc/resolv.conf
is not the recommended long-term solution. The file is often dynamically generated. Changes made directly to this file may be overwritten on reboot or network changes.
A More Permanent Solution (using resolved.conf
):
A better approach is to modify /etc/systemd/resolved.conf
and then restart the service.
- Edit
/etc/systemd/resolved.conf
:Bashsudo nano /etc/systemd/resolved.conf
- Uncomment (remove the
#
) and change theDNS=
lines to:DNS=8.8.8.8 8.8.4.4 #FallbackDNS=
- Restart the
systemd-resolved
service:Bashsudo systemctl restart systemd-resolved.service
This method ensures that your DNS settings persist across reboots.