You are not logged in.

#1 2023-03-14 17:26:47

koko271
Member
Registered: 2022-05-19
Posts: 53

[SOLVED] DNS issue caused by dnsmasq

Hi,
I had previously set up DNS according to the Network Manager and it had been working fine, but recently I met issues with DNS. After some troubleshooting, I found that it appears to be a problem with dnsmasq.
Here is the previous /etc/resolv.conf

# Generated by NetworkManager
nameserver 127.0.0.1
options edns0 trust-ad

it can't work now. It can ping IP address successfully, but cannot domain.
I have edited it as follows:

# Generated by NetworkManager
nameserver 1.1.1.1
options edns0 trust-ad

Everything is ok. This seems like just a temporary workaround. What went wrong? How should I thoroughly fix it?
Thanks!

Last edited by koko271 (2023-03-15 13:28:32)

Offline

#2 2023-03-14 21:22:27

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,508

Re: [SOLVED] DNS issue caused by dnsmasq

I found that it appears to be a problem with dnsmasq.

Based on what?

ss -tulpen
resolvectl status
ps aux | grep -E '(resolv|dns)'

Offline

#3 2023-03-15 03:57:44

koko271
Member
Registered: 2022-05-19
Posts: 53

Re: [SOLVED] DNS issue caused by dnsmasq

seth wrote:

I found that it appears to be a problem with dnsmasq.

Based on what?

ss -tulpen
resolvectl status
ps aux | grep -E '(resolv|dns)'

Because it seems that dnsmasq did not automatically start as described in the wiki.
This is dig output when setting 127.0.0.1:

> dig
;; communications error to 127.0.0.1#53: timed out
;; communications error to 127.0.0.1#53: timed out
;; communications error to 127.0.0.1#53: timed out

; <<>> DiG 9.18.12 <<>>
;; global options: +cmd
;; no servers could be reached

Here is required output when setting 127.0.0.1:https://0x0.st/H-KE.txt

Last edited by koko271 (2023-03-15 07:57:43)

Offline

#4 2023-03-15 07:16:50

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,508

Re: [SOLVED] DNS issue caused by dnsmasq

resolved isn't running, dnsmasq is (apparently started by NM) and something (likely dnsmasq) started by NM is listening on 127.0.0.1:53

Seeing kate, did you add any https://wiki.archlinux.org/title/Networ … figuration or attemt https://wiki.archlinux.org/title/NetworkManager#DNSSEC

Did you https://wiki.archlinux.org/title/Networ … NS_servers ?
(See the blue note!)

Offline

#5 2023-03-15 08:02:24

koko271
Member
Registered: 2022-05-19
Posts: 53

Re: [SOLVED] DNS issue caused by dnsmasq

seth wrote:

resolved isn't running, dnsmasq is (apparently started by NM) and something (likely dnsmasq) started by NM is listening on 127.0.0.1:53

Seeing kate, did you add any https://wiki.archlinux.org/title/Networ … figuration or attemt https://wiki.archlinux.org/title/NetworkManager#DNSSEC

Did you https://wiki.archlinux.org/title/Networ … NS_servers ?
(See the blue note!)

Sorry, I've corrected it. Yes, I change the cache size, like the example on wiki.

Last edited by koko271 (2023-03-15 08:03:50)

Offline

#6 2023-03-15 08:12:54

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,508

Re: [SOLVED] DNS issue caused by dnsmasq

The cache size won't be the issue here, it's more like dnsmasq will probably not ask on to a proper DNS server.

head -c -0 /etc/NetworkManager/dnsmasq.d/*

Offline

#7 2023-03-15 08:15:08

koko271
Member
Registered: 2022-05-19
Posts: 53

Re: [SOLVED] DNS issue caused by dnsmasq

seth wrote:

The cache size won't be the issue here, it's more like dnsmasq will probably not ask on to a proper DNS server.

head -c -0 /etc/NetworkManager/dnsmasq.d/*

The output is

cache-size = 1000

Offline

#8 2023-03-15 11:43:27

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,508

Re: [SOLVED] DNS issue caused by dnsmasq

NM somehow needs to communicate a DNS server for dnsmasq to ask back on, I'd expect that to happen through a config file in /etc/NetworkManager/dnsmasq.d/ and be fed by NMs own DNS configuration.
Since there's no backing DNS server configured for dnsmasq, ite cannot resolve any domains.

=> Please elaborate on your NM DNS configuration, esp. wrt https://wiki.archlinux.org/title/Networ … NS_servers

Offline

#9 2023-03-15 12:34:53

koko271
Member
Registered: 2022-05-19
Posts: 53

Re: [SOLVED] DNS issue caused by dnsmasq

seth wrote:

NM somehow needs to communicate a DNS server for dnsmasq to ask back on, I'd expect that to happen through a config file in /etc/NetworkManager/dnsmasq.d/ and be fed by NMs own DNS configuration.
Since there's no backing DNS server configured for dnsmasq, ite cannot resolve any domains.

=> Please elaborate on your NM DNS configuration, esp. wrt https://wiki.archlinux.org/title/Networ … NS_servers

I didn't customize anything, just like wiki. There is no dns-servers.conf.

/etc/NetworkManager/conf.d/dns.conf
[main]
dns=dnsmasq

Offline

#10 2023-03-15 12:45:51

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,508

Re: [SOLVED] DNS issue caused by dnsmasq

Assuming you simply don't get a DNS via dhcp, add "servers=1.1.1.1,8.8.8.8" w/ https://wiki.archlinux.org/title/Networ … NS_servers

Offline

#11 2023-03-15 13:17:14

koko271
Member
Registered: 2022-05-19
Posts: 53

Re: [SOLVED] DNS issue caused by dnsmasq

seth wrote:

Assuming you simply don't get a DNS via dhcp, add "servers=1.1.1.1,8.8.8.8" w/ https://wiki.archlinux.org/title/Networ … NS_servers

Everything is ok now. Thanks!

Last edited by koko271 (2023-03-15 13:23:55)

Offline

#12 2023-03-15 13:20:40

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,508

Re: [SOLVED] DNS issue caused by dnsmasq

What's the resulting /etc/resolv.conf written by NM?
Does NM still start dnsmasq?

Edit: in doubt juse configure dnsmasq yourself, https://wiki.archlinux.org/title/Dnsmas … forwarding
Obviously use /etc/NetworkManager/dnsmasq.d/dnsmasq.conf

Edit #2: so what was the failing drill test about?

Last edited by seth (2023-03-15 13:24:52)

Offline

#13 2023-03-15 13:25:55

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 714

Re: [SOLVED] DNS issue caused by dnsmasq

seth wrote:

NM somehow needs to communicate a DNS server for dnsmasq to ask back on, I'd expect that to happen through a config file in /etc/NetworkManager/dnsmasq.d/ and be fed by NMs own DNS configuration.

NetworkManager and dnsmasq communicate via dbus. Here's the default command line, dnsmasq is started with:

/usr/bin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/var/run/NetworkManager/dnsmasq.pid --listen-address=127.0.0.1 --cache-size=400 --clear-on-reload --conf-file=/dev/null --proxy-dnssec --enable-dbus=org.freedesktop.NetworkManager.dnsmasq --conf-dir=/etc/NetworkManager/dnsmasq.d

Offline

#14 2023-03-15 13:26:42

koko271
Member
Registered: 2022-05-19
Posts: 53

Re: [SOLVED] DNS issue caused by dnsmasq

seth wrote:

What's the resulting /etc/resolv.conf written by NM?
Does NM still start dnsmasq?

Edit: in doubt juse configure dnsmasq yourself, https://wiki.archlinux.org/title/Dnsmas … forwarding
Obviously use /etc/NetworkManager/dnsmasq.d/dnsmasq.conf

I forget to change resolv.conf back to 127.0.0.1, everything is working fine now. Thanks

Offline

Board footer

Powered by FluxBB