DNSMasq - Different Responses for Specific MAC Addresses












2















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.










share|improve this question














bumped to the homepage by Community 16 mins ago


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




















    2















    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.










    share|improve this question














    bumped to the homepage by Community 16 mins ago


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


















      2












      2








      2


      1






      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.










      share|improve this question














      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.







      linux centos dnsmasq






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 5 '16 at 21:42









      MSF004MSF004

      958




      958





      bumped to the homepage by Community 16 mins ago


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







      bumped to the homepage by Community 16 mins ago


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
























          1 Answer
          1






          active

          oldest

          votes


















          0














          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:




          • DNSMasq man






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "106"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f328260%2fdnsmasq-different-responses-for-specific-mac-addresses%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            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:




            • DNSMasq man






            share|improve this answer




























              0














              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:




              • DNSMasq man






              share|improve this answer


























                0












                0








                0







                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:




                • DNSMasq man






                share|improve this answer













                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:




                • DNSMasq man







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 6 '16 at 8:46









                OukiOuki

                3,84421425




                3,84421425






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f328260%2fdnsmasq-different-responses-for-specific-mac-addresses%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Accessing regular linux commands in Huawei's Dopra Linux

                    Can't connect RFCOMM socket: Host is down

                    Kernel panic - not syncing: Fatal Exception in Interrupt