The /etc/resolv.conf
file on Linux operating systems is used to configure the DNS (Domain Name System) resolver. Its function is to tell the system how to find the DNS servers that should be used to translate domain names into IP addresses. If the contents of the resolv.conf
file are modified, they will revert back to the default after a network restart or system reboot, containing only the IP address 127.0.0.53
.
How to Fix It
Open the resolved.conf
file:
sudo nano /etc/systemd/resolved.conf
Enable the DNS configuration line and enter the DNS resolver IP you want to use, for example 1.1.1.1
:
DNS=1.1.1.1
DNSStubListener=no
After that, restart the systemd-resolved
service:
sudo systemctl restart systemd-resolved
To test the result, restart the network, connect to another network, or reboot the computer. Then check again whether the resolved.conf
file is still using DNS 1.1.1.1
or has reverted back to 127.0.0.53
.