DNS-Block All Websites Except for Whitelisted Sites

Solution 1:

Use dnsmasq. This is a really neat service.

On Debian/Ubuntu/Mint:

sudo apt-get install dnsmasq

edit /etc/dnsmasq.conf

add this line to make all sites redirect to localhost:

address=/#/127.0.0.1

add these lines to make specific sites use the DNS server at 8.8.8.8:

server=/allowed.com/8.8.8.8

then restart the dnsmasq service:

sudo service dnsmasq restart