How to serve custom DHCP configuration with OpenWRT’s dnsmasq

There are times when you need to filter out what some hosts in the network can or cannot do. When you have a router running OpenWRT this can be done at the firewall level.

But if you’re not much into advanced configuration and just want to completely block out some network hosts from reaching the internet (and hence phoning home) then it’s a lot simpler to do this directly from the DHCP and simply leave them without a DNS and gateway configuration.

Disable BIND recursion while keeping local queries resolvable

For security and efficiency reasons, a hosting system DNS server should not answer recursive queries (solve DNS requests for domains it is not authoritative for).
However, the DNS server needs to accept recursive queries for the services hosted on the same system for these services to work correctly and be able to resolve forward and reverse hosts/IPs.

Adding static DNS records on DD-WRT

Every needed to manually control host/domain IPs using the hosts file? Well, good thing most computers have a hosts file, but what do you do with other devices that do not support such a feature.

If you’re running a DD-WRT router, by using DNSMasq the DNS change will work for all devices that connect to your router, including mobile devices.