2

I am trying to configure a DNS cache with dnsmasq. The server responds to the query, but the response time is exactly the same as the Cloudflare DNS. To test the DNS Server I have removed any internet DNS Server from my computer and also in the dnsmasq config file.

Here my /etc/dnsmasq.conf

domain=raspberry.local
resolv-file=/etc/resolv.dnsmasq
min-port=4096
cache-size=10000

I have tried for example:

dig facebook.it

and the Query time is circa 85 msec, end this is the exactly tile that I have if I use Clodflare DNS. maybe there is something that I don't understand, but I think that a Query time should be less than 10 msec if I use a local cache DNS.

Here the content of the file /etc/resolv.conf

# Generated by resolvconf
# Domain
search xxxxxxx
# CloudFlare Servers
nameserver 1.1.1.1
nameserver 1.0.0.1
search lan
nameserver 127.0.0.1

I don't try 127.0.0.1 because I use the DNS server on raspberry pi for the rest of lan. I have tried dig facebook.com and the response arrive from 192.168.100.5 that is the raspberry pi LAN IP


Here the content of the file /etc/resolv.conf

# Generated by resolvconf
# Domain
search xxxxxxx
# CloudFlare Servers
nameserver 1.1.1.1
nameserver 1.0.0.1
search lan
nameserver 127.0.0.1

I don't try 127.0.0.1 because I use the DNS server on raspberry pi for the rest of lan. I have tried dig facebook.com and the response arrive from 192.168.100.5 that is the raspberry pi LAN IP

0

1 Answer 1

1

If you really want to use your dnsmasq as caching DNS and also allow the rest of the LAN to connect to it:

Remove the upstream nameservers from your resolv.conf:

# Generated by resolvconf
# Domain
search xxxxxxx
search lan
nameserver 127.0.0.1

You don't need the cloudflare DNS servers here. You can add them in the configuration files that dnsmasq uses. Then, configure dnsmasq in dnsmasq.conf as follows:

domain=raspberry.local
resolv-file=/etc/resolv.dnsmasq
min-port=4096
cache-size=10000
listen-address=<your_local_ip_address_here>
bind-interfaces
port=53

Now, to use the upstream nameservers you want (for example the Cloudflare one), add them to /etc/resolv.dnsmasq:

nameserver 1.1.1.1

Afterwards, simply restart dnsmasq, and you should be done:

sudo systemctl restart dnsmasq

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .