Dropping DNS connection via iptables for testing

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I am trying to monitor behaviour of simple TV set-top box while losing connection to one or other DNS. The box is behind simple linux machine with debian which is then connected to network with DHCP and such. I am trying to use the middle-machine as traffic filter, so I can see if the set-top box switch easily to second DNS after losing connection with current.



When I am trying to DROP connection via iptables on the linux machine, banning IP of DNS, which is then unpingable from the machine (proving iptables config takes effect], the set-top box is still able to use the DNS normally. Monitoring the traffic using tcpdump proves it. Set-top box itself is obtaining all the info from network. The purpose is to simulate possible full or partial DNS failure in real envirnoment.



Using variations of: (OUTPUT, -d)
iptables -A INPUT -s 212.X.X.X -j DROP
even (OUTPUT)
iptables -A INPUT -p udp --dport 53 -j DROP
iptables -A INPUT -p tcp --dport 53 -j DROP


I am not sure what I am missing here (and I certainly do). I was also specifying interface facing network and such







share|improve this question











migrated from serverfault.com Jun 5 at 10:20


This question came from our site for system and network administrators.


















    up vote
    0
    down vote

    favorite












    I am trying to monitor behaviour of simple TV set-top box while losing connection to one or other DNS. The box is behind simple linux machine with debian which is then connected to network with DHCP and such. I am trying to use the middle-machine as traffic filter, so I can see if the set-top box switch easily to second DNS after losing connection with current.



    When I am trying to DROP connection via iptables on the linux machine, banning IP of DNS, which is then unpingable from the machine (proving iptables config takes effect], the set-top box is still able to use the DNS normally. Monitoring the traffic using tcpdump proves it. Set-top box itself is obtaining all the info from network. The purpose is to simulate possible full or partial DNS failure in real envirnoment.



    Using variations of: (OUTPUT, -d)
    iptables -A INPUT -s 212.X.X.X -j DROP
    even (OUTPUT)
    iptables -A INPUT -p udp --dport 53 -j DROP
    iptables -A INPUT -p tcp --dport 53 -j DROP


    I am not sure what I am missing here (and I certainly do). I was also specifying interface facing network and such







    share|improve this question











    migrated from serverfault.com Jun 5 at 10:20


    This question came from our site for system and network administrators.
















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am trying to monitor behaviour of simple TV set-top box while losing connection to one or other DNS. The box is behind simple linux machine with debian which is then connected to network with DHCP and such. I am trying to use the middle-machine as traffic filter, so I can see if the set-top box switch easily to second DNS after losing connection with current.



      When I am trying to DROP connection via iptables on the linux machine, banning IP of DNS, which is then unpingable from the machine (proving iptables config takes effect], the set-top box is still able to use the DNS normally. Monitoring the traffic using tcpdump proves it. Set-top box itself is obtaining all the info from network. The purpose is to simulate possible full or partial DNS failure in real envirnoment.



      Using variations of: (OUTPUT, -d)
      iptables -A INPUT -s 212.X.X.X -j DROP
      even (OUTPUT)
      iptables -A INPUT -p udp --dport 53 -j DROP
      iptables -A INPUT -p tcp --dport 53 -j DROP


      I am not sure what I am missing here (and I certainly do). I was also specifying interface facing network and such







      share|improve this question











      I am trying to monitor behaviour of simple TV set-top box while losing connection to one or other DNS. The box is behind simple linux machine with debian which is then connected to network with DHCP and such. I am trying to use the middle-machine as traffic filter, so I can see if the set-top box switch easily to second DNS after losing connection with current.



      When I am trying to DROP connection via iptables on the linux machine, banning IP of DNS, which is then unpingable from the machine (proving iptables config takes effect], the set-top box is still able to use the DNS normally. Monitoring the traffic using tcpdump proves it. Set-top box itself is obtaining all the info from network. The purpose is to simulate possible full or partial DNS failure in real envirnoment.



      Using variations of: (OUTPUT, -d)
      iptables -A INPUT -s 212.X.X.X -j DROP
      even (OUTPUT)
      iptables -A INPUT -p udp --dport 53 -j DROP
      iptables -A INPUT -p tcp --dport 53 -j DROP


      I am not sure what I am missing here (and I certainly do). I was also specifying interface facing network and such









      share|improve this question










      share|improve this question




      share|improve this question









      asked May 4 at 6:12







      J B











      migrated from serverfault.com Jun 5 at 10:20


      This question came from our site for system and network administrators.






      migrated from serverfault.com Jun 5 at 10:20


      This question came from our site for system and network administrators.






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote













          The INPUT chain in IPTables acts on traffic whose destination is the computer running IPTables. It does not affect forwarded traffic.



          You need to use the FORWARD chain for packets that go through the computer and that are not directed to it.



          For example:



          iptables -I FORWARD 1 -s 192.168.0.0/24 -d <destinationIP> -p udp --dport 53 -j DROP


          This rule drops all UDP packets from 192.168.0.0/24 network to port 53.






          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',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            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%2f447955%2fdropping-dns-connection-via-iptables-for-testing%23new-answer', 'question_page');

            );

            Post as a guest





























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            3
            down vote













            The INPUT chain in IPTables acts on traffic whose destination is the computer running IPTables. It does not affect forwarded traffic.



            You need to use the FORWARD chain for packets that go through the computer and that are not directed to it.



            For example:



            iptables -I FORWARD 1 -s 192.168.0.0/24 -d <destinationIP> -p udp --dport 53 -j DROP


            This rule drops all UDP packets from 192.168.0.0/24 network to port 53.






            share|improve this answer

























              up vote
              3
              down vote













              The INPUT chain in IPTables acts on traffic whose destination is the computer running IPTables. It does not affect forwarded traffic.



              You need to use the FORWARD chain for packets that go through the computer and that are not directed to it.



              For example:



              iptables -I FORWARD 1 -s 192.168.0.0/24 -d <destinationIP> -p udp --dport 53 -j DROP


              This rule drops all UDP packets from 192.168.0.0/24 network to port 53.






              share|improve this answer























                up vote
                3
                down vote










                up vote
                3
                down vote









                The INPUT chain in IPTables acts on traffic whose destination is the computer running IPTables. It does not affect forwarded traffic.



                You need to use the FORWARD chain for packets that go through the computer and that are not directed to it.



                For example:



                iptables -I FORWARD 1 -s 192.168.0.0/24 -d <destinationIP> -p udp --dport 53 -j DROP


                This rule drops all UDP packets from 192.168.0.0/24 network to port 53.






                share|improve this answer













                The INPUT chain in IPTables acts on traffic whose destination is the computer running IPTables. It does not affect forwarded traffic.



                You need to use the FORWARD chain for packets that go through the computer and that are not directed to it.



                For example:



                iptables -I FORWARD 1 -s 192.168.0.0/24 -d <destinationIP> -p udp --dport 53 -j DROP


                This rule drops all UDP packets from 192.168.0.0/24 network to port 53.







                share|improve this answer













                share|improve this answer



                share|improve this answer











                answered May 4 at 6:29









                Tero Kilkanen

                50126




                50126






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f447955%2fdropping-dns-connection-via-iptables-for-testing%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    Peggy Mitchell

                    Palaiologos

                    The Forum (Inglewood, California)