You are not logged in.

#1 2018-09-05 16:02:01

heitorpb
Member
Registered: 2012-01-21
Posts: 46

dnsmasq not using config files when started with NetworkManager

Hello!

I'm trying to make NetworkManager use dnsmasq for dns cache and also use a custom DNS server (OpenNIC). This is my laptop, I'm often travelling and using wifi at cafeterias, I don't want to setup every wifi connection individually.

I followed the [wiki](https://wiki.archlinux.org/index.php/Ne … _split_DNS) and my current setup is:

$ cat /etc/NetworkManager/NetworkManager.conf 
[main]
dns=dnsmasq

$ cat /etc/NetworkManager/dnsmasq.d/cache.conf 
#default cache size: 150
#stored in RAM
cache-size=333

$ cat /etc/NetworkManager/dnsmasq.d/nameserver.conf
# do not read /etc/resolv.conf
#no-resolv

# OpenNIC nameservers :)
server=193.183.98.66
server=87.98.175.85
server=51.255.48.78
server=51.254.25.115 

But dnsmasq is not using these settings. In my config file I set the cache size to be 333, not 400:

$ ps ax | grep dns
 3507 ?        S      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 --proxy-dnssec --enable-dbus=org.freedesktop.NetworkManager.dnsmasq --conf-dir=/etc/NetworkManager/dnsmasq.d

I can see dns cache is working:

$ drill sancalug.org | grep "Query time"
;; Query time: 40 msec

$ drill sancalug.org | grep "Query time"
;; Query time: 0 msec

Any ideas how to solve this?

Offline

#2 2018-09-07 05:48:09

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

Re: dnsmasq not using config files when started with NetworkManager

Why do you think that dnsmasq is not using those settings? The command line options just set the defaults required by NetworkManager, they will not change. Options from /etc/NetworkManager/dnsmasq.d/ get applied on top of them, thus overriding them.

You can check the cache size by sending SIGUSR1 to dnsmasq and looking at the journal:

# pkill -USR1 -x dnsmasq
$ journalctl -u NetworkManager.service -e

Offline

Board footer

Powered by FluxBB