pdnsd

家とか会社とか環境を持ち歩いてると、ネットワークが変化するのはいいが、/etc/resolv.conf の変化に libc の resolver が付いてこないのが面倒くさい。特に最近の大きめの Emacs が面倒くさい。むかしの UNIX のリゾルバは毎回 /etc/resolv.conf をパースしていたのに。

dnsmasq

最初 dnsmasq っての入れたがいまいちだったので捨て

Description: A caching DNS forwarder.
Dnsmasq is lightweight, easy to configure DNS forwarder designed to provide DNS (domain name) services to a small network where using BIND would be overkill. It can have its upstream DNS servers automatically configured by PPP or DHCP and it can serve the names of local machines which are not in the global DNS. It can integrate with the ISC DHCP daemon to serve the names of local machines which are configured using DHCP. Dnsmasq is ideal for networks behind NAT routers and connected via modem, ISDN, ADSL, or cable-modem.

pdnsd

Description: Proxy DNS Server
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 (for example in dial-in networking). pdnsd can be used with applications that do dns lookups, eg on startup, and can't be configured to change that behaviour, to prevent the often minute-long hangs (or even crashes) that result from stalled dns queries. Some Netscape Navigator versions for Unix, for example, expose this behaviour. And it's IPv6 capable.

/etc/pdnsd.conf に、起こりそうな DNS 状況っぷりを適当にもげもげ記述。あとは pdnsd が、適当にまわりを見て判断して適宜 dns query を forward して cache してくれる。

pdnsd が動いてる状況では、あらゆる dns query はもはや 127.0.0.1 に出してほしいので、dhcp で状況とってくるたびに/etc/resolv.conf 作り直されるとうざい。dhclient を使っているので、/etc/dhclient-script いじって、とりあえず dhcp で取ってきた DNS 設定は /etc/resolv.conf.dhcpというファイルに吐き出す (というか、ステ) ようにする。