How to use resolvectl to set your DNS server in Linux
Modern linux distributions use systemd-resolved
to manage DNS settings. You can use resolvectl
to manage these settings:
You need to know the name of your primary network interface. Use ifconfig
to find it.
In this example, we’ll use enp3s0
as the network interface name.
This command will set your primary DNS server to the Cloudflare DNS server (1.1.1.1
):
sudo resolvectl dns enp3s0 1.1.1.1