1. Where to find this document
2. About PDNSD
3. Installation
4. Sample configuration file
5. Tweaking configuration files
6. FAQs
7. Credits
http://geocities.com/sunil_tt/pdnsd.txt
PDNSD is a caching DNS proxy server. Unlike BIND, it saves the RAM cache to a file and the same is read up by PDNSD for the next Dial-Up session. BIND when acting as a cacheing nameserver on your local Dial-Up machine stores/caches the name to number translation data in your RAM. This is not written back to the hard-disk upon disconnection 'coz it is not intended for a user/site who/which is not always connected to the Net.
PDNSD can be configured to speed up Net Surfing on a Dial-Up connection. Since DNS resolution is referenced from the cached file, time is not wasted on the name to number lookup. This in turn speeds up the name to number translation, which actually accelerates your surfing.
PDNSD is distributed under the GNU/GPL and is available for download at: http://home.t-online.de/home/Moestl/
Redhat RPMS are at:
http://home.t-online.de/home/Moestl/
Debian DEBS are at:
ftp://ftp.debian.org/debian/pool/main/p/pdnsd/pdnsd_1.1.2.a-2_i386.deb
Decompress and untar using
tar zxvf pdnsd-<version>.tar.gzChange directory to pdnsd-<version> and type
$ ./configureConfigure script accepts a number of parameters, see manual.txt file supplied with the PDNSD source. Command line parameters --prefix and --with-distribution are interesting.
$ ./configure --helpwill list all options
I am assuming that you have not specified any command line options. Makefile generated by configure will have the following defaults: (It is worth taking a look at the generated Makefile)
Default installion directory for PDNSD is /usr/local (can be changed with --prefix option to configure). Default location of the PDNSD cache is /var/cache/pdnsd. PDNSD configuration file pdnsd.conf will be found in /etc.
Now type:
$ makeThis will compile pdnsd. I did not face any problem compiling it on both Debian 2.2 and Redhat 6.1. Next su to root, as installation requires root previleges. Then type:
# make installThis step will do the following (quoted from pdnsd manual.txt):
The cache is located at /var/cache/pdnsd/pdnsd.cache.The cache file size will be 4 initially and will grow as and when you browse.This aspect of the /etc/pdnsd.conf viz. 'perm_cache=<value>;'. By default it is set as 512(KB).Increase it according to your judgement and a safe value would be 2048(KB) for a machine having 64MB RAM. The cache file size will be 4 bytes initially and will grow as and when you browse. Cache growth will be observed only after a reboot or after restart of the PDNSD daemon. This is due to the fact that PDNSD saves the RAM cache upon exit only.
PDNSD must be started up each time you boot the system . For this, you have to install start up scripts. rc folder of the source distribution contains startup scripts for Redhat, SuSE and Debian. I have not tested the SuSE scripts.
Do the following depending on your distribution.
nameserver 127.0.0.1
Comment out entries for all other name servers. Start pdnsd by typing /etc/init.d/pdnsd start. Test pdnsd by typing nslookup. On my system it diplays:
Default Server: debian Address: 127.0.0.1 >
Stop pdnsd by typing /etc/init.d/pdnsd stop.
Fire up your editor and add a line like this to the end of your /etc/hosts file:
127.0.0.2 testhost
Save the file and start pdnsd once again. Type nslookup. Inside nslookup type 'testhost'.
> testhost Server: debian Address: 127.0.0.1 Non-authoritative answer: Name: testhost Address: 127.0.0.2If this answer is obtained it shows that your pdnsd is working (remember to remove the last line from /etc/hosts)
Copy pdnsd-{version}/src/rc/Redhat/pdnsd to /etc/rc.d/init.d Stop bind if you have it installed on your system. Edit /etc/resolv.conf and add the following
nameserver 127.0.0.1
Comment out entries for all other name servers. Start pdnsd by typing /etc/rc.d/init.d/pdnsd start. Test pdnsd by typing nslookup. On my system it diplays
Default Server: Redhat Address: 127.0.0.1 >
Stop pdnsd by typing /etc/rc.d/init.d/pdnsd stop.
Fire up your editor and add a line like this to the end of your /etc/hosts file.
127.0.0.2 testhost
Save the file and again start pdnsd. Type nslookup. Inside nslookup type 'testhost'.
> testhost Server: Redhat Address: 127.0.0.1 Non-authoritative answer: Name: testhost Address: 127.0.0.2
If this answer is obtained it shows that your pdnsd is working (remember to remove the last line from /etc/hosts)
global { perm_cache=2048; cache_dir="/var/cache/pdnsd"; max_ttl=204800; run_as="nobody"; paranoid=on; server_port=53; server_ip="127.0.0.1"; } server { ip="202.54.6.5"; timeout=260; interval=900; uptest=none; ping_timeout=500; purge_cache=off; caching=on; } server { ip="202.54.1.30"; timeout=260; interval=900; uptest=none; ping_timeout=500; purge_cache=off; caching=on; } server { ip="202.9.128.6"; timeout=260; interval=900; uptest=none; ping_timeout=500; purge_cache=off; caching=on; } source { ttl=86400; owner="localhost."; serve_aliases=on; file="/etc/hosts"; } /* rr { ttl=86400; owner="localhost."; name="localhost."; a="127.0.0.1"; soa="localhost.","root.localhost.",42,86400,900,86400,86400; } rr { ttl=86400; owner="localhost."; name="1.0.0.127.in-addr.arpa."; ptr="localhost."; soa="localhost.","root.localhost.",42,86400,900,86400,86400; } */
This is a sample working configuration (DNS servers are of VSNL an Indian ISP).You must edit servers section of pdnsd.conf to suit your needs.(Fill in DNS servers of your ISP aginst IP entry). Start PDNSD once more and connect to the Internet. Type nslookup and do a query for say, yahoo.com. The server will respond somthing like:
> yahoo.com Server: debian Address: 127.0.0.1 Non-authoritative answer: Name: yahoo.com Addresses: 204.71.200.245Stop PDNSD and disconnect from the Internet. Start PDNSD again and query for yahoo.com through nslookup. If you are geting the same answer as above , fine have a coffee and relax. Else if, there is something wrong and ....??
[pdnsd.conf]
global { perm_cache=2048; cache_dir="/var/cache/pdnsd"; max_ttl=604800; run_as="nobody"; paranoid=off; server_port=53 server_ip="127.0.0.2"; }[named.conf--relevant section only]
options { directory "/var/cache/bind"; forward first; forwarders {127.0.0.2;202.54.6.1;202.54.1.30}; };ragOO's GNU/Linux machine has local (lo) IP addresses from 127.0.0.1 to 8.This is the same in all GNU/Linux systems and one has the option to specify 127.0.0.2 to be the alternate local server. PDNSD listens on Port 53 and note that 127.0.0.2 is the first forwarder in named.conf. This means that your machine/BIND looks up the PDNSD cached records for a number match of the address you/the client program has requested, if not there then it queries the DNS resolvers of your ISP; in order it goes.
Q. I had some problem with your default installation. The cache was not growing. It was stuck at 4 bytes. I changed permissions to 'nobody' and it started growing. Probably a problem with my configuration. Will you please let me know the correct file permissions for /var/cache/pdnsd and /var/cache/pdnsd/pdnsd.cache ?
A. The best thing is to give the user who runs pdnsd write permissions to the cache directory (and of course to the cache file): chown <user> /var/cache/pdnsd chmod 0700 /var/cache/pdnsd chown <user> /var/cache/pdnsd.cache chmod 0600 /var/cache/pdnsd/pdnsd.cache
Where the permissions can of course be more liberal, if you want. The ones given are the minimum required permissions. The default permissions "make install" sets on the files are also OK. The only important thing is to chown the file. Normally, "make install" should also chown the cache file (maybe a bug? If it didn't for you, please drop me a mail).
Thanks to and (ragOO) for mentioning about 'pdnsd' during one of the ILUG-Cochin meets. ragOO edited and modified the draft heavily and encouraged me to keep on modifying the draft.
Last but not the least, to all users of this elegant program who may have found this rant useful. Enjoy....;