linux poison RSS
linux poison Email

Speed up Internet access by using Persistent DNS caching with Pdns - Ubuntu Linux

pdnsd is a proxy DNS server with permanent caching (the cache contents are written to hard disk on exit) that is designed to cope with unreachable or down DNS servers (for example in dial-in networking).

pdns installation:
Open up the terminal Application > Accessories > Terminal and type following command:
sudo apt-get install pdnsd
Once installed the software is configured via the file /etc/pdnsd.conf.

The next thing to do is to edit the pdnsd configuration file /etc/pdnsd.conf to specify which DNS servers the cache should use for its own lookups.

Type following command into your terminal to edit the pdns configuration file (/etc/pdnsd.conf) ...
sudo gedit /etc/pdnsd.conf
In the gedit editor, paste the text below of the pdnsd configuration (that uses google dns servers). It would be good to review the pdnsd documentation to see how the configuration may need to be adjusted for your system. After pasting the text and making any needed adjustments, save the file.

global {
        perm_cache=2048;
        cache_dir="/var/cache/pdnsd";
        max_ttl=604800;
        run_as="pdnsd";
        paranoid=on;
        status_ctl=on;
        server_port=53;
        server_ip="127.0.0.1";
}
server {
        ip="8.8.8.8";
        timeout=60;
        interval=900;
        uptest=ping;
        ping_timeout=500;
        purge_cache=off;
        caching=on;
}
server {
        ip="8.8.4.4";
        timeout=60;
        interval=900;
        uptest=none;
        ping_timeout=500;
        purge_cache=off;
        caching=on;
}
server {
    label="resolvconf";
}
source {
        ttl=86400;
        owner="localhost.";
        serve_aliases=on;
        file="/etc/hosts";
}

If your PC gets its nameserver from a DHCP server, you will need to reconfigure dhclient.conf to make 127.0.0.1 your primary domain server.

Here is the file you need to edit: /etc/dhcp3/dhclient.conf, uncomment or add the following line ...
prepend domain-name-servers 127.0.0.1;
If you got the static ip address, in this case you just need to edit your /etc/resov.conf file and add the following entries ..
nameserver 127.0.0.1
The system will now look to the local cached DNS information rather than going directly to the Internet.
Restart pdnsd to make our changes active: sudo /etc/init.d/pdnsd restart


The first time a site is visited, there will be a delay while pdnsd finds the IP address from the external DNS servers, but subsequently it will just pull it from its cache which surely going to be very fast :)



Warning: You should not query the root DNS servers directly unless you have a really good reason for doing so. Reports show that 98% of the queries to the root servers are unnecessary, so please avoid adding to the already excessive load on these servers. Also keep in mind that responses from the root servers are considerably slower than that from your ISP’s DNS servers.


0 comments:

Post a Comment

Related Posts with Thumbnails