Integration · Linux · Making things work · Open Source

Howto pdnsd on redhat/centos from Source


What is pdnsd

pdnsd is a cache only name server can be used independently or alongside your authoritative name server for faster name lookup.

pdnsd does not aim to be a complete name server implementation, such as the BIND. It is optimized for caching, and you can only specify a small subset of all dns record types pdnsd knows in your local “zone” definitions. This of course reduces the code size drastically, and such the memory footprint. There are some features especially interesting for dialin networks, ordinary (non-server) internet hosts and computers that are often not connected to to their network, e.g. notebooks (I originally wrote this program for use with my notebook). These features are:

  • permanent disk cache (useful for frequent power-offs/reboots)
  • usually smaller memory footprint (depends on cache size) (see next question)
  • better control about timeouts (also to prevent hangs)
  • better control over the cache
  • better run-time control of the cached records

Installing pdnsd on redhat from source (Howto document, step by step)

This howto for installing pdnsd was tested on Centos/redhat 5.2 and 5.8, you may check your redhat-version by

cat /etc/redhat-release

Prerequisite packages: rpm-build, gcc, bind-utils

Steps.

1. Download the src.rpm package of pdsnd

wget http://members.home.nl/p.a.rombouts/pdnsd/releases/pdnsd-1.2.9a-par.src.rpm

2. create the directory for installing the source package, if it is already not there

mkdir -p /usr/src/redhat/SOURCES

3. install the pdnsd src.rpm package with no md5 check

rpm -ivh pdnsd-1.2.9a-par.src.rpm  –nomd5

4. change present working directory to where the spec file was extracted

cd /usr/src/redhat/SPECS/

5. compile pdnsd package

rpmbuild -bb pdnsd-1.2.9a.spec

Locate the compiled pdnsd package, check for a line at the end of the rpmbind log on the screen says something like “Wrote:  /usr/src/redhat/RPMS/i386/pdnsd-1.2.9a-par.i386.rpm”

It is sually under /usr/src/redhat/PRMS/*

Mine was in /usr/src/redhat/RPMS/i386/, was it was a 32 bit system

cd /usr/src/redhat/RPMS/i386

6. Install the package (i368 is 32 bit or x86_64)

rpm -ivh pdnsd-1.2.9a-par.i386.rpm

update the pdnsd config file, is the tricky bit

7. copy and edit the pdnsd.conf.sample

cp /etc/pdnsd.conf.sample /etc/pdnsd.conf

8. update the config file

vim /etc/pdnsd.conf

this is a sample config file that works by resolving dns directly from root name servers

content of the /etc/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.
server_ip = eth0;
status_ctl = 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).
neg_domain_pol=on;
udpbufsize=1024;   # Upper limit on the size of UDP messages.
}
# This section is meant for resolving from root servers.
server {
label = “root-servers”;
root_server = discover; # Query the name servers listed below
# to obtain a full list of root servers.
randomize_servers = on; # Give every root server an equal chance
# of being queried.
ip =    198.41.0.4,     # This list will be expanded to the full
192.228.79.201; # list on start up.
timeout = 5;
uptest = query;         # Test availability using empty DNS queries.
#       query_test_name = .;    # To be used if remote servers ignore empty queries.
interval = 30m;         # Test every half hour.
ping_timeout = 300;     # Test should time out after 30 seconds.
purge_cache = off;
#       edns_query = yes;       # Use EDNS for outgoing queries to allow UDP messages
# larger than 512 bytes. May cause trouble with some
# legacy systems.
exclude = .localdomain;
policy = included;
preset = off;
}

Save the file and exit and you are done with setting up your caching only dns server using pdnsd

Enable the service

1. turn on pdnsd server on the present run level

chekconfig pdnsd on

2. Start pdnsd service

services pdnsd start

as the service starts without any error

check the service

netstat -antp | grep 53

you will see an output like this

tcp        0      0 192.168.x.xxx:53          0.0.0.0:*                   LISTEN      7424/pdnsd
this means that the pdnsd is up and running,
now to do a lookup
run

dig @192.168.x.xx google.com

and you will see some outputs like this
; <<>> DiG 9.3.4-P1 <<>> @192.168.127.196 google.com
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61593
;; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 4, ADDITIONAL: 4
;; QUESTION SECTION:
;google.com.                    IN      A
;; ANSWER SECTION:
google.com.             900     IN      A       74.125.236.40
google.com.             900     IN      A       74.125.236.46
……………………
…………………..

which means that pdnsd is up and running, looking up dns requests successfully

some other useful commands on pdnsd

dump all the cache on the screen

pdnsd-ctl dump

present status of the service

pdnsd-ctl status

clean some, all selected entry from the dns cache

empty-cache     [[+|-]name …]

find list of commands

pdnsd help

Reference:

http://members.home.nl/p.a.rombouts/pdnsd/doc.html

http://members.home.nl/p.a.rombouts/pdnsd/faq.html

keyword: pdnsd, howto, step by step, redhat, centos

Advertisement

One thought on “Howto pdnsd on redhat/centos from Source

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s