How to repair DNS

Kernels & Hardware, configuring network, installing services

How to repair DNS

Postby fred44nl » 2020-07-10 10:00

My system runs Debian 10 - Buster with kernel 4.19.118-2+deb10u1.
In order to test Pi-hole, I installed this with the script that has to be downloaded.
After testing for some time, I removed Pi-hole with the same script, using the uninstall option.
This must have caused my DNS to be damaged.
In order to try and solve this I installed or reinstalled dnsutils, ifupdown, iproute2, resolvconf.
But this did not repair my DNS.

I found that this can be solved by editing /etc/resolvconf/resolv.conf.d/tail and adding some working nameservers.
After that I ran
Code: Select all
sudo resolvconf -u

The result in /etc/resolv.conf is
Code: Select all
fred44nl@Debian:~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
nameserver 1.1.1.1
nameserver 192.168.1.1


If I remove the 2nd and 3rd line from /etc/resolvconf/resolv.conf.d/tail and run resolve -u again, there is only the 1st line.
which means that DNS is looking on my loacalhost, which does not have a DNS server running.

so, where did it go wrong ??
Debian 10 - Buster on Compulab Fitlet2
User avatar
fred44nl
 
Posts: 196
Joined: 2018-07-14 08:54

Re: How to repair DNS

Postby LE_746F6D617A7A69 » 2020-07-10 20:03

Unless You're using some non-default network setup, the /etc/resolv.conf should be empty, and You should not use/install the resolvconf program at all.
Debian uses the NetworkManager (NM) by default, and by default there's no strictly defined DNS server address. The NM uses UDP port 53 to send DNS queries - so it uses the DNS provided by Your ISP or defined in Your router.

In fact, the NM ignores the /etc/resolv.conf and uses connection configuration from /etc/NetworkManager/system-connections/<your_connection>, and normally no DNS address should be defined in this file.

So basically, the DNS should work fine using standard NM connections - and the question is: how do You create/initialize the connections?
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed
LE_746F6D617A7A69
 
Posts: 280
Joined: 2020-05-03 14:16

Re: How to repair DNS

Postby fred44nl » 2020-07-10 20:30

thank you.
I have a list of all installed packages from some time ago, but there is no NetworkManager on it.
also, I have a copy of my system, made with rsync and again no NetworkManager.
I don't think that I have a special network set-up
it has installed from an iso-file and nothing has been done to network settings.
never had problems with DNS, nor DHCP.
there is a service called resolvconf running and acrive.

don't understand what you mean with " how do You create/initialize the connections?"

almost everything I do is over SSH
my laptop makes connections using Samba
Debian 10 - Buster on Compulab Fitlet2
User avatar
fred44nl
 
Posts: 196
Joined: 2018-07-14 08:54

Re: How to repair DNS

Postby LE_746F6D617A7A69 » 2020-07-10 21:05

fred44nl wrote:I have a list of all installed packages from some time ago, but there is no NetworkManager on it.
also, I have a copy of my system, made with rsync and again no NetworkManager.

NM is installed by default, unless You have non-standard setup.
Can You post the output of:
Code: Select all
dpkg-query -l network-manager

What do You have in the /etc/NetworkManager/system-connections/ directory ?

fred44nl wrote:don't understand what you mean with " how do You create/initialize the connections?"

By default, NM initializes the wired connections automatically. If You don't have NM installed, then You must use tools like ifupdown and manually configure the network.
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed
LE_746F6D617A7A69
 
Posts: 280
Joined: 2020-05-03 14:16

Re: How to repair DNS

Postby Head_on_a_Stick » 2020-07-10 22:38

LE_746F6D617A7A69 wrote:the /etc/resolv.conf should be empty

^ This is incorrect.

LE_746F6D617A7A69 wrote:Debian uses the NetworkManager (NM) by default

Not for all of the desktop options and not if no desktop is selected at all.

LE_746F6D617A7A69 wrote:the NM ignores the /etc/resolv.conf

^ This is also incorrect.

fred44nl wrote:where did it go wrong ?

You didn't read
Code: Select all
man 8 resolvconf

This will show how you are connecting so that we can offer better assistance:
Code: Select all
systemctl status --no-p
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12316
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: How to repair DNS

Postby LE_746F6D617A7A69 » 2020-07-10 23:07

Head_on_a_Stick wrote:Not for all of the desktop options and not if no desktop is selected at all.

Yes, sometimes there are different front-ends used for systemd-notworkd, but everything else holds, unless You'll remove systemd ... or disable the networkd service and configure everything by hand.

By default, the resolv.conf is EMPTY, but after the connection is initialized, it looks like this:
Code: Select all
# Generated by NetworkManager
nameserver 192.168.43.1

So yes, it looks like I've expressed myself not very clear: the resolv.conf is not ignored - it is generated by the NM ;)
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed
LE_746F6D617A7A69
 
Posts: 280
Joined: 2020-05-03 14:16

Re: How to repair DNS

Postby sickpig » 2020-07-10 23:11

fred44nl wrote:so, where did it go wrong ??


check your /etc/dhcp/dhclient.conf, pi-hole doesn't seem to remove entries added by it

reference https://www.dedoimedo.com/computers/linux-network-dns-dhcp-problem.html

edit - corrected /etc/dhcp/dhclient.conf
User avatar
sickpig
 
Posts: 412
Joined: 2019-01-23 10:34

Re: How to repair DNS

Postby fred44nl » 2020-07-11 07:22

the output of "dpkg-query -l network-manager" is:
Code: Select all
fred44nl@Debian:~$ sudo dpkg-query -l network-manager
Gevraagd=(U)onbekend/(I)nstalleren/ve(R)wijderen/(P)wissen/(H)ouden
| Status=Niet/Inst/Conf/Uitgep/halF-geconf/Halfgeïnst/verWacht-trig/Trig-bezig
|/ Fout?=(geen)/heRinst. nodig/ (Status,Fout: hoofdletter=ernstig)
||/ Naam            Versie       Architectuur Omschrijving
+++-===============-============-============-=================================
un  network-manager <geen>       <geen>       (geen beschrijving beschikbaar)
fred44nl@Debian:~$


and "apt policy network-manager" says:
Code: Select all
red44nl@Debian:~$ sudo apt policy network-manager
network-manager:
  Geïnstalleerd: (geen)
  Kandidaat:     1.14.6-2+deb10u1
  Versietabel:
     1.14.6-2+deb10u1 500
        500 http://ftp.nl.debian.org/debian buster/main amd64 Packages
fred44nl@Debian:~$


at the original installation I did choose a very limited setup, as I was used to Rasbian and used to work over SSSH.
Debian 10 - Buster on Compulab Fitlet2
User avatar
fred44nl
 
Posts: 196
Joined: 2018-07-14 08:54

Re: How to repair DNS

Postby fred44nl » 2020-07-11 07:29

Head_on_a_Stick wrote:
LE_746F6D617A7A69 wrote:
fred44nl wrote:where did it go wrong ?

You didn't read
Code: Select all
man 8 resolvconf

yes, true, very true
but I was not changing in the settings of DHCP nor DNS
the problem came from uninstalling Pi-hole

This will show how you are connecting so that we can offer better assistance:
Code: Select all
systemctl status --no-p

Code: Select all
fred44nl@Debian:~$ sudo systemctl status --no-p
● Debian
    State: running
     Jobs: 0 queued
   Failed: 0 units
    Since: Fri 2020-07-10 19:38:03 CEST; 14h ago
   CGroup: /
           ├─user.slice
           │ ├─user-110.slice
           │ │ ├─session-c1.scope
           │ │ │ ├─632 lightdm --session-child 18 21
           │ │ │ └─648 /usr/sbin/lightdm-gtk-greeter
           │ │ └─user@110.service
           │ │   ├─gvfs-daemon.service
           │ │   │ └─663 /usr/lib/gvfs/gvfsd
           │ │   ├─init.scope
           │ │   │ ├─637 /lib/systemd/systemd --user
           │ │   │ └─638 (sd-pam)
           │ │   ├─at-spi-dbus-bus.service
           │ │   │ ├─652 /usr/lib/at-spi2-core/at-spi-bus-launcher
           │ │   │ ├─657 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --pri...
           │ │   │ └─659 /usr/lib/at-spi2-core/at-spi2-registryd --use-gnome-session
           │ │   └─dbus.service
           │ │     └─651 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --sy...
           │ └─user-1000.slice
           │   ├─user@1000.service
           │   │ ├─gvfs-daemon.service
           │   │ │ ├─2880 /usr/lib/gvfs/gvfsd
           │   │ │ └─2929 /usr/lib/gvfs/gvfsd-trash --spawner :1.5 /org/gtk/gvfs/exec_spaw/0
           │   │ ├─gvfs-udisks2-volume-monitor.service
           │   │ │ └─2923 /usr/lib/gvfs/gvfs-udisks2-volume-monitor
           │   │ ├─init.scope
           │   │ │ ├─965 /lib/systemd/systemd --user
           │   │ │ └─966 (sd-pam)
           │   │ └─dbus.service
           │   │   └─2834 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --s...
           │   ├─session-2.scope
           │   │ ├─ 875 sshd: fred44nl [priv]
           │   │ ├─ 980 sshd: fred44nl@pts/0
           │   │ ├─ 981 -bash
           │   │ ├─5896 sudo systemctl status --no-p
           │   │ └─5897 systemctl status --no-p
           │   └─session-c2.scope
           │     ├─2899 /usr/bin/ssh-agent -s
           │     ├─2903 /usr/lib/at-spi2-core/at-spi-bus-launcher --launch-immediately
           │     └─2908 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --prin...
           ├─init.scope
           │ └─1 /sbin/init
           └─system.slice
             ├─systemd-udevd.service
             │ └─292 /lib/systemd/systemd-udevd
             ├─cron.service
             │ └─471 /usr/sbin/cron -f
             ├─polkit.service
             │ └─541 /usr/lib/policykit-1/polkitd --no-debug
             ├─lightdm.service
             │ ├─523 /usr/sbin/lightdm
             │ ├─551 /usr/lib/xorg/Xorg :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
             │ └─684 lightdm --session-child 14 21
             ├─nmbd.service
             │ └─472 /usr/sbin/nmbd --foreground --no-process-group
             ├─systemd-journald.service
             │ └─265 /lib/systemd/systemd-journald
             ├─ssh.service
             │ └─535 /usr/sbin/sshd -D
             ├─xrdp.service
             │ └─536 /usr/sbin/xrdp
             ├─plexmediaserver.service
             │ ├─494 /usr/lib/plexmediaserver/Plex Media Server
             │ ├─629 Plex Plug-in [com.plexapp.system] /usr/lib/plexmediaserver/Resources/Plug-ins-79e214ead/Framework.bu...
             │ ├─770 /usr/lib/plexmediaserver/Plex Tuner Service /usr/lib/plexmediaserver/Resources/Tuner/Private /usr/li...
             │ └─799 Plex Plug-in [com.plexapp.agents.subzero] /usr/lib/plexmediaserver/Resources/Plug-ins-79e214ead/Fram...
             ├─rsyslog.service
             │ └─473 /usr/sbin/rsyslogd -n -iNONE
             ├─dhcpcd.service
             │ └─499 /usr/sbin/dhcpcd
             ├─xrdp-sesman.service
             │ └─514 /usr/sbin/xrdp-sesman
             ├─sabnzbdplus.service
             │ └─681 /usr/bin/python2 /usr/bin/sabnzbdplus --daemon --pidfile /var/run/sabnzbdplus/pid
             ├─ifup@eno1.service
             │ └─852 /sbin/dhcpcd eno1
             ├─udisks2.service
             │ └─484 /usr/lib/udisks2/udisksd
             ├─smbd.service
             │ ├─ 893 /usr/sbin/smbd --foreground --no-process-group
             │ ├─ 895 /usr/sbin/smbd --foreground --no-process-group
             │ ├─ 896 /usr/sbin/smbd --foreground --no-process-group
             │ ├─ 898 /usr/sbin/smbd --foreground --no-process-group
             │ └─1700 /usr/sbin/smbd --foreground --no-process-group
             ├─dbus.service
             │ └─469 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-...
             ├─systemd-timesyncd.service
             │ └─461 /lib/systemd/systemd-timesyncd
             ├─system-getty.slice
             │ └─getty@tty1.service
             │   └─516 /sbin/agetty -o -p -- \u --noclear tty1 linux
             ├─avahi-daemon.service
             │ ├─483 avahi-daemon: running [Debian.local]
             │ └─505 avahi-daemon: chroot helper
             └─systemd-logind.service
               └─482 /lib/systemd/systemd-logind
fred44nl@Debian:~$
Debian 10 - Buster on Compulab Fitlet2
User avatar
fred44nl
 
Posts: 196
Joined: 2018-07-14 08:54

Re: How to repair DNS

Postby Head_on_a_Stick » 2020-07-11 10:18

Looks like you're using ifupdown so you should add the desired nameservers to /etc/network/interfaces: https://wiki.debian.org/NetworkConfigur ... ameservers

LE_746F6D617A7A69 wrote:sometimes there are different front-ends used for systemd-notworkd

Debian does not use systemd-networkd unless configured to do so by the user.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12316
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: How to repair DNS

Postby p.H » 2020-07-11 12:29

Head_on_a_Stick wrote:Looks like you're using ifupdown so you should add the desired nameservers to /etc/network/interfaces

Note that this requires resolvconf else it won't have any effect.
p.H
 
Posts: 1423
Joined: 2017-09-17 07:12

Re: How to repair DNS

Postby Head_on_a_Stick » 2020-07-11 19:24

p.H wrote:this requires resolvconf

Yes indeed, good point. Fortunately the OP is already using that.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12316
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: How to repair DNS

Postby p.H » 2020-07-11 20:20

Indeed, but someone else suggested to not use/install it, so I thought that I'd better warn.
p.H
 
Posts: 1423
Joined: 2017-09-17 07:12

Re: How to repair DNS

Postby fred44nl » 2020-07-12 07:46

sickpig wrote:check your /etc/dhcp/dhclient.conf, pi-hole doesn't seem to remove entries added by it


yes, yes, yes, thank you

I commented the added lines in /etc/dhcp/dhclient out.
also I commented the temporary lines in /etc/resolvconf/resolv.conf.d/tail out.
now my resolv.conf looks like this:
Code: Select all
fred44nl@Debian:~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.1.1
search WORKGROUP
## nameserver 1.1.1.1
## nameserver 192.168.1.1
fred44nl@Debian:~$


and DNS is working.
I did have to reboot, as
Code: Select all
sudo resolvconf -u
was not good enough.
is this because previously (in Stretch) I used dhclient and now in Buster it is resolvconf ??
Debian 10 - Buster on Compulab Fitlet2
User avatar
fred44nl
 
Posts: 196
Joined: 2018-07-14 08:54

Re: How to repair DNS

Postby p.H » 2020-07-12 07:57

You don't use resolvconf instead of dhclient. resolvconf is not a replacement for dhclient. They have totally different roles.
dhclient is a DHCP client, and as such, a DNS information provider.
resolvconf is a framework which manages the contents of /etc/resolv.conf on behalf of any DNS information provider which supports it (/etc/network/interfaces, dhclient, NetworkManager...) instead of each one overwriting /etc/resolv.conf regardless of what another wrote previously.
p.H
 
Posts: 1423
Joined: 2017-09-17 07:12

Next

Return to System configuration

Who is online

Users browsing this forum: No registered users and 6 guests

fashionable