Using dnsmasq to assign a specific MAC address its own DNS

I'd like to use dnsmasq on my router to assign specific MAC address it's own DNS and have all others get the router assigned values.

I read this wiki page which suggested these commands:

uci set dhcp.tag1="tag"
uci set dhcp.tag1.dhcp_option="6,1.1.1.1,1.0.0.1"
uci add dhcp host
uci set dhcp.@host[-1].name="laptop"
uci set dhcp.@host[-1].mac="40:14:a0:29:ab:12"
uci set dhcp.@host[-1].ip="10.9.7.200"
uci set dhcp.@host[-1].tag="tag1"
uci commit dhcp
/etc/init.d/dnsmasq restart

The MAC address above is the correct one for the laptop that should be targeted. I got no errors, but when I connect that laptop to my guest zone, it is still being assigned my custom DNS (pi-hole) as it's DNS server. When did I misconfigure?

Note that above that section /etc/config/dhcp contains the setup for my GUEST interface wherein the pi-hole DNS is defined and seems to be taking precedent over the 1.1.1.1 I defined just there.

# cat /etc/config/dhcp
...

config dhcp 'guest'
  option interface 'guest'
  option start '100'
  option limit '150'
  option leasetime '12h'
  list dhcp_option '6,10.0.4.250'
  list ra_flags 'none'

...

config tag 'tag1'
	option dhcp_option '6,1.1.1.1,1.0.0.1'

config host
	option name 'laptop'
	option mac '40:14:a0:29:ab:12
	option ip '10.9.7.200'
	option tag 'tag1'

I see my problem. I had this device defined as a static lease as well. My new options and the static lease must conflict. Once I removed the static lease, it is behaving as I expect.

1 Like

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