You are not logged in.

#1 2007-09-12 15:39:41

skymt
Member
Registered: 2006-11-27
Posts: 443

HOWTO - Boost web surfing speeds with pdnsd

I've just posted to the Wiki an initial HOWTO on setting up pdnsd, a DNS server designed for local caching. I've found that it gives me a significant (though admittedly subjective) decrease in load times when browsing the web. I don't write much documentation, so I'd appreciate some constructive criticism. wink

I call it initial because I plan to cover some of the cooler bits of the software, like using pdnsd as the DNS for a small LAN, using it to block ads, and a few other things.

Offline

#2 2008-01-11 23:48:00

pedepy
Member
Registered: 2007-02-21
Posts: 198

Re: HOWTO - Boost web surfing speeds with pdnsd

neat but there doesnt seem to be any kind of good configuration example for those of us hopping off random wifi hotspots while using dhcpcd .... im thinking pointing pdnsd.conf to file= resolv.conf but then later it says to lock that down to 127.0.0.1 ? ..

bit confused here .... googling revealed nothing .. help ?


chupocabra ... psupsuspsu psu psu

Offline

#3 2008-01-12 01:34:20

skymt
Member
Registered: 2006-11-27
Posts: 443

Re: HOWTO - Boost web surfing speeds with pdnsd

There doesn't seem to be a way to tell dhcpcd to write the DNS servers it gets from the DHCP server to an arbitrary file, which you would need in order to have pdnsd query them. /etc/resolv.conf needs to list 127.0.0.1 first in order for pdnsd to be used, and dhcpcd will completely overwrite it unless you tell it not to with the -R option. I suggest just using a static set of DNS servers wherever you go, and ignoring the ones your hotspot gives you. 4.2.2.1 and 4.2.2.2 are good, if you don't already have a favorite.

Offline

#4 2008-01-12 01:50:28

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: HOWTO - Boost web surfing speeds with pdnsd

Just for completeness, using dnsmasq (as using bind or any full-fledged dns server should too) also works for local caching. Very useful on a router too.

Instead of using nslookup, I suggest using "dig". It actually shows response time, so you can ensure that caching is working (few ms of latency, not hundreds).

Offline

#5 2008-01-12 02:49:57

arew264
Member
From: Friendswood, Texas, US
Registered: 2006-07-01
Posts: 394
Website

Re: HOWTO - Boost web surfing speeds with pdnsd

I suggest you just use OpenDNS to resolve the dhcpcd problem. I've found them to be perfectly reliable and I use them over my ISPs servers, which improved my browsing speeds even without any caching.
They have the server IPs 208.67.222.222 and 208.67.220.220.

I'll have to try this, I'll post up if I have any comments or questions.

Offline

#6 2008-01-12 02:56:18

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: HOWTO - Boost web surfing speeds with pdnsd

Konqueror users should all do this for sure. You'll be amazed on how much faster it is.

Last edited by skottish (2008-01-12 02:56:35)

Offline

#7 2008-01-14 15:37:17

pedepy
Member
Registered: 2007-02-21
Posts: 198

Re: HOWTO - Boost web surfing speeds with pdnsd

okay got it working and WOOOOOOO

why isnt this code part of the basic networking utilities ?! .. it rocks


chupocabra ... psupsuspsu psu psu

Offline

#8 2008-01-14 16:12:34

MrWeatherbee
Member
Registered: 2007-08-01
Posts: 277

Re: HOWTO - Boost web surfing speeds with pdnsd

lucke wrote:

Just for completeness, using dnsmasq (as using bind or any full-fledged dns server should too) also works for local caching. Very useful on a router too.

Instead of using nslookup, I suggest using "dig". It actually shows response time, so you can ensure that caching is working (few ms of latency, not hundreds).

I'm a dnsmasq user myself, so just for a little more completeness:

- dnsmasq does not retain its cache through boots:

http://www.thekelleys.org.uk/dnsmasq/docs/FAQ

Q: Can I get dnsmasq to save the contents of its cache to disk when
   I shut my machine down and re-load when it starts again?

A: No, that facility is not provided. Very few names in the DNS have
   their time-to-live set for longer than a few hours so most of the
   cache entries would have expired after a shutdown. For longer-lived
   names it's much cheaper to just reload them from the upstream
   server. Note that dnsmasq is not shut down between PPP sessions so
   go off-line and then on-line again will not lose the contents of
   the cache.

- pdnsd does retain its cache through boots

http://www.phys.uu.nl/~rombouts/pdnsd/faq.html

...
permanent disk cache (useful for frequent power-offs/reboots)

Out of curiosity, I did a search on other differences between the two a while back when I read some forum discussions on pdnsd. I decided to stick with dnsmasq after reading the following article (and similar other reports) about pdnsd's resource usage.:

http://www.mibrahim.net/blog/2007/04/24 … s-caching/

Sorry if the reports are wrong or have since changed, but I wasn't interested in switching from dnsmasq enough to do my own testing.

Otherwise, either dnsmasq or pdnsd should do the trick if you are looking for a DNS boost via caching.

Offline

#9 2008-02-24 14:33:46

ravisghosh
Member
From: Intergalactic Spaces
Registered: 2006-10-12
Posts: 516
Website

Re: HOWTO - Boost web surfing speeds with pdnsd

Does it help when you are behind a router?

Also, right now I'm using a hosts file to block ad servers which is pretty big and hence, often slows down things a bit on my 1 ghz p3 256 mb ram system. Is it possible to get the same effect of hosts file in pdnsd?

Last edited by ravisghosh (2008-02-24 16:22:25)

Offline

#10 2008-02-26 02:16:35

ravisghosh
Member
From: Intergalactic Spaces
Registered: 2006-10-12
Posts: 516
Website

Re: HOWTO - Boost web surfing speeds with pdnsd

I'm not finding any decrease in dns lookup time:

here is my pdnsd.conf file

// Sample pdnsd configuration file. Must be customized to obtain a working pdnsd setup!
// Read the pdnsd.conf(5) manpage for an explanation of the options.
// Add or remove '#' in front of options you want to disable or enable, respectively.
// Remove '/*' and '*/' to enable complete sections.

global {
    perm_cache=1024;
    cache_dir="/var/cache/pdnsd";
#    pid_file = /var/run/pdnsd.pid;
    run_as="pdnsd";
    server_ip = 127.0.0.1;  # Use eth0 here if you want to allow other
                # machines on your network to query pdnsd.
    status_ctl = on;
    strict_setuid = on;
#    paranoid=on;       # This option reduces the chance of cache poisoning
                       # but may make pdnsd less efficient, unfortunately.
    query_method=udp_tcp;
    min_ttl=15m;       # Retain cached entries at least 15 minutes.
    max_ttl=1w;        # One week.
    timeout=10;        # Global timeout option (10 seconds).
}

# The following section is most appropriate if you have a fixed connection to
# the Internet and an ISP which provides good DNS servers.
server {
    label=OpenDNS;
    ip = 208.67.222.222;
    ip = 208.67.220.220;  # Put your ISP's DNS-server address(es) here.
#    proxy_only=on;     # Do not query any name servers beside your ISP's.
                       # This may be necessary if you are behind some
                       # kind of firewall and cannot receive replies
                       # from outside name servers.
    timeout=4;         # Server timeout; this may be much shorter
               # that the global timeout option.
    uptest=if;         # Test if the network interface is active.
    interface=eth0;    # The name of the interface to check.
    interval=10m;      # Check every 10 minutes.
    purge_cache=off;   # Keep stale cache entries in case the ISP's
               # DNS servers go offline.
}

/*
# The following section is more appropriate for dial-up connections.
# Read about how to use pdnsd-ctl for dynamic configuration in the documentation.
server {
    label= "dialup";
    file = "/etc/ppp/resolv.conf";  # Preferably do not use /etc/resolv.conf
    proxy_only=on;
    timeout=4;
    uptest=if;
    interface = ppp0;
    interval=10;       # Check if the interface every 10 seconds.
    purge_cache=off;
    preset=off;
}
*/

/*
# The servers provided by OpenDNS are fast, but they do not reply with
# NXDOMAIN for non-existant domains, instead they supply you with an
# address of one of their search engines. They also lie about the addresses of 
# of the search engines of google, microsoft and yahoo.
# If you do not like this behaviour the "reject" option may be useful.
server {
    label = "opendns";
    ip = 208.67.222.222, 208.67.220.220;
    reject = 208.69.32.0/24,  # You may need to add additional address ranges
             208.69.34.0/24,  # here if the addresses of their search engines
             208.67.219.0/24; # change.
    reject_policy = fail;     # If you do not provide any alternative server
                              # sections, like the following root-server
                              # example, "negate" may be more appropriate here.
    timeout = 4;
    uptest = ping;            # Test availability using ICMP echo requests.
        ping_timeout = 100;       # ping test will time out after 10 seconds.
    interval = 15m;           # Test every 15 minutes.
    preset = off;
}
*/

/*
# This section is meant for resolving from root servers.
server {
    label = "root-servers";
    root_server = on;
    randomize_servers = on; # Give every root server an equal chance
                # of being queried.
    ip =     198.41.0.4
    ,    192.228.79.201
    ,    192.33.4.12
    ,    128.8.10.90
    ,    192.203.230.10
    ,    192.5.5.241
    ,    192.112.36.4
    ,    128.63.2.53
    ,    192.36.148.17
    ,    192.58.128.30
    ,    193.0.14.129
    ,    198.32.64.12
    ,    202.12.27.33
    ;
    timeout = 5;
    uptest = query;         # Test availability using empty DNS queries.
    interval = 30m;         # Test every half hour.
    ping_timeout = 300;     # Test should time out after 30 seconds.
    purge_cache = off;
    exclude = .localdomain;
    policy = included;
    preset = off;
}
*/

source {
    owner=localhost;
#    serve_aliases=on;
    file="/etc/hosts";
}

rr {
    name=localhost;
    reverse=on;
    a=127.0.0.1;
    owner=localhost;
    soa=localhost,root.localhost,42,86400,900,86400,86400;
}

/*
neg {
    name=doubleclick.net;
    types=domain;   # This will also block xxx.doubleclick.net, etc.
}
*/

/*
neg {
    name=bad.server.com;   # Badly behaved server you don't want to connect to.
    types=A,AAAA;
}
*/

Is anything wrong in that?

Offline

#11 2008-02-26 03:02:57

gorn
Member
Registered: 2008-02-01
Posts: 56

Re: HOWTO - Boost web surfing speeds with pdnsd

skymt wrote:

There doesn't seem to be a way to tell dhcpcd to write the DNS servers it gets from the DHCP server to an arbitrary file, which you would need in order to have pdnsd query them.

I noticed this too. But then I read something in the man about "resolvconf" which I don't have. I think it's a script used by some other distros. If dhcpcd detects an executable resolvconf in your path it will run that rather than write the file to resolv.conf. To take advantage of this I setup the following script in /usr/local/bin/resolvconf

#!/bin/bash
cat > /etc/resolv.conf.dhcpcd

Then point pdnsd (actually I used dnsmasq) to /etc/resolv.conf.dhcpcd

This way you can set /etc/resolv.conf to 127.0.0.1 and not worry dhcpcd overwriting it and still get the new DNS servers from dhcpcd.



I didn't look too hard but I couldn't find a website for the official resolvconf program.

Offline

#12 2008-02-26 12:26:46

MrWeatherbee
Member
Registered: 2007-08-01
Posts: 277

Re: HOWTO - Boost web surfing speeds with pdnsd

gorn wrote:
skymt wrote:

There doesn't seem to be a way to tell dhcpcd to write the DNS servers it gets from the DHCP server to an arbitrary file, which you would need in order to have pdnsd query them.

I noticed this too. But then I read something in the man about "resolvconf" which I don't have. I think it's a script used by some other distros. If dhcpcd detects an executable resolvconf in your path it will run that rather than write the file to resolv.conf. To take advantage of this I setup the following script in /usr/local/bin/resolvconf

#!/bin/bash
cat > /etc/resolv.conf.dhcpcd

Then point pdnsd (actually I used dnsmasq) to /etc/resolv.conf.dhcpcd

This way you can set /etc/resolv.conf to 127.0.0.1 and not worry dhcpcd overwriting it and still get the new DNS servers from dhcpcd.



I didn't look too hard but I couldn't find a website for the official resolvconf program.

Also, if you use 'dhclient' (probably most here don't ??), dhclient.conf supports a 'prepend' statement, which may be used to force any new DNS server addresses to be written after the address specified in the prepend statement's options / declaration. For example, one could include this line in the dhclient.conf file (in proper context):

prepend domain-name-servers 127.0.0.1;

and this would ensure that 127.0.0.1 always appears as the first address in resolv.conf.

Hopefully I haven't misunderstood your post and the issue that it seeks to address.

Offline

#13 2008-02-28 08:29:34

gorn
Member
Registered: 2008-02-01
Posts: 56

Re: HOWTO - Boost web surfing speeds with pdnsd

MrWeatherbee wrote:

Also, if you use 'dhclient' (probably most here don't ??)
...
Hopefully I haven't misunderstood your post and the issue that it seeks to address.

Yup, that's the issue I was addressing.

Offline

#14 2008-03-02 22:50:51

ravisghosh
Member
From: Intergalactic Spaces
Registered: 2006-10-12
Posts: 516
Website

Re: HOWTO - Boost web surfing speeds with pdnsd

Size of my pdnsd.cache is 0. does that mean pdnsd is not working though i can see it in htop. Please help.

Offline

Board footer

Powered by FluxBB