361 lines
15 KiB
HTML
361 lines
15 KiB
HTML
<!--startcut ==============================================-->
|
|
<!-- *** BEGIN HTML header *** -->
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML><HEAD>
|
|
<title>Speeding Up Your Net Browsing with PDNSD Domain Name Caching LG #65</title>
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
|
|
ALINK="#FF0000">
|
|
<!-- *** END HTML header *** -->
|
|
|
|
<CENTER>
|
|
<A HREF="http://www.linuxgazette.com/">
|
|
<H1><IMG ALT="LINUX GAZETTE" SRC="../gx/lglogo.png"
|
|
WIDTH="600" HEIGHT="124" border="0"></H1></A>
|
|
|
|
<!-- *** BEGIN navbar *** -->
|
|
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="stumpel.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue65/sunil.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../faq/index.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="lg_backpage65.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
|
|
<!-- *** END navbar *** -->
|
|
<P>
|
|
</CENTER>
|
|
|
|
<!--endcut ============================================================-->
|
|
|
|
<H4 ALIGN="center">
|
|
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
|
</H4>
|
|
|
|
<P> <HR> <P>
|
|
<!--===================================================================-->
|
|
|
|
<center>
|
|
<H1><font color="maroon">Speeding Up Your Net Browsing with PDNSD Domain Name Caching</font></H1>
|
|
<H4>By <a href="mailto:sunil_tt@yahoo.com">Sunil Thomas Thonikuzhiyil</a></H4>
|
|
</center>
|
|
<P> <HR> <P>
|
|
|
|
<!-- END header -->
|
|
|
|
|
|
|
|
|
|
<p>1. Where to find this document
|
|
<br>2. About PDNSD
|
|
<br>3. Installation
|
|
<br>4. Sample configuration file
|
|
<br>5. Tweaking configuration files
|
|
<br>6. FAQs
|
|
<br>7. Credits
|
|
<h2>
|
|
1. Where to find this document</h2>
|
|
|
|
<p><br><a href="http://geocities.com/sunil_tt/pdnsd.txt">http://geocities.com/sunil_tt/pdnsd.txt</a>
|
|
<h2>
|
|
2. About PDNSD.</h2>
|
|
DNS is is the Domain Name System. DNS converts machine names to the IP
|
|
addresses that all machines on the net have. Name serving on Unix is commonly
|
|
done by a program called named. This is a part of the ``BIND'' package
|
|
which is coordinated by Paul Vixie for The Internet Software Consortium.
|
|
<p>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.
|
|
<p>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.
|
|
<p>PDNSD is distributed under the GNU/GPL and is available for download
|
|
at: <A HREF="http://home.t-online.de/home/Moestl/">http://home.t-online.de/home/Moestl/</A>
|
|
<p>Redhat RPMS are at:
|
|
<p><a href="http://home.t-online.de/home/Moestl/">http://home.t-online.de/home/Moestl/</a>
|
|
<p>Debian DEBS are at:
|
|
<p><a href="ftp://ftp.debian.org/debian/pool/main/p/pdnsd/pdnsd_1.1.2.a-2_i386.deb">ftp://ftp.debian.org/debian/pool/main/p/pdnsd/pdnsd_1.1.2.a-2_i386.deb</a>
|
|
<h2>
|
|
3. Installation.</h2>
|
|
Download pdnsd-<version>.tar.gz from the above source.
|
|
<p>Decompress and untar using
|
|
<pre>tar zxvf pdnsd-<version>.tar.gz</pre>
|
|
Change directory to pdnsd-<version> and type
|
|
<pre>$ ./configure</pre>
|
|
Configure script accepts a number of parameters, see manual.txt file supplied
|
|
with the PDNSD source. Command line parameters --prefix and --with-distribution
|
|
are interesting.
|
|
<pre>$ ./configure --help</pre>
|
|
will list all options
|
|
<p>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)
|
|
<p>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.
|
|
<p>Now type:
|
|
<pre>$ make</pre>
|
|
This 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:
|
|
<pre># make install</pre>
|
|
This step will do the following (quoted from pdnsd manual.txt):
|
|
|
|
<OL>
|
|
<LI>Copies pdnsd to $(prefix)/sbin/ <P>
|
|
<LI>Copies pdnsd-ctl to $(prefix)/sbin/ <P>
|
|
<LI>Copies docs/pdnsd.conf (a sample configuration) to /etc/ (and backs
|
|
up /etc/pdnsd.conf to /etc/pdnsd.conf.old). If you have an /etc/pdnsd.conf.old
|
|
you do not want to be overwritten, save it to another place/name before
|
|
doing 'make install' <P>
|
|
<LI>Creates your cache directory if it is not there. After installation,
|
|
you should check the file permissions and edit /etc/pdnsd.conf to fit your
|
|
needs . If you use the run_as option, please make sure that your cache
|
|
directory is owned by the user you specified with this option! Please note
|
|
that the permission issue has been fixed as of the latest releases. Now
|
|
/usr/local/sbin will contain two binaries pdnsd and pdnsd-ctl. 'pdnsd'
|
|
is the proxy DNS daemon and 'pdnsd-ctl' is a program to control the cache. <P>
|
|
</OL>
|
|
|
|
<p>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.
|
|
<p>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.
|
|
<p>Do the following depending on your distribution.
|
|
<h3>
|
|
3.a) Debian GNU/Linux.</h3>
|
|
Copy pdnsd-{version}/src/rc/Debian/pdnsd to /etc/init.d and type update-rc.d
|
|
Stop bind if you have it installed on your system. Edit /etc/resolv.conf
|
|
and add the following.
|
|
<pre>
|
|
nameserver 127.0.0.1
|
|
</pre>
|
|
<p>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:
|
|
<pre>
|
|
Default Server: debian
|
|
Address: 127.0.0.1
|
|
>
|
|
</pre>
|
|
<p>Stop pdnsd by typing /etc/init.d/pdnsd stop.
|
|
<br>Fire up your editor and add a line like this to the end of your /etc/hosts
|
|
file:
|
|
<pre>
|
|
127.0.0.2 testhost
|
|
</pre>
|
|
<p>Save the file and start pdnsd once again. Type nslookup. Inside nslookup
|
|
type 'testhost'.
|
|
<pre>
|
|
> testhost
|
|
Server: debian
|
|
Address: 127.0.0.1
|
|
Non-authoritative answer:
|
|
Name: testhost
|
|
Address: 127.0.0.2
|
|
</pre>
|
|
If this answer is obtained it shows that your pdnsd is working (remember
|
|
to remove the last line from /etc/hosts)
|
|
<h3>
|
|
3.b) Redhat Linux</h3>
|
|
|
|
<p><br>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
|
|
<pre>
|
|
nameserver 127.0.0.1
|
|
</pre>
|
|
<p>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
|
|
<pre>
|
|
Default Server: Redhat
|
|
Address: 127.0.0.1
|
|
>
|
|
</pre>
|
|
|
|
<p>Stop pdnsd by typing /etc/rc.d/init.d/pdnsd stop.
|
|
<br>Fire up your editor and add a line like this to the end of your /etc/hosts
|
|
file.
|
|
<pre>
|
|
127.0.0.2 testhost
|
|
</pre>
|
|
<p>Save the file and again start pdnsd. Type nslookup. Inside nslookup
|
|
type 'testhost'.
|
|
<pre>
|
|
> testhost
|
|
Server: Redhat
|
|
Address: 127.0.0.1
|
|
Non-authoritative answer:
|
|
Name: testhost
|
|
Address: 127.0.0.2
|
|
</pre>
|
|
<p>If this answer is obtained it shows that your pdnsd is working (remember
|
|
to remove the last line from /etc/hosts)
|
|
<h2>
|
|
4. Sample configuration file.</h2>
|
|
My pdnsd.conf looks like this
|
|
<HR NOSHADE>
|
|
<pre>
|
|
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;
|
|
} */</pre>
|
|
<HR NOSHADE>
|
|
|
|
|
|
<p>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:
|
|
<pre>> yahoo.com
|
|
Server: debian
|
|
Address: 127.0.0.1
|
|
Non-authoritative answer:
|
|
Name: yahoo.com
|
|
Addresses: 204.71.200.245</pre>
|
|
Stop 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 ....??
|
|
<h2>
|
|
5. Tweaking configuration files.</h2>
|
|
If you are using BIND as your primary nameserver, one can very well make
|
|
PDNSD the secondary one. But here you have Catch-22 situation, on which
|
|
local IP and port would you make PDNSD listen ? Look at ragOO's pdnsd.conf
|
|
file and named.conf file:
|
|
<p>[pdnsd.conf]
|
|
<pre>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";
|
|
}</pre>
|
|
[named.conf--relevant section only]
|
|
<pre>options {
|
|
directory "/var/cache/bind";
|
|
forward first;
|
|
forwarders {127.0.0.2;202.54.6.1;202.54.1.30};
|
|
};</pre>
|
|
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.
|
|
<br>
|
|
<br>
|
|
<h2>
|
|
6. FAQs.</h2>
|
|
The follwing question and answer is from the correspondence I had with
|
|
Thoams Meostl author of pdnsd.
|
|
<p>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 ?
|
|
<p>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
|
|
<p>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).
|
|
<h2>
|
|
7. Credits.</h2>
|
|
Thanks to the author of this nifty utility, Thomas Moestl for clarifying
|
|
certain points and doubts. He made me a better user of PDNSD :-) !
|
|
<p>Thanks to <a href="mailto:vmathew@eth.net"> Manoj Victor Mathew</a>
|
|
and <a href="mailto:ragu@vsnl.com"> Raghavendra Bhat</a> (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.
|
|
<p>Last but not the least, to all users of this elegant program who may
|
|
have found this rant useful. Enjoy....;
|
|
|
|
|
|
|
|
|
|
<!-- *** BEGIN copyright *** -->
|
|
<P> <hr> <!-- P -->
|
|
<H5 ALIGN=center>
|
|
|
|
Copyright © 2001, Sunil Thomas Thonikuzhiyil.<BR>
|
|
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
|
|
Published in Issue 65 of <i>Linux Gazette</i>, April 2001</H5>
|
|
<!-- *** END copyright *** -->
|
|
|
|
<!--startcut ==========================================================-->
|
|
<HR><P>
|
|
<CENTER>
|
|
<!-- *** BEGIN navbar *** -->
|
|
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="stumpel.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue65/sunil.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../faq/index.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="lg_backpage65.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
|
|
<!-- *** END navbar *** -->
|
|
</CENTER>
|
|
</BODY></HTML>
|
|
<!--endcut ============================================================-->
|