LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Blogs > arniekat
User Name
Password

Notices


Rate this Entry

Slackware-14.1-Pdnsd 1.2.9a

Posted 02-08-2015 at 04:17 PM by arniekat

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 (e.g., in dial-in networking).

Create the following user and group. I picked a number so as to not conflict with the uid's-gid's assigned by SlackBuilds.org

# groupadd -g 313 pdnsd
# useradd -d /dev/null -s /bin/false -u 313 -g 313 pdnsd

SlackBuilds has version 1.2.7, but I used the current source version 1.2.9a and the framework from version 1.2.7. Make the following changes to the SlackBuild so it will use the "pdnsd" uid/gid. The default user is "nobody"

VERSION=${VERSION:-1.2.9a}

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--with-default-id=pdnsd \
--enable-ipv6 \
--build=$ARCH-slackware-linux

Make sure the file /etc/rc.d/rc.pdnsd is executable.

# chmod +x /etc/rc.d/rc.pdnsd

Edit the file /etc/rc.d/rc.local and add this section:

# Start Pdnsd DNS Cache Server
if [ -x /etc/rc.d/rc.pdnsd ]; then
/etc/rc.d/rc.pdnsd start
fi

Add the following to rc.local_shutdown

# vi /etc/rc.d/rc.local_shutdown

# Stop Pdnsd DNS Cache Server
if [ -x /etc/rc.d/rc.pdnsd ]; then
/etc/rc.d/rc.pdnsd stop
fi

Save the file and exit.

Pdnsd needs to be configured. This setting will use Google's DNS Server 8.8.4.4. You can also use Google's DNS Server 8.8.8.8 or your ISP's DNS Server or even OpenDNS's Servers 208.67.220.220 and 208.67.222.222

Make the following changes to /etc/pdnsd.conf. The interface will probably be wlan0 if you are using WiFi.

global {
perm_cache=2048;
cache_dir="/var/cache/pdnsd";
pid_file = /var/run/pdnsd.pid;
run_as="pdnsd";
server_ip = 127.0.0.1;
status_ctl = on;
paranoid=on;
query_method=udp_tcp;
min_ttl=15m;
max_ttl=1w;
timeout=10;
neg_domain_pol=on;
udpbufsize=1024;
}

server {
label= "google";
ip = 8.8.4.4;
# proxy_only=on;
timeout=60;
uptest=if;
interface=wlan0;
interval=10m;
purge_cache=off;
caching=on;
edns_query=yes;
}

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

Save the file and exit.

Edit /etc/dhclient.conf and add this line to the end of the file

prepend domain-name-servers 127.0.0.1;

If you use NetworkManager or Wicd, you will need to set the DNS manually to 127.0.0.1

WICD CONFIGURATION

Open the wicd configuration icon and select your Active Wireless Connection. Click Properties

CHECK Use Static DNS
DNS domain:
Search domain:
DNS server 1: 127.0.0.1
DNS server 2:
DNS server 3:

Click "OK"

NETWORK MANAGER

Left-click the Network Manager System Tray Icon. Select your Active Wireless Connection. Click the wrench at the upper right-hand corner of the dialog box. The Connection Editor Dialog Box will appear. Click the Connection Name. Now, a wrench with "Edit" on it will appear. Click the Wrench button. Now you can edit your Wifi Connection.

Click the IPV4 Tab
Other DNS Servers: 127.0.0.1

Click "OK"

Reboot your computer and check that pdnsd is indeed running

# netstat -lundt

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN
udp 0 0 127.0.0.1:53 0.0.0.0:*

Port 53 is the DNS Server.

Check that PDNSD is running as a limited user "pdnsd"

# ps aufx | grep pdnsd
pdnsd 798 0.0 0.1 57260 4096 ? Sl 20:31 0:00 /usr/sbin/pdnsd -d -p /var/run/pdnsd.pid

Change the ownership of the /var/cache/pdnsd directory

# chown -R pdnsddnsd /var/cache/pdnsd
Posted in Uncategorized
Views 1525 Comments 1
« Prev     Main     Next »
Total Comments 1

Comments

  1. Old Comment
    Very cool! :-) Thanks for the pointer. I've been wanting something like this for some years, but BIND running as a local caching nameserver and near-network forwarders has been "good enough", so I didn't look too hard. Will give pdnsd a spin :-)
    Posted 02-21-2015 at 01:13 AM by ttk ttk is offline
 

  



All times are GMT -5. The time now is 12:32 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration