Increasing DNS Cache Size
-
With Pi-Hole on Gold as a Docker Image, my network performance seemed much faster. However, all I want is the DNS Boost from caching. By default, I believe Pi-Hole is set at 10000 queries - which was adviced not to go beyond that limit. It looks like Firewalla has a cache size of 1500. I wasn't sure if increasing this value would have negative consequences (especially if it is per-device cache). If I could experiment with the size, where would I enter the value. I've set up a fire router configuration file with a size of 5000, but it gets reset upon reboot. So I have Cron Jobs to set it and reload DNS service at boot any help?
-
I removed the Pi-Hole docker container since I already have NextDNS and Firewalla working in tandem doing ad blocking. Since I have a DSL internet connection, any performance boost I can get would go a long way. Minimizing DNS requests via caching would really help with my scenario. So increasing the cache size value seems more logical than running a full blown Ad Blocking server to obtain that additional caching.
-
Also I'm sure there is a better way to accomplish this than what I have currently set up. In order to increase the cache size, I've altered a firerouter DNS configuration file - changing cache size from 1500 to 5000. I made that change using sed via a user crontab at reboot and then a delayed root crontab at reboot to restart the firerouter DNS service via systemctl. So yeah, I believe there is a better way to accomplish this than my current situation.
-
Not really, but I didn't want to set it to 10000 immediately since Firewalla handles the cache per device and the initial value is so low (1500) for some reason, I guess. What I did was an experiment and not ideal or permanent - which is why I'm asking for help and suggestions at Firewalla for what I'm trying to achieve instead of relying on a unusual workaround (if it even works at all).
-
If anyone else is interested in how I increased the DNS Cache Size for Firewalla, this is what I came up with.
1. Create a new shell script called dns-cache-size.sh within /home/pi.
2. Copy and paste the following into a terminal using 'nano /home/pi/dns-cache-size.sh':#!/bin/bash
cd /home/pi/firerouter/etc
for i in *.conf
do
sed -i 's/cache-size=1000/cache-size=10000/g' "$i"
sed -i 's/cache-size=1500/cache-size=10000/g' "$i"
done- Save it with Ctrl-X
3. Now Make it executable:
chmod +x /home/pi/dns-cache-size.sh4. Edit Crontab by doing the following:
crontab -eThen enter,
@reboot /home/pi/dns-cache-size.sh
5. Create a crontab using root (which has permissions to use systemctl)
sudo su
crontab -eEnter the following:
@reboot sleep 60 && systemctl restart firerouter_dns.service
6. Finally, reboot Firewalla using the mobile app.
Comments and suggestions welcome.
Please sign in to leave a comment.
Comments
8 comments