Custom DNS server for a specific device ID'ed by DHCP on OpenWrt

Goal: configure OpenWRT's dnsmasq assign a set of DNS entries (8.8.8.8 and 8.8.4.4 say) to only a specific device?

Background: I am running pihole and I have OpenWRT configured to serve the pihole IP address as the primary DNS for all clients via LuCi: Network>Interface>Guestzone>DHCP Server>Advanced Settings>DHCP-Options = 6,172.17.1.250

For a specific device, I have a need to have OpenWRT circumvent the pihole DNS and use say, google's free ones of 8.8.8.8/8.8.4.4.

dnsmasq can do it - see http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html

The "tag" feature can control per-host/per-group items.

I haven't yet worked out how to duplicate the behaviour in UCI, though. Over to you.

1 Like

Thanks for the tip. I am not afraid to try it via ssh... I do not see a /etc/dnsmasq.d/ however, and this link suggests it to add a nopi.conf to that dir containing the following:

dhcp-option=tag:nopie,option:dns-server,8.8.8.8,8.8.4.4
dhcp-host=xx:xx:xx:xx:xx:xx,set:nopie,10.10.1.29,UnitName

I tried appending those two lines to the end of /etc/dnsmasq.conf but that broke dnsmasq.

https://openwrt.org/docs/guide-user/base-system/dhcp_configuration#classifying_clients_and_assigning_individual_options1

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.