I've got a LAN connected to fibre router/modem for internet access, four client machines and low powered SBC running Ubuntu Server and Nginx. I'm wanting to use the SBC to filter out requests for certain websites and redirect them on to it's own Nginx instance whilst letting all other normal site requests continue on to our ISP's DNS servers. I can already configure the router to pass DNS requests to the SBC.

Is dnsmasq the best method to achieve this, and if so which bit of dnsmasq's configuration allows me to ignore normal traffic and just capture that handful of websites? Can the redirect in dnsmasq be switched on and off dynamically (at certain times for instance) or does it require a restart of the dnsmasq service?

Most dnsmasq tutorials a quite poor for explaining this kind of usage but I can't find any other Linux tools that would allow me to achieve the same thing.

1 Answer 1


Dnsmasq by default reads the /etc/hosts file so one possible solution could be that you add all domain names you want to redirect to the hosts file.

However this does not allow dynamic edits or scheduled redirects. Turning redirections on and off is unlikely to be achievable this way. For example the DNS records are cached on client side too so making changes on the server does not necessarily affect the clients right away. The DNS itself is not designed to do this. Firewalls and proxy servers are made to control web traffic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.