Run as root:
aptitude install djbdns dnscache-run mv /etc/resolv.conf /etc/resolv.conf.orig echo nameserver 127.0.0.1 > /etc/resolv.conf
Then configure your connection to not update /etc/resolv.conf upon each connection (I use pppoe to connect to adsl, so I needed to comment the line “usepeerdns” on /etc/ppp/peers/dsl-provider)
Straightforward, isn’t it? For other operating systems, see the official tutorial.