3

Anyone know of a way for me to setup a separate host file, or send different responses, from DNSMasq to specific PCs on my network?

Specifically, if I wanted to block youtube, or facebook, or etc. from my child's computer at MAC ab:cd:00:01:02:03, my thought is to add entries in the DNSMasq host file such as:

127.0.0.1 facebook.com, youtube.com

But I would not want to block these for the entire family, only for his/her computer.

Thanks for any suggestions.

bumped to the homepage by Community 2 days ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

1

DNSMasq conditional capability rely mostly on its tagging mechanism and it is only related to its DHCP side.

One solution would be to first use the DHCP side of DNSMasq to tag which host is "child" and which is "grownup":

# grownup network
dhcp-host=11:22:33:44:55:66,host01,192.168.1.11,infinite,set:grownup
dhcp-host=66:55:44:33:22:11,aa:bb:cc:dd:ee:ff,host02,192.168.1.12,infinite,set:growup

# child network
dhcp-host=ab:cd:00:01:02:03,child01,192.168.1.21,infinite,set:child

So, conditionally set dhcp-option to attribute a specific DNS resolving chain to "grownup" hosts (assuming 10.10.10.1 and 10.10.10.2 are your DNS servers and 192.168.1.2 is your DNSMasq box IP address):

# options
dhcp-option=tag:grownup,option:dns-server,10.10.10.1,10.10.10.2
dhcp-option=tag:child,option:dns-server,192.168.1.2

From there, "grownup" host will directly resolv through your ISP DNS and the "child" ones would use DNSMasq resolving chain (or any other DNS server sitting on your DNSMasq box).

Finally adding a few host-record or a addn-hosts option:

host-record=www.facebook.com,127.0.0.1

For more about about DNSMasq:

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.