Correct Way of Changing DNS?

I’m trying to find out how to correctly change my DNS, but I’m finding so many different methods, spanning many years… What is the correct way to change my DNS on EndeavourOS using XFCE (systemd)?

I wish to ignore my router’s and my ISP’s DNS, and strictly use my custom NextDNS ip.

It depends on many factors like if you are using systemd-resolved or not.
If you are using NetworkManager and dont mind setting the DNS per-connection then you can just use the GUI there by setting the Method to Automatic (Only addresses) - then you can input your desired DNS server(s).

There is a pretty comprehensive guide here:

You could also check out https://tailscale.com/

How does a subscription VPN service help with them setting their DNS?

Tailscale has Magic-dns and other features. Read through the documentation and decide for yourself.

I glanced at tailscale .. and their docs.

MagicDNS is about assigning persistent names to devices on your network (despite using their service which would otherwise affect your networking) - which is even further removed from the topic here.

The query is about changing/applying DNS servers.

In what way would a VPN service be a solution for that?

If you are instead suggesting they only use the tailscale software, and not the vpn, in order to affect such DNS configuration .. why would that be necessary or why would it be suggested instead of the included utilities that already handle DNS selection?

And does it work without having the tailscale service? Because reading their docs it would appear that using tailscale to choose DNS will not be effective outside of the tailscale vpn service.

( No one needs to pay $6+ USD per month to set their preferred DNS. Nor should they. )

In the future if you are suggesting someone use only a secondary function of some software while providing it as a solution to some issue it would probably make sense to highlight that function and how it relates to the issue.

Okay, the language barrier causes these misunderstandings. I read and write Spanish. That’s all.

2 Likes

One option is to change it only in the browser. Only the browser’s DNS queries will then be filtered.

My preference is to change only on the router so that all connected devices are affected, but I don’t think that is what the OP wants in this case

In the case of laptops anyways - both.

The router has standards I think are good enough to serve to everyone.

Then the lappy has what I want applied via /etc/systemd/resolved.conf.d/dns.conf so that I similarly dont get any crap DNS supplied by routers I might connect to elsewhere.

1 Like

Could you elaborate on how you set that up, please?

This is exactly my scenario. I have a router with a separate filtered DNS. When I’m out and about, I want my laptop to have its own DNS settings, so that I can bypass the garbage DNS’ you connect to on public/foreign connections.

I also prefer to distribute dns configurations on the router level, instead on the client side.

And on a different note:

Even if Mullvad is another VPN provider, their DNS services are completely free and they’ve got various levels of ad & content blocking available. Check it out, here. They provide those as an alternative in case it’s not feasible to connect to their VPN. They don’t mention that their DNS services could be used on the router level, but it works just fine.

Additionally, the free tier of nextdns covers up to 300.000 dns queries a month and allows for a more granular control about the content which should be blocked. That might work well for your mobile when you’re not home. And only occasionally use your phone for surfing the web. I guess on a workstation that is in daily use - the query limit might be to restrictive. But their unlimited plan is pretty inexpensive with 2,- € monthly.

My situation hinges on the use of systemd-resolved.

Which also has a section on setting DNS.

As alluded to above you can do this with something like

/etc/systemd/resolved.conf.d/dns.conf

[Resolve]
DNS=IP1 IP2
Domains=~.

If you actually read the OP, you will find I’m already using NextDNS, and that me asking about how I correctly set this up on my EOS device, is the whole point of this topic… :sweat_smile:

I’m just running the default installation settings currently (nothing network related unchecked in the Calamares installer). Will it be enough to edit this, or is there anything else I need to enable/disable?

Thank you!

I honestly dont know if current EOS uses systemd-resolved or openresolv or just NM by default.

Maybe we can check packages with

pacman -Qqs resolv

And/or for systemd-resolved service specifically ..

systemctl status systemd-resolved

That gave the following (minus the embedded links):

$ systemctl status systemd-resolved
○ systemd-resolved.service - Network Name Resolution
Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; disabled; preset: enabled)
Active: inactive (dead)
Docs: man:systemd-resolved.service(8)
man:org.freedesktop.resolve1(5)
https://systemd.io/WRITING_NETWORK_CONFIGURATION_MANAGERS

$ pacman -Qqs resolv
libmicrodns
systemd-resolvconf

Well, I’ve missed that detail.

But on the other hand, nextdns setup instructions are hard to miss.

Yep, I’ve already seen those. As you probably are aware, “Linux” is an exceptionally large umbrella, lacking specificity, and I’m asking on the EOS XFCE forums, specifically because that is what I’m using, and I wish to do it correctly.

I appreciate you trying to help, but I’d appreciate it if you would stop posting in this topic.

systemd-resolved

is definitely installed on your system. After made the changes to the drop-in configuration file /etc/systemd/resolved.conf.d/dns.conf, you should dosystemctl daemon-reload and systemctl start systemd-resolved if I’m not mistaken.