Skip to content

Instantly share code, notes, and snippets.

@lsl
Created March 18, 2018 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsl/e2ab9b4aa2fb8b3f8073f5bfc452ed16 to your computer and use it in GitHub Desktop.
Save lsl/e2ab9b4aa2fb8b3f8073f5bfc452ed16 to your computer and use it in GitHub Desktop.
Local DNS cache with pdnsd. Uses DHCP configured DNS with fallback on Google DNS
  1. Installation

    $ sudo pacman -Sy
    $ sudo pacman -S pdnsd
  2. Configure pdnsd

    $ sudo vi /etc/resolvconf.conf
    $ sudo vi /etc/pdnsd.conf
    $ sudo resolvconf -u
  3. Start and enable on boot

    $ sudo systemctl start pdnsd
    $ sudo systemctl enable pdnsd
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;
# 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.
}
server {
label=resolvconf;
file=/etc/pdnsd-resolv.conf;
proxy_only=on;
timeout=4;
uptest=if;
interface=wlp2s0;
interval=10;
purge_cache=off;
# edns_query=yes;
preset=off;
}
# Configuration for resolvconf(8)
# See resolvconf.conf(5) for details
resolv_conf=/etc/resolv.conf
# If you run a local name server, you should uncomment the below line and
# configure your subscribers configuration files below.
name_servers=127.0.0.1
name_servers_append=8.8.8.8
pdnsd_resolv=/etc/pdnsd-resolv.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment