Skip to content

Instantly share code, notes, and snippets.

@onokatio
Created December 7, 2017 08:19
Show Gist options
  • Save onokatio/df21fb1601f66e1273a2c874a985a5cb to your computer and use it in GitHub Desktop.
Save onokatio/df21fb1601f66e1273a2c874a985a5cb to your computer and use it in GitHub Desktop.
NetworkManagerやらresolvconfやらLinuxのDNSまわりを調べて、DHCP環境下でDNSキャッシュしてみた ref: https://qiita.com/onokatio/items/af0035d1563acbbfeed2
$ sudo apt install pdnsd # Debian、Ubuntuの場合
$ sudo pacman -S pdnsd # ArchLinuxの場合
$ 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=wlp1s0;
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