How To Wiki

How to setup pdnsd DNS server on Gentoo Linux

1,795pages on
this wiki
Add New Page
Add New Page Talk0

This is incomplete: to be completed

pdnsd is a light weight DNS server that has the added benefit of caching DNS entires, which most DNS servers do not do. This allows users who shutdown or restart their computers to keep DNS caches.


  • execute: emerge pdnsd


  1. cp /etc/pdnsd/pdnsd.conf.sample /etc/pdnsd/pdnsd.conf
  2. Edit: /etc/pdnsd/pdnsd.conf
    1. Replace the global section with
global {
       status_ctl = on;   # Important to enable status control
       par_queries=2;     # How many servers are probed in parallel
       interface = "lo";  # Interface on which the pdnsd listens
    1. In the server section
      • edit the 'ip' variable to be your ISP's DNS forwarding servers
        Example: ip = "","";
  1. Edit: /etc/resolv.conf
    1. Comment out all lines with nameserver
    2. Add line: nameserver
      This will make pdnsd you default DNS nameserver
  2. Edit /etc/conf.d/net
    • Add line
      dns_servers_lo=( "" )
      This will ensure Gentoo respects the change
  3. Start Server:
    /etc/init.d/pdnsd start
  4. test as described in the test section
    • If it doesn't work debug
    • Or
      • To disable pdnsd
        • Stop Server:
          /etc/init.d/pdnsd stop#**
        • Return to normal configuration:
          Edit /etc/resolv.conf
          Return to previous configuration
  5. If pdnsd works, enable pdnsd to automatically startup
    • rc-update -a pdnsd default
      Output: * pdnsd added to runlevel default


Some of these tests are redundant, but it never hurts.

  • Start DNS Server
    • /etc/init.d/pdnsd start

  • Try the following command line test
    Execute the following
  • emerge bind-tools for dig
  • dig
    Example Output:
 ; <<>> DiG 9.3.2 <<>>
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52275
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 6, ADDITIONAL: 6

;                        IN      A

;; ANSWER SECTION:         481428  IN      CNAME       249     IN      A       249     IN      A       249     IN      A
  • nslookup
    Example Output:

Non-authoritative answer:
  • ping
PING ( 56(84) bytes of data.
64 bytes from ( icmp_seq=1 ttl=245 time=116 ms
  • pdnsd-ctl status
    Long detailed output
  • pdnsd-ctl server myisp retest
    Example Output:
    Opening socket

Dynamical DNS configurationEdit

One advantage of pdnsd that it allows several ways to set DNS servers of you ISP without having to manually put them into /etc/pdnsd/pdnsd.conf file. This is handy when you get DNS servers through DHCP, especially on laptop which could access internet in unfamiliar places.

The simplest way is the following

  • In the server section delete "ip" line. Instead, insert a 'file' directive pointing to /etc/resolv.conf
    Now pdnsd will parse /etc/resolv.conf and take nameservers from there.
  • Created by DHCP, /etc/resolv.conf does not contain To correct for this, create /etc/resolv.conf.head file with one line
    It will be inserted in the beginning of /etc/resolv.conf and will be used first. pdnsd will skip from the list of external DNS servers, since it coincides with its own address.


  • read :
    • /etc/resolvconf/update.d/pdnsd
    • /etc/pdnsd/pdnsd.sample
  • man:
    • pdnsd
    • pdnsd.conf
    • -
From HowTo Wiki, a Wikia wiki.