Skip to content
This repository has been archived by the owner. It is now read-only.
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
AUR @ 557c4d6

RESCACHED(1) Manual Page


rescached - resolver (domain name service) cache daemon.


rescached rescached.cfg


rescached.cfg is rescached configuration, usually it reside in /etc/rescached/rescached.cfg.


rescached is a daemon that caching internet name and address on local memory when running and in local disk when not running.

rescached is not a reimplementation of DNS server like BIND.

rescached primary goal is only to caching DNS queries and answers, used by personal or small group of users, to minimize unneeded traffic to outside network.


  • Enable to handle request from UDP and TCP connections.

  • Saving/loading cache to/from disk.

  • Load and serve addresses and hostnames in /etc/hosts.

  • Load and serve addresses and hostnames from all files inside directory /etc/rescached/hosts.d/, recursively.

  • Blocking ads and/or malicious websites through list in /etc/rescached/hosts.d/hosts.block.

Behind The DNS

When you open a website, let say, in a browser, the first thing that browser do is to translate name address into an internet address (e.g.: so browser can make a connection to server.

How browser do that?

First, it will send query to one of DNS server listed in your system configuration (i.e. /etc/resolv.conf in Linux). Then, if your DNS server also "caching" the name that you requested, it will reply the answer (internet address) directly, if it is not then it will ask their parent DNS server.

+----+      +----------------+      +------------------+
| PC | <==> | ISP DNS Server | <==> | Other DNS Server | <==> ...
+----+      +----------------+      +------------------+

If you browsing frequently on the same site, hitting the refresh button, opening another page on the same website, etc; this procedures will always repeated every times, not including all external links like ads, social media button, or javascripts from an other server.

To make this repetitive procedures less occurred, you can run rescached in your personal computer. The first time the answer is received in your local computer, rescached will saved it in computer memory and any subsequent request of the same address will be answered directly by rescached.

+----+      +----------------+      +------------------+
| PC |      | ISP DNS Server | <==> | Other DNS Server | <==> ...
+----+      +----------------+      +------------------+
  ^^             ^^
  ||             ||
  vv             ||
+-----------+    ||
| rescached | <==//

The only request that will be send to your DNS server is the one that does not already exist in rescached cache.

How Cache in rescached Works

This section explain the simplified version of how internal program works.

Each query and answer data in cache have a number of accessed field, which defined how the cache will be ordered in memory. The frequently queried host-name will be at the top of cache list, and less queried host-name will at the bottom of cache list. The following table show an example of list of cache with number of frequently accessed in the first column, and name of host in the second column.

| #   | host-name        |
| 529 |     |
| 233 |   |
| ... |        ...       |
| 1   | |

The number of cache that rescached can hold in memory is depend on the value of cache.max in configuration file. When the number of cache in memory reached it cache.max value, it will remove all cache data that has the number of frequently accessed less than or equal to cache.threshold.



  • GNU C++ compiler.

  • GNU make.

  • git SCM.

  • asciidoc, for generate manual page.

  • systemd or system V init tool for service.

Compiling From Source

To build rescached from the source, follow the procedures bellow,

$ git clone rescached.git
$ cd rescached.git/src
$ git submodule init
$ git submodule update
$ make


After program successfully build, you can install it manually or using GNU make program.

Installing Using GNU make Program

In Linux system with init.d use,

$ sudo make install-init

In Linux system with systemd use,

$ sudo make install

Manual Installation

  • Copy rescached configuration to system directory. Assume that we use directory "/etc/rescached" as configuration directory, then

    $ sudo mkdir -p /etc/rescached
    $ sudo cp rescached.cfg /etc/rescached
  • Create directory for cache file. In this example we use "/var/cache/rescached" as cache directory,

    $ sudo mkdir -p /var/cache/rescached

    If you use different cache directory, do not forget to change the configuration option.

  • Copy rescached program to your system path.

    $ sudo cp build/rescached /usr/sbin
  • Create system startup script.

    If you want your program running each time the system is starting up you can create a system startup script (or system service). You can see an example for init.d startup script in file scripts/ or scripts/rescached.arch.

    This step is really different between each system, consult your distribution wiki, forum or mailing-list for how to create system startup script.

Post Installation Configuration

  • Set your parent DNS server.

    Edit rescached configuration, /etc/rescached/rescached.cfg, change the value of server.parent based on your preferred DNS server.

  • Set maximum caches and cache threshold

    Edit rescached configuration, /etc/rescached/rescached.cfg, change the value of cache.max and/or cache.threshold to match your needs.

  • Set your system DNS server to point to rescached.

    In UNIX system,

    $ sudo mv /etc/resolv.conf /etc/
    $ sudo echo "nameserver" > /etc/resolv.conf
  • If you use systemd, run rescached service by invoking,

    $ sudo systemctl start rescached.service

    and if you want rescached service to run when system startup, enable it by invoking,

    $ sudo systemctl enable rescached.service


All rescached startup option located in file /etc/rescached/rescached.cfg. See manual page of rescached.cfg(5) for more information.


Upon success, rescached will return 0, or 1 otherwise.



If the value is set to non zero before running, rescached will print debug output from libvos (the library that is used to build the program) to screen and log file. The output of debug is different from debug option.



The rescached main configuration. This configuration will be read when program started.


Directory that will be scanned by rescached for custom host files, recursively. Its means if its contain sub directory, all files in those sub directory will be loaded too.


List of ads server hostname that will blocked by the rescached. This file will be loaded when program started.


System hostname to address mapping. This file will be loaded when program started.


Script to update list of ads/malware hosts in /etc/rescached/hosts.d/hosts.block. After executing this script, you must restart rescached.


The cache file. This file will be read when program started and written when program exit.


File where process ID of rescached will be saved when running.


This program has been debugged extensively with Valgrind and has no memory leak.

This program developed with reference to,


Domain Names - Concepts and Facilities.


Domain Names - Implementation and Specification.


DNS Extensions to support IP version 6.


A DNS RR for specifying the location of services (DNS SRV)


rescached only know specific DNS record type,


a host address


an authoritative name server


a canonical name for an alias


zone authority


a domain name pointer


host information


mail exchange


text string


location of services


a host address for IPv6

rescached only run and tested in Linux system. Technically, if it can compiled, it will run in any UNIX system.

For request of features and/or bugs report please submitted through web at


rescached is developed by M. Shulhan (



Copyright 2009-2017, M. Shulhan ( All rights reserved.

Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Source code repository:


rescached.cfg(5), resolver(1)