rss.png profile for ebal on Stack Exchange, a network of free, community-driven Q&A sites
dnsmasq with custom hosts file

Title: dnsmasq with custom hosts file - aka ban sites with dnsmasq

I ‘ve already said it too many times, but dnsmasq is a beautiful project for SOHO (small office/home office) environment.

I am using it as DNS caching server, DHCP server & tftpd (PXE) server and it’s amazing.

One thing i do with the dns section is that i “BAN” urls i dont like. Think something like AdBlock on firefox.
Two configuration changes:


as root

wget -O /etc/hosts.txt && 



in /etc/dnsmasq.conf


You can also put the wget cmd in your crontab with the @monthly scheduler but you need to restart the dnsmasq every month!

Another amazing thing is that you can add your one entries:

echo >> /etc/hosts.txt

restart your dnsmasq service and check it:

# dig @localhost +short
Tag(s): dnsmasq