I recently tried to enable system-wide DNS over https on Fedora. To do so I had to to some research and found out how comfusing it is for the average user (and even experienced users) to change the settings. In fact there are multiple backends messing with system DNS at the same time.

Most major Linux distributions use systemd-resolved for DNS but there is no utility for changing its configuration.

The average user would still try to change DNS settings by editing /etc/relov.conf (which is overwritten and will not survive reboots) or changing settings in Network Manager.

Based on documentation of systemd-resolved, the standard way of adding custom DNS servers is putting so-called 'drop-in' files in /etc/systemd/resolved.conf.d directory, especially when you want to use DNS-over-TLS or DNS-over-https.

Modern browsers use their buit-in DNS settings which adds to the confusion.

I think this is one area that Linux needs more work and more standardization.

How do you think it should be fixed?

  • bobs_monkey@lemm.ee
    ·
    9 months ago

    I typically leave my DNS config to my router and PiHole. I run a VPN server to my home network so I have the same setup no matter where I am. I'll agree, it used to be that /etc/resolv.conf was the go to, but systemd had been interesting to say the least.

    I also found this if it helps you any.

    • redd@discuss.tchncs.de
      ·
      9 months ago

      Problems:

      • you need an additional solution for Wifi captives portals, at least there is a gap in your solution for this situation
      • intercontinental travelling might not be fun
  • ScottE@lemm.ee
    ·
    9 months ago

    Most major Linux distributions use systemd-resolved for DNS but there is no utility for changing its configuration.

    Nor should there be. That's what the configuration files are for, and the utility to edit them is the editor of your choice.

  • Venia Silente@lemm.ee
    ·
    9 months ago

    Most major Linux distributions use systemd-resolved for DNS but there is no utility for changing its configuration.

    Because it's systemd. You take it or you take it. Brought to you by the same people who brought PulseAudio and GNOME 3.

    The average user would still try to change DNS settings by editing /etc/relov.conf (which is overwritten and will not survive reboots)

    True, but at least by this point it is documented everywhere (at least on Arch and Debian) and if you want to play around with resolv.conf their go-to interface is to install resolvconf and edit only the base or head files.

    How do you think it should be fixed?

    IMO people should just install and learn to use dnsmasq / bind9. They're there precisely to cover most cases (including forwarding local DNS queries to DoH, or having your own intranet, etc).

  • space@lemmy.dbzer0.com
    ·
    9 months ago

    You haven't used Ubuntu Server... The resolv.conf is managed by the network manager (NetworkManager if I recall correctly). But if you configure the DNS in NM it won't survive the reboot because there is another layer on top, cloudinit.

    • JWBananas@startrek.website
      ·
      9 months ago

      Cloud-init is fairly well documented:

      https://cloudinit.readthedocs.io/en/latest/reference/network-config-format-v2.html#nameservers-mapping

      But if you do not need it (and if you're configuring DNS by hand, it doesn't sound like you do), you can disable it entirely:

      https://cloudinit.readthedocs.io/en/latest/howto/disable_cloud_init.html

      resolv.conf itself should be managed by systemd-resolved on any modern Ubuntu Server release. And that service will use the DNS settings provided by netplan.

      With cloud-init disabled, you should have the freedom to create/edit configuration files in /etc/netplan and apply changes with netplan apply.

  • Mikelius@lemmy.ml
    ·
    edit-2
    9 months ago

    This isn't really a "Linux" problem. Calling it a Linux problem implies all distros do the same thing out of the box because it's a part of the core system. Systemd has a file, /etc/systemd/resolved.conf which has one line DNS= that you can add the servers you want. It's as simple as that. If you're using Dnsmasq for DNS instead, you'd edit the Dnsmasq file. If you're not using my of those (i.e. you removed systemd-resolved, Dnsmasq, etc) then you can just edit the /etc/reeolv.conf directly without worry of it being overwritten.

    While many distros come with systemd out of the box, not all of them do. For example, I use Gentoo with rc and after editing my resolv.conf, never had to worry about it again unless I decided to install a custom DNS software on it later.

    I read many replies to your post as "DNS software shouldn't be allowed to change DNS settings" for the most part, and that doesn't quite make sense to me. If it's a problem, remove said software. Browsers are definitely annoying in the DNS front, I won't disagree with that. Fortunately, they allow you to turn that off though.

  • A10@kerala.party@kerala.party
    ·
    9 months ago

    Very much agreed 👍 I realized when using the dnscrypt to set the DNS settings. There is resolv.conf which used to be the final authority regarding your DNS. Now I don't know anymore

  • blkpws@lemmy.ml
    ·
    9 months ago

    Well, I'm not using systemd and Portmaster (safing.io free open source without the VPN tunnels) has a DNS control over any request your Linux do... I don't think I have any issues here... hehe