Pdnsd – cache your DNS query

pdnsd 是一個小型的 proxy DNS server,主要功能就是 proxy 與 cache,而不是像 bind9 那樣的完整 DNS server。

雖然 DNS 通常不是網路延遲的主因,但有時候就是很慢,使用 pdnsd 前後可以差非常多。

    % time host blog.kanru.info 168.95.1.1
    0.00s user 0.01s system 0% cpu 0.963 total
    % time host blog.kanru.info 127.0.0.1
    0.00s user 0.00s system 65% cpu 0.011 total

在 Debian 系統上,如果你原本就有使用 resolvconf 的話,那麼只要在 configure 時選擇使用 resolvconf 就會動態的把 resolv.conf 內的 DNS server 包含,而 resolv.conf 只會剩下 127.0.0.1,如:

    % /usr/sbin/pdnsd-ctl status
    ...
    label: resolvconf
    ip: 168.95.1.1
    server assumed available: yes
    ip: 192.168.1.1
    server assumed available: yes
    port: 53
    ...
    % cat /etc/resolv.conf
    nameserver 127.0.0.1

apt-get install pdnsd 完全零設定 😉