You are not logged in.
I recently did a full system update after 3 months of not using this machine. Unfortunately the update broke dnsmasq and I can no longer resolve domain names using it; in order to connect to the internet, I have to revert to default dns settings.
I have it configured according to https://wiki.archlinux.org/title/Networ … forwarding, so
/etc/NetworkManager/conf.d/dns.conf:
[main]
dns=dnsmasq
I also have /etc/NetworkManager/dnsmasq.d/dnsmasq.conf with the following settings:
cache-size=1000
conf-file=/etc/NetworkManager/dnsmasq-shared.d/bad_domains.txt
The domain list was gotten from https://raw.githubusercontent.com/notra … omains.txt
Then run `sudo nmcli general reload` with those configs
This setup was working fine for me before I updated all my packages. Now I can only connect to the internet with default dns, not dnsmasq.
systemctl status dnsmasq.service:
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; enabled; preset: disabled)
Active: active (running) since Wed 2024-07-03 00:40:21 BST; 8min ago
Invocation: 7664c35633b44449ae1a96a47c53c407
Docs: man:dnsmasq(8)
Process: 138460 ExecStartPre=/usr/bin/dnsmasq --test (code=exited, status=0/SUCCESS)
Main PID: 138469 (dnsmasq)
Tasks: 1 (limit: 8190)
Memory: 880K (peak: 1.8M)
CPU: 69ms
CGroup: /system.slice/dnsmasq.service
└─138469 /usr/bin/dnsmasq -k --enable-dbus --user=dnsmasq --pid-file
Jul 03 00:40:21 laptop dnsmasq[138469]: DBus support enabled: connected to system bus
Jul 03 00:40:21 laptop dnsmasq[138469]: reading /etc/resolv.conf
Jul 03 00:40:21 laptop dnsmasq[138469]: ignoring nameserver 127.0.0.1 - local interface
Jul 03 00:40:21 laptop dnsmasq[138469]: read /etc/hosts - 3 names
Jul 03 00:42:23 laptop dnsmasq[138469]: reading /etc/resolv.conf
Jul 03 00:42:23 laptop dnsmasq[138469]: using nameserver 100.64.0.7#53
Jul 03 00:42:23 laptop dnsmasq[138469]: using nameserver [router address]#53
Jul 03 00:42:23 laptop dnsmasq[138469]: using nameserver [router address]#53
Any pointers are appreciated, thank you!
Last edited by fopdudel (2024-07-14 14:43:51)
Offline
Does it work when you remove the "conf-file" option?
Offline
Does it work when you remove the "conf-file" option?
No, still same result with that option removed
Offline
So it turns out I was missing the
listen-address=::1,127.0.0.1
line (https://wiki.archlinux.org/title/Dnsmasq#DNS_server)
I added that and it's now working*. Though I'm not sure why it was working before the update. Maybe the update overwrote that line?
*The first time I try to visit websites it says "Server not found", but websites load after a few refreshes. And then after that they load fine.
Offline
As far as I understand the wiki article NetworkManager itself sets this parameter - no need to specify any basic dnsmasq configuration - although additional configuration may be specified via "/etc/NetworkManager/dnsmasq.d"
Offline
As far as I understand the wiki article NetworkManager itself sets this parameter - no need to specify any basic dnsmasq configuration - although additional configuration may be specified via "/etc/NetworkManager/dnsmasq.d"
Huh. Yeah, it also stopped working again shortly after I replied. So really unsure as to what the problem is.
Offline
Does the "/etc/resolv.conf" look o.k.?
Can you resolve names via
drill archlinux.org @127.0.0.1
?
Offline
Does the "/etc/resolv.conf" look o.k.?
Can you resolve names via
drill archlinux.org @127.0.0.1
?
Nope
;; ->>HEADER<<- opcode: QUERY, rcode: REFUSED, id: 34167
;; flags: qr rd ra ; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;; archlinux.org. IN A
;; ANSWER SECTION:
;; AUTHORITY SECTION:
;; ADDITIONAL SECTION:
;; Query time: 0 msec
;; SERVER: 127.0.0.1
;; WHEN: Sat Jul 13 21:51:00 2024
;; MSG SIZE rcvd: 31
Offline
Well - the error code REFUSED is some kind of progress - at least: A fresh NM/dnsmasq installation doesn't show this behavior.
Please post the output of those commands ("ss" with root privileges):
ps auxfww | grep NetworkManager
ss -l -u -n -p
Offline
$ ps auxfww | grep NetworkManager
root 576 0.6 0.3 954204 25320 ? Ssl 11:43 0:13 /usr/bin/NetworkManager --no-daemon
myname 68835 0.0 0.0 6824 3800 pts/0 S+ 12:18 0:00 \_ grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox NetworkManager
$ sudo ss -l -u -n -p
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
UNCONN 0 0 0.0.0.0:53 0.0.0.0:* users:(("dnsmasq",pid=627,fd=4))
UNCONN 0 0 0.0.0.0:59646 0.0.0.0:*
UNCONN 0 0 *:53 *:* users:(("dnsmasq",pid=627,fd=6))
UNCONN 0 0 [fe80::6caa:1dc8:3a93:ac13]:546 *:* users:(("NetworkManager",pid=576,fd=22))
UNCONN 0 0 *:59646 *:*
Offline
This looks like dnsmasq is running as it's own service - which will not work.
This is how a correct combo should look like:
root 320 0.1 1.2 412052 24072 ? Ssl 15:40 0:00 /usr/bin/NetworkManager --no-daemon
nobody 340 0.0 0.2 14256 5504 ? S 15:40 0:00 \_ /usr/bin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/run/NetworkManager/dnsmasq.pid --listen-address=127.0.0.1 --cache-size=400 --clear-on-reload --conf-file=/dev/null --enable-dbus=org.freedesktop.NetworkManager.dnsmasq --conf-dir=/etc/NetworkManager/dnsmasq.d
State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
UNCONN 0 0 127.0.0.1:53 0.0.0.0:* users:(("dnsmasq",pid=340,fd=4))
As you can see, NetworkManager spawns it's own dnsmasq instance with PID 340 that is the one listening on the loopback port 53.
Please check if you have an active systemd unit for dnsmasq:
systemctl status dnsmasq
If that's the case disable it and remove/move dnsmasq's own configuration.
Offline
This looks like dnsmasq is running as it's own service - which will not work.
This is how a correct combo should look like:
root 320 0.1 1.2 412052 24072 ? Ssl 15:40 0:00 /usr/bin/NetworkManager --no-daemon nobody 340 0.0 0.2 14256 5504 ? S 15:40 0:00 \_ /usr/bin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/run/NetworkManager/dnsmasq.pid --listen-address=127.0.0.1 --cache-size=400 --clear-on-reload --conf-file=/dev/null --enable-dbus=org.freedesktop.NetworkManager.dnsmasq --conf-dir=/etc/NetworkManager/dnsmasq.d
State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess UNCONN 0 0 127.0.0.1:53 0.0.0.0:* users:(("dnsmasq",pid=340,fd=4))
As you can see, NetworkManager spawns it's own dnsmasq instance with PID 340 that is the one listening on the loopback port 53.
Please check if you have an active systemd unit for dnsmasq:
systemctl status dnsmasq
If that's the case disable it and remove/move dnsmasq's own configuration.
Thank you so much, this was it. I've disabled dnsmasq's service and the dns caching works perfectly now.
Offline