How to allow access to a localhost tcp port to one specific external IP address?

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








up vote
0
down vote

favorite












Say we have a reddis server on localhost. We need to connect it from some other IPs. We know public IP of a node that we want to connect to our localhost port and have sudo. How to allow access to a localhost tcp port to one specific external IP address? And how to disable that access when we want?










share|improve this question

























    up vote
    0
    down vote

    favorite












    Say we have a reddis server on localhost. We need to connect it from some other IPs. We know public IP of a node that we want to connect to our localhost port and have sudo. How to allow access to a localhost tcp port to one specific external IP address? And how to disable that access when we want?










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Say we have a reddis server on localhost. We need to connect it from some other IPs. We know public IP of a node that we want to connect to our localhost port and have sudo. How to allow access to a localhost tcp port to one specific external IP address? And how to disable that access when we want?










      share|improve this question













      Say we have a reddis server on localhost. We need to connect it from some other IPs. We know public IP of a node that we want to connect to our localhost port and have sudo. How to allow access to a localhost tcp port to one specific external IP address? And how to disable that access when we want?







      networking server proxy






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 7 at 20:07









      Blender

      513




      513




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          ufw can be used for this.



          sudo ufw default deny incoming
          sudo ufw allow from 192.168.1.10 to any port 80
          sudo ufw enable


          will deny all traffic unless allowed, and then add a rule to allow traffic from 192.168.1.10 to port 80 on local machine. Note that this will block new ssh connections, unless you do a



          sudo ufw allow ssh


          which will open port 22 for incoming from any address.



          man ufw in a terminal will bring up the manual page, describing all available options.






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "89"
            ;
            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: true,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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%2faskubuntu.com%2fquestions%2f1004001%2fhow-to-allow-access-to-a-localhost-tcp-port-to-one-specific-external-ip-address%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
            0
            down vote













            ufw can be used for this.



            sudo ufw default deny incoming
            sudo ufw allow from 192.168.1.10 to any port 80
            sudo ufw enable


            will deny all traffic unless allowed, and then add a rule to allow traffic from 192.168.1.10 to port 80 on local machine. Note that this will block new ssh connections, unless you do a



            sudo ufw allow ssh


            which will open port 22 for incoming from any address.



            man ufw in a terminal will bring up the manual page, describing all available options.






            share|improve this answer
























              up vote
              0
              down vote













              ufw can be used for this.



              sudo ufw default deny incoming
              sudo ufw allow from 192.168.1.10 to any port 80
              sudo ufw enable


              will deny all traffic unless allowed, and then add a rule to allow traffic from 192.168.1.10 to port 80 on local machine. Note that this will block new ssh connections, unless you do a



              sudo ufw allow ssh


              which will open port 22 for incoming from any address.



              man ufw in a terminal will bring up the manual page, describing all available options.






              share|improve this answer






















                up vote
                0
                down vote










                up vote
                0
                down vote









                ufw can be used for this.



                sudo ufw default deny incoming
                sudo ufw allow from 192.168.1.10 to any port 80
                sudo ufw enable


                will deny all traffic unless allowed, and then add a rule to allow traffic from 192.168.1.10 to port 80 on local machine. Note that this will block new ssh connections, unless you do a



                sudo ufw allow ssh


                which will open port 22 for incoming from any address.



                man ufw in a terminal will bring up the manual page, describing all available options.






                share|improve this answer












                ufw can be used for this.



                sudo ufw default deny incoming
                sudo ufw allow from 192.168.1.10 to any port 80
                sudo ufw enable


                will deny all traffic unless allowed, and then add a rule to allow traffic from 192.168.1.10 to port 80 on local machine. Note that this will block new ssh connections, unless you do a



                sudo ufw allow ssh


                which will open port 22 for incoming from any address.



                man ufw in a terminal will bring up the manual page, describing all available options.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 7 at 20:25









                vidarlo

                7,25642140




                7,25642140



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1004001%2fhow-to-allow-access-to-a-localhost-tcp-port-to-one-specific-external-ip-address%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    pylint3 and pip3 broken

                    Missing snmpget and snmpwalk

                    How to enroll fingerprints to Ubuntu 17.10 with VFS491