I don’t want to use the dns of my internet provider.
In gnome, I can go in parameter->wi-fi, click on the parameters of the used connection, go in ipv4 and ipv6 disable the automatic mode in DNS, and set the ip of the dns I want to use.
Two problems :
It doesn’t work at all,
Even if it worked, I don’t want to have to do it each time I use a new connection.
So, I can edit /etc/resolv.conf. This works… until the next update.
(And it ask two more questions :
Why can I set only three dns ?
Why is there a parameters in the parameter windows if it has no effect ?)
So, the main question : How can I configure my dns properly, without having to do it again at each update or each time I use a new network ? Ideally using DOH or DOT.
I doubt that - but alas - as you have discovered - it is a per connection edit - so when you add another connection you have be on it again.
You don’t want to modify the DNS too freely - it is a quite important component and it is easy to create problems for yourself.
You could run a local pi-hole on your system - presumably a laptop - that could be a as solution you can enable/disable at will. Read more about this at Pi-hole - ArchWiki
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
# Entries in this file show the compile time defaults. Local configuration
# should be created by either modifying this file, or by creating "drop-ins" in
# the resolved.conf.d/ subdirectory. The latter is generally recommended.
# Defaults can be restored by simply deleting this file and all drop-ins.
#
# Use 'systemd-analyze cat-config systemd/resolved.conf' to display the full config.
#
# See resolved.conf(5) for details.
[Resolve]
# Some examples of DNS servers which may be used for DNS= and FallbackDNS=:
# Cloudflare: 1.1.1.1#cloudflare-dns.com 1.0.0.1#cloudflare-dns.com 2606:4700:4700::1111#cloudflare-dns.com 2606:4700:4700::1001#cloudflare-dns.com
# Google: 8.8.8.8#dns.google 8.8.4.4#dns.google 2001:4860:4860::8888#dns.google 2001:4860:4860::8844#dns.google
# Quad9: 9.9.9.9#dns.quad9.net 149.112.112.112#dns.quad9.net 2620:fe::fe#dns.quad9.net 2620:fe::9#dns.quad9.net
DNS=ns0.fdn.fr ns1.fdn.fr
#FallbackDNS=1.1.1.1#cloudflare-dns.com 9.9.9.9#dns.quad9.net 8.8.8.8#dns.google 2606:4700:4700::1111#cloudflare-dns.com 2620:fe::9#dns.quad9.net 2001:4860:4860::8888#dns.google
#Domains=
DNSSEC=true
DNSOverTLS=yes
#MulticastDNS=yes
#LLMNR=yes
#Cache=yes
#CacheFromLocalhost=no
#DNSStubListener=yes
#DNSStubListenerExtra=
#ReadEtcHosts=yes
#ResolveUnicastSingleLabel=no
If I edit only this file, nothing happen, the network manager clearly follow what is written is /etc/resorv.conf. What did I miss ?
What can I say ? I tried to put the DNS I want to use and nothing happened. When I use the same DNS in /etc/resolv.conf it work fine (until the next update). So, I deduce the system clearly use the /etc/resolv.conf address and not the one set in the parameter menu. Do you have another explanation ?
You need to remove openresolv and enable systemd-resolved otherwise it won’t work.
I do hope for your sake you copied the service file to /etc/systemd/system - otherwise your changes will be gone next time systemd is synced from the repo.
I don’t want to use the dns of my internet provider.
.....
.....
.....
How can I configure my dns properly, without having to do it again at each
update or each time I use a new network ? Ideally using DOH or DOT.
You need something local on the laptop like dnscrypt-proxy…
Not sure what option you did select when you disabled the “automatic” mode.
It certainly does work - when you select:
automatic (DHCP), addresses only
instead of
automatic (DHCP)
Then, the IP of the DNS server(s) you put in the box below will be the one that is used
instead of the one provided by your router
(which is the one your ISP gives you).
It is a comma separated list, as the tool tip tells which will appear when you hover the cursor over that input box.
No other changes needed - not to /etc/resolv.conf, no need to switch to systemd-resolved …
It is a per connection setting when you use the NetworkManager GUI
(you only do it once for each wlan network you connect to)
You could configure your router to use a custom DNS server instead - how that is done is specific to the router but is usually an option in the routers setup menu.
Then, all the devices that connect through that router will use the custom DNS.