In the spirit of scratch-my-own-itch, I created another DNS cache tool called rescached.
Rescached is a daemon that act as a DNS server, serve the clients queries, but also caching all that queries for later use. Unlike any other name-service daemon, rescached save all of cache objects when program exit and loaded it back to memory when started back.
I have a slow and unstable connection. Back then, I try anything to minimize all outgoing data by caching and tweaking all my traffic (squid, privoxy, web browser caches, blocking images, etc.). Until I found about djbdnsd and I cannot install it. So, long story short I created my own DNS cache. This was a few weeks before I know about pdnsd, and my program already half way finished so I just continue it, beside that I learn many thing about DNS protocol.
Since Archer always want to know what the system do, if you want to view what your system request each time, edit file "/etc/rescached/rescached.cfg" and set option "debug" to "1".
For non-technical explanation you can read it here .
For user documentation you can read it here .
AUR package is here .
Source is here .
Install package from AUR.
Change your name server,
$ sudo cp /etc/resolv.conf /etc/resolv.conf.org $ sudo echo "nameserver 127.0.0.1" > /etc/resolv.conf
$ sudo systemctl restart rescached
Do not forget to restart any application (browser, email, etc) to make it read new /etc/resolv.conf.
All feedbacks is welcome.
Thank you all,
 http://www.kilabit.info/journal/2009/12 … ed_is_here
Update hosts ads.
New config option "server.parent.connection". This allow rescached connect to parent server using UDP or TCP.
Fixes on TCP request handle.
Startup and logs.
Many major fix (memory leaks, DNS type for AAAA, multiple answers, serving /etc/hosts)
Ads blocking by hostname (Credit to http://pgl.yoyo.org for providing the list).
fix link #1 in this post.
rescached updated to version 2010.11.18.2123.
Last edited by ms (2015-07-19 01:37:24)
Sound great, i'll tet it in my system now.
"Yo creo que los muertos son tiernos. ¿Nos besamos?"
Awesome program. It improved my browsing speed very much.
Well, thank you all, especially to superchango and gtklocker for direct replies, for already trying my program.
It's really feel greats to create something that can be useful for others.
Just a quick note, in case some one missed it from the last section in documentation,
There is a problem with DNS caching. Sometimes domain name change their IP address with a new IP address. Since old IP address is already cached in rescached program, and your program still use an old IP address, program cannot connect to the specific domain name. You can notice this happen when the program staled (loading infinitely) or failed to connect.
There is only two solution.
First, stop rescached program, delete the cache file and start the rescached program back. This will start the program back with an empty cache.
Second, stop rescached program, edit cache file, delete specific record based on the domain name that have the problem, and restart the rescached program back. Be careful when doing this, make sure you really delete one record (you can see in cache file that each record start with "domain.name" and end with character "|").
Currently there is no "easy" way (I.e. automatic detection) and simple solution to this problem yet. But, if anyone have an idea or solution I will listen to it.
Last edited by ms (2010-08-31 23:27:38)
Can you do the following ? :
- There is something cached, let's call it "olddata".
- Things have changed since last time so in reality what we need here is "newdata".
1. The user make a request.
2. rescached answers with "olddata".
3. rescached start a query.
4. cache is updated with "newdata".
It doesn't resolve the problem for the first query, but on a second time thing will be ok without any user intervention.
If rescached do that for every request from client, then it break the main
purpose of rescached it self: to minimize traffic to outside network.
What make rescached different with others DNS cache daemon is the caches is
permanent, once the host-name "A" is already cached there is no way the same
query go outside of the network again. I tried to keep it that way. That is
why rescached is best used only for personal use, when DNS traffic data only
about host-name and email address. 
The only solution that come to my mind right now is by using a custom Time To
Live (TTL) value. In example refresh "old-data" if older than 1 day, or 1 week,
which can be customed by user.
I have not tried unbound yet, but thanks for the information, I will leave it
to another Archers for trying it.
NSCD, yes I *knew* it, and I rather not to talk about it.
- - -
 In conclusion, I can say that rescached is a very lite version of pdnsd,
where it keep fast, simple configuration, and minimal resources as possible.
This is an update to rescached.
There is a new option for a new update: cache.mode (in /etc/rescached/rescached.cfg).
if cache.mode is set to 1, all DNS record will be keep forever, no possible query or renewed DNS record happen until the specific DNS record removed from cache.
If cache.mode is set to 2 (default), all DNS record will be keep only after the specific time, based on maximum TTL value in DNS record. If TTL is reached, hostname will be queried again to the DNS parent server, and old cache and TTL will be replaced with a new one.
In non-technical explanation, you do not need to worry again about the problem that I mention above, rescached will handle it automatically. But, there is a consequence: old cache file does not work anymore because the change in cache format file.
A new update is already in AUR.
Last edited by ms (2010-11-24 07:17:23)
Hi, I used rescached for about a month and I was glad because I could still surf the Web while downloading at full speed, though I'm on a asthmatic ADSL line.
But I was getting strange behaviour lately: there was several seconds before pacman downloaded a package list from a mirror (I tried several ones), surfing was stalled while downloading, etc.
Now I've installed dnsmaq and it works out of the box. And then I can surf without even noticing I am downloading at the same time. I still need to "fix" those f*cking OpenDNS servers that reply with their own website on unknown addresses.
Thanks anyway for rescached solving that long-time issue in the first place.
I've been using it for a few days and it's really nice
For unknown reasons some DNS lookups fail (which is probably not the fault of rescached). Whenever this happens, I need to stop rescached, edit/delete the cache file and start it again.
Therefore I propose the following feature: Introduce an articifial TLD like *.new which will force rescached to refresh the domain that's written before .new
example.org --> unreachable
example.org.new --> let rescached check the domain again and return the result
Last edited by essence-of-foo (2011-05-23 07:42:26)
Not trying to be biased here, I have been using the same rescached source, even build and use the same package from AUR, and cannot recall the problem that you had. But, I will try to make more robust test and double check the code next time. Like someone said, network program is a hell of beast, you cannot predict how others use their network.
@essence-of-foo, I can see your point. Technically, if rescached fail at querying to DNS server (i.e: server unreachable or time-out) it will returned nothing. It will just removed from queue and waiting for the next query from client. Your application will see this as normal time-out. Adding a new TLD will just make a lot of work (checking, parsing, etc; if you know what I mean).
Thanks for trying it anyway.
PS: This comment remind me to add IPv6 support to rescached, which I planned to finished before June 8, 2011. I hope I can make it in time.
Just installed this and got it running, so far everything looks great. My quick little benchmark saw dns lookup times from 35->3 and 136->3 for microsoft.com and epcot.com. I think the feature that sold me over on pdnsd was the way the cache will purge all entries less than a certain threshold once it fills. I'm a little uncertain what optimum values would be for those fields but I'm using 100,000/25 for the max/threshold, if anyone wants to get a collection of config setups going. I haven't had time to test this on a day-to-day basis yet, but everything seems to be working fine with no errors so far. Great work, would love to see continued development on this!
Desktop: Arch Linux | AMD Athlon 64 X2 Dual Core 5000+ | 3GB RAM | GeForce 6800 XT 512MB | 1TB+
Audio Studio: XP SP3 | Intel Pentium 4 3GHz Prescott | 1GB DDR | GeForce 6800 128MB | 120GB
Could it be that rescached isn't compatible with up-to-date Arch Systems using systemd?
I get this, when trying to start:
sudo /usr/sbin/rcrescached start
/usr/sbin/rcrescached: Line 3: /etc/rc.conf: File or Directory not found
/usr/sbin/rcrescached: Line 4: /etc/rc.d/functions: File or Directory not found
/usr/sbin/rcrescached: Line 13: stat_busy: Command not found.
/usr/sbin/rcrescached: Line 18: add_daemon: Command not found.
/usr/sbin/rcrescached: Line 19: stat_done: Command not found.
> Could it be that rescached isn't compatible with up-to-date Arch Systems using systemd?
Yes, sorry for that. I don't have time to update the source yet.
For temporary solution you can run it manually by executing /sbin/rescached /etc/rescached/rescached.cfg.
Seems to work nice without systemd, but I got this:
[vos::DNSQuery] extract_rr: (twitter.com) Record type '41' is not handle yet!
So, four years has passed.
I just got spare time and fix the program. Many major improvements,
Fix memory leaks.
Support DNS record type 28 (AAAA or IPv6 for address).
Support reading and server hostname in /etc/hosts.
blocking ads using hostname.
Any feedbacks will be really appreciate. Thank you!
* Using TCP to connect to parent server. This is useful if your ISP block DNS connection (port 53) but forgot to block TCP connection (like my ISP).
If your ISP filtering your traffic (blocking porn, etc) by DNS, or not allowing public DNS, you can try to request using TCP to public DNS server using dig,
$ dig @184.108.40.206 +tcp www.reddit.com
If its works, use rescached as proxy between your computer and public DNS.
* Update hosts ads.
* Fixes on TCP request.
* Ads that being blocked now will be showed in log as "ads blocked" instead of "cached".
* Statistics: show how many bytes that you save when using rescached.
Last edited by ms (2015-07-18 23:31:40)