I set up a DNS server using dnsmasq, but it seems that it doesn't work properly. The networking delay is up to hundreds of millisecs.
PING [server] ([server]) 56(84) bytes of data.
64 bytes from [server]: icmp_seq=1 ttl=50 time=583 ms
64 bytes from [server]: icmp_seq=2 ttl=50 time=583 ms
64 bytes from [server]: icmp_seq=3 ttl=50 time=583 ms
64 bytes from [server]: icmp_seq=4 ttl=50 time=583 ms
64 bytes from [server]: icmp_seq=5 ttl=50 time=583 ms
64 bytes from [server]: icmp_seq=6 ttl=50 time=583 ms
64 bytes from [server]: icmp_seq=7 ttl=50 time=583 ms
64 bytes from [server]: icmp_seq=8 ttl=50 time=583 msThen soon I discovered that it'll turn all right with using the default resolver systemd-resolved. By checking the log, I got the messages here below:
Jul 27 13:32:53 dnsmasq[3780]: query[A] ntp.ubuntu.com from 127.0.0.1
Jul 27 13:32:53 dnsmasq[3780]: forwarded ntp.ubuntu.com to 127.0.0.53
Jul 27 13:32:53 dnsmasq[3780]: query[A] ntp.ubuntu.com from 127.0.0.1
Jul 27 13:32:53 dnsmasq[3780]: forwarded ntp.ubuntu.com to 127.0.0.53
[countless records repeating these above...]
Jul 27 13:32:53 dnsmasq[3780]: Maximum number of concurrent DNS queries reached (max: 150)
Jul 27 13:32:54 dnsmasq[3780]: query[A] ntp.ubuntu.com from 127.0.0.1
Jul 27 13:32:54 dnsmasq[3780]: forwarded ntp.ubuntu.com to 127.0.0.53
[...]
[probably the sigterm was sent here?]
Jul 27 13:32:57 dnsmasq[3780]: query[A] ntp.ubuntu.com from 127.0.0.1
Jul 27 13:32:57 dnsmasq[3780]: forwarded ntp.ubuntu.com to 127.0.0.53
Jul 27 13:32:58 dnsmasq[3780]: no servers found in /run/dnsmasq/resolv.conf, will retry
Jul 27 13:32:58 dnsmasq[3780]: query[A] ntp.ubuntu.com from 127.0.0.1
Jul 27 13:32:58 dnsmasq[3780]: query[A] ntp.ubuntu.com from 127.0.0.1
Jul 27 13:32:58 dnsmasq[3780]: query[A] ntp.ubuntu.com from 127.0.0.1
Jul 27 13:32:58 dnsmasq[3780]: query[A] ntp.ubuntu.com from 127.0.0.1
Jul 27 13:32:58 dnsmasq[3780]: query[A] ntp.ubuntu.com from 127.0.0.1
Jul 27 13:32:58 dnsmasq[3780]: exiting on receipt of SIGTERMSo.. How to resolve this problem which makes me crazy, plz :(
The content from dnsmasq.conf is here:
strict-order
resolv-file=/etc/resolv.conf.dnsmasq
listen-address=0.0.0.0
server=/
server=/
server=/*.cn/100.100.2.136
server=/*.cn/100.100.2.138
bogus-nxdomain=100.100.2.136
bogus-nxdomain=100.100.2.138
log-queries
log-facility=/var/log/dnsmasq/dnsmasq.log
log-async=50
#EOFAnd resolv.conf.dnsmasq:
nameserver 100.100.2.136
nameserver 100.100.2.138
nameserver 208.67.222.123
nameserver 208.67.220.123
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 1.2.4.8
nameserver 210.2.4.8
nameserver 208.67.222.222
nameserver 208.67.220.220resolv.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
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 127.0.0.53
options timeout:2 attempts:3 rotate single-request-reopen 2 1 Answer
Resolved. Just simply add an entry bind-interfaces to dnsmasq.conf and start the two DNS resolvers.
And make sure that systemd-resolved listens on 127.0.0.53:53.
[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
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 127.0.0.1
options timeout:2 attempts:3 rotate single-request-reopen
[netstat -apn | grep 53]
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 10122/dnsmasq
tcp 0 0 172.18.129.180:53 0.0.0.0:* LISTEN 10122/dnsmasq
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 10066/systemd-resolved
udp 0 0 127.0.0.1:53 0.0.0.0:* 10122/dnsmasq
udp 0 0 172.18.129.180:53 0.0.0.0:* 10122/dnsmasq
udp 0 0 127.0.0.53:53 0.0.0.0:* 10066/systemd-resolved
unix 3 [ ] STREAM CONNECTED 590253 1121/master
[dnsmasq.log]
Jul 28 12:31:57 dnsmasq[10122]: query[A] from 127.0.0.1
Jul 28 12:31:57 dnsmasq[10122]: forwarded to 127.0.0.53
Jul 28 12:31:57 dnsmasq[10122]: reply is <CNAME>
Jul 28 12:31:57 dnsmasq[10122]: reply stackexchange.com is 151.101.129.69
Jul 28 12:31:57 dnsmasq[10122]: reply stackexchange.com is 151.101.193.69
Jul 28 12:31:57 dnsmasq[10122]: reply stackexchange.com is 151.101.65.69
Jul 28 12:31:57 dnsmasq[10122]: reply stackexchange.com is 151.101.1.69
[nslookup
Server: 127.0.0.1
Address: 127.0.0.1#53
Non-authoritative answer: canonical name = stackexchange.com.
Name: stackexchange.com
Address: 151.101.193.69
Name: stackexchange.com
Address: 151.101.1.69
Name: stackexchange.com
Address: 151.101.65.69
Name: stackexchange.com
Address: 151.101.129.69 2