[Dnsmasq-discuss] Avoid conflicts between dnsmasq and systemd-resolved.
Hongyi Zhao
hongyi.zhao at gmail.com
Thu Sep 17 00:25:43 BST 2020
On Thu, Sep 17, 2020 at 7:02 AM Hongyi Zhao <hongyi.zhao at gmail.com> wrote:
>
> Further testing again:
>
> Even I don't use the dnsasmq resolver in systemd, the problem still
> will appear. See following for more info:
>
> $ resolvectl status | grep 'DNS Server'
> Current DNS Server: 114.114.114.114
> DNS Servers: 114.114.114.114
> DNS Servers: 114.114.114.114
> Current DNS Server: 114.114.114.114
> DNS Servers: 114.114.114.114
> DNS Servers: 114.114.114.114
>
>
> werner at X10DAi-01:~$ pgrep -ax dnsmasq
> 26163 /usr/local/sbin/dnsmasq --port=6054
> --servers-file=/home/werner/Public/anti-gfw/dns/dnsmasq/conf/servers-file/cn
> -C /home/werner/Public/anti-gfw/dns/dnsmasq/conf/cn-dns.conf
> 26174 /usr/local/sbin/dnsmasq --port=53 -c10240
> --server=127.0.0.1#6053
> --conf-dir=/home/werner/Public/anti-gfw/dns/dnsmasq/conf/conf-dir,*.conf
> --hostsdir=/home/werner/Public/anti-gfw/dns/dnsmasq/conf/hostsdir -C
> /home/werner/Public/anti-gfw/dns/dnsmasq/conf/dnsmasq.conf
> werner at X10DAi-01:~$ dig www.baidu.com ANY @127.0.0.1
> ^C
> werner at X10DAi-01:~$ pgrep -ax dnsmasq
> 26163 /usr/local/sbin/dnsmasq --port=6054
> --servers-file=/home/werner/Public/anti-gfw/dns/dnsmasq/conf/servers-file/cn
> -C /home/werner/Public/anti-gfw/dns/dnsmasq/conf/cn-dns.conf
> 26174 /usr/local/sbin/dnsmasq --port=53 -c10240
> --server=127.0.0.1#6053
> --conf-dir=/home/werner/Public/anti-gfw/dns/dnsmasq/conf/conf-dir,*.conf
> --hostsdir=/home/werner/Public/anti-gfw/dns/dnsmasq/conf/hostsdir -C
> /home/werner/Public/anti-gfw/dns/dnsmasq/conf/dnsmasq.conf
> 40020 /usr/local/sbin/dnsmasq --port=53 -c10240
> --server=127.0.0.1#6053
> --conf-dir=/home/werner/Public/anti-gfw/dns/dnsmasq/conf/conf-dir,*.conf
> --hostsdir=/home/werner/Public/anti-gfw/dns/dnsmasq/conf/hostsdir -C
> /home/werner/Public/anti-gfw/dns/dnsmasq/conf/dnsmasq.conf
> 40021 /usr/local/sbin/dnsmasq --port=6054
> --servers-file=/home/werner/Public/anti-gfw/dns/dnsmasq/conf/servers-file/cn
> -C /home/werner/Public/anti-gfw/dns/dnsmasq/conf/cn-dns.conf
>
>
> So, I think there should some bugs in dnsmasq corresponding to this problem.
Finally, I pinpointed the problem. See my following testings for more info.
Put it simply, if I start dnsmasq like the following, then the problem
will disappear:
$ pgrep -ax dnsmasq
50789 /usr/local/sbin/dnsmasq --port=53 -c10240
--server=127.0.0.1#6053 -C
/home/werner/Public/anti-gfw/dns/dnsmasq/conf/dnsmasq.conf
werner at X10DAi-01:~$ dig www.baidu.com ANY @127.0.0.1
; <<>> DiG 9.16.1-Ubuntu <<>> www.baidu.com ANY @127.0.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14805
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;www.baidu.com. IN ANY
;; ANSWER SECTION:
www.baidu.com. 866 IN CNAME www.a.shifen.com.
;; Query time: 52 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Thu Sep 17 07:20:05 CST 2020
;; MSG SIZE rcvd: 69
werner at X10DAi-01:~$ pgrep -ax dnsmasq
50789 /usr/local/sbin/dnsmasq --port=53 -c10240
--server=127.0.0.1#6053 -C
/home/werner/Public/anti-gfw/dns/dnsmasq/conf/dnsmasq.conf
So the problem is caused by the following dnsmasq instance:
$ /usr/local/sbin/dnsmasq --port=6054
--servers-file=/home/werner/Public/anti-gfw/dns/dnsmasq/conf/servers-file/cn
-C /home/werner/Public/anti-gfw/dns/dnsmasq/conf/cn-dns.conf
But I still can't figure out what's the wrong configuration or
**bug** (may or may not exist, I'm not sure.) in dnsmasq itself
triggered this problem.
Regards,
--
Hongyi Zhao <hongyi.zhao at gmail.com>
More information about the Dnsmasq-discuss
mailing list