Rescached
rescached is a daemon that caching internet name and address on local memory for speeding up DNS resolution.
rescached is not a reimplementation of a DNS server like BIND. The primary goal of rescached is only to cache DNS queries and answers to minimize unneeded traffic to the outside network. It is intended for personal systems or serving a small group of users.
Features
List of current features,
- Enable to handle request from UDP and TCP connections
- Enable to forward request using UDP or TCP
- Load and serve addresses and host names in /etc/hosts
- Load and serve hosts formatted files inside directory /etc/rescached/hosts.d/
- Blocking ads and/or malicious websites through host list in /etc/rescached/hosts.d/
- Support loading and serving zone file format from /etc/rescached/zone.d
- Integration with openresolv
- Support DNS over TLS (DoT) (RFC 7858)
- Support DNS over HTTPS (DoH) (RFC 8484)
How cache in rescached works
Each DNS record in cache have the time last accessed field, which defined how the cache will be ordered in memory. The last queried host-name will be at the bottom of cache list, and the oldest queried host-name will at the top of cache list.
The following table illustrate list of caches in memory,
Accessed At | Hostname |
---|---|
2018-01-01 00:00:01 | kilabit.info |
2018-01-01 00:00:02 | archlinux.org |
... | ... |
2018-01-01 00:01:00 | wiki.archlinux.org |
Every cache.prune_delay
(let say every 5 minutes), rescached will try to pruning old records from cache.
If the accessed-at value of record in cache is less than current-time + cache.threshold
(remember that "cache.threshold" value must be negative) it will remove the record from cache.
Installation
Install the rescached-gitAUR package.
Post-installation configuration
The default configuration enables a direct start of the daemon.
Rescached configuration resides in /etc/rescached/rescached.cfg
. Select entries to change are:
- Set your parent DNS server
- Change the value of
parent
based on your preferred DNS server.
- Set the cache prune delay and threshold
- Edit rescached configuration, /etc/rescached/rescached.cfg, change the value of cache.prune_delay and/or cache.threshold to match your needs.
After editing the configuration file, modify the resolv.conf file and replace the current set of resolver addresses with loopback address
nameserver 127.0.0.1
Other programs may overwrite this setting; see Domain name resolution#Overwriting of /etc/resolv.conf for details.
Finally, enable and start rescached.service
.
Integration with OpenResolv
Rescached can detect change on "resolv.conf" file generated by resolvconf. To use this feature set the "file.resolvconf" to "/etc/rescached/resolv.conf" in configuration file. In "/etc/resolvconf.conf" set either "dnsmasq_resolv", "pdnsd_resolv", or "unbound_conf" to point to the same file "/etc/rescached/resolv.conf".
Web user interface
The rescached service provide a web user interface that can be accessed at http://127.0.0.1:5380. The following user interfaces are available on the latest release,
The front page allow user to monitor active caches, query the caches, and removing the caches.
The Environment page allow user to modify the rescached configuration on the fly.
The Hosts Blocks page allow user to enable or disable the external sources of hosts blocks list.
The Hosts.d page allow user to manage hosts file, creating new hosts file, create new record, or delete a record.
The Zone.d page allow user manage zone file, creating new zone file, adding or deleting new resource record in the zone file.
See also
- For more information and configuration see the manpage of rescached.cfg(5)
- Report bug and feature requests are preferred on the GitHub