the most fundamental networking settings are ever changing

it used to be /etc/resolv.conf

where nameservers are set

systemd is doing it’s own thing


and Ubuntu (based on Debian) is doing (again) it’s entirely own thing (netplan)

frankly: this sucks X-D

annoys and confuses users that just “want to set primary dns” in 3 sec not 30min to figure out what system is doing what how.

/etc/resolv.conf should stay what it is X-D (via #comment in first line it could be defined what program is in charge of the file and that’s it, not every system comes with it’s own network config file and it’s own syntax… just agree on one syntax (can also be written as #this config file uses this and that syntax in version x and leave it at /etc/resolv.conf)

the crazy shortcut (but it works)

vim /scripts/debian/dns/; # create new script

# unfortunately the dns system is a mess (every distro doing it's thing, multiple network managers confuse even more who is handling what how)
# so simply overwrite /etc/resolv.conf every 3 seconds with
while true;
	echo "nameserver" > /etc/resolv.conf ; # 's dns server (works pretty well :) good job!
	echo "nameserver" >> /etc/resolv.conf ; # 's nameserver
	cat /etc/resolv.conf;
	sleep 3;

# how to run it
su - root
chmod +x /scripts/debian/dns/

to auto start this

re-activate rc.local (the file that used to be started on startup)

and before

exit 0


/scripts/debian/dns/ &


after reboot check if it wirks:

cat /etc/resolv.conf

the long and probably dysfunctional way

hostnamectl; # tested on
Operating System: Debian GNU/Linux 10 (buster)
Kernel: Linux 4.19.0-17-amd64
Architecture: x86-64

su - root; # become root

# find the network manager of evil
dpkg -l|grep network
ii  network-manager                       1.14.6-2+deb10u1                             amd64        network management framework (daemon and userspace tools)
ii  network-manager-gnome                 1.8.20-1.1                                   amd64        network management framework (GNOME frontend)

# remove all network managers (except systemd, can not remove that X-D)
apt remove *network-manager*
apt remove *wicd*

# check what interface to configure (primary interface enp2s0)
ip -c a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
       valid_lft forever preferred_lft forever
2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

# make a backup of the config file (just in case)

# backup the Debian primary network config file
mkdir -p /backup/etc/network
cp -rv /etc/network/interfaces /backup/etc/network/interfaces
# backup the systemd primary network config file
cp -rv /etc/systemd/resolved.conf /backup/etc/network/interfaces

# systemd based systems
vim /etc/systemd/resolved.conf
#  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.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
# See resolved.conf(5) for details

FallbackDNS= ::1

# how it used to be
vim /etc/network/interfaces

# in Debians prior to systemd (so guess all the dns-nameserver settings here will be ignored? X-D)
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# === enp2s0:config primary network interface with dhcp ===
allow-hotplug enp2s0
iface enp2s0 inet dhcp
# + custom primary (!) dns server
# + CloudFlare DNS as fallback

# === enp2s0:0 ===
# add another fixed ip (virtual interface:0) address to this interface for easier lan networking 

auto enp2s0:0
allow-hotplug enp2s0:0
iface enp2s0:0 inet static
# gateway

auto enp2s0:1
allow-hotplug enp2s0:1
iface enp2s0:1 inet static
# gateway

auto enp2s0:2
allow-hotplug enp2s0:2
iface enp2s0:2 inet static
# gateway


# test the settings
service networking restart

# check if it worked
ip -c a

# check if systemd updated resolv.conf
cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

# test if routing is working

# test if dns is working
host has address has address has address has address has address has address has IPv6 address 2001:4998:24:120d::1:0 has IPv6 address 2001:4998:24:120d::1:1 has IPv6 address 2001:4998:124:1507::f001 has IPv6 address 2001:4998:44:3507::8001 has IPv6 address 2001:4998:44:3507::8000 has IPv6 address 2001:4998:124:1507::f000 mail is handled by 1 mail is handled by 1 mail is handled by 1

test if LibreDNS is working:

browse to:

Links: (Debian’s documentation always has been … complicated … but better than none X-D)

GNU Linux Ubuntu – setup networking with netplan on bash terminal (dhcp+multiple fixed ips (virtual interfaces) on same physical interface) – how to enhance privacy of user’s dns queries

to confuse users even more: nmtui (used to be a Fedora/RedHat/CentOS only network config tool is there in ubuntu too!

linux dns config files – hosts resolv.conf nsswitch.conf – change used nameserver

BIND and DNS – the Phonebook of the internet – Berkeley Internet Name Domain – how to benchmark dns servers (find fastest) – LibreDNS

Amnesia 33 tcp ip stack analysis of open source infrastructure – bar chart Affected Components DNS TCP IPv6 IPv4 DHCP ARP IGMP mem allocator 2020-12

Fastest alternatives to Google’s DNS servers for StarLink users – how to manually dig-test dns nameservers

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!