Allow ufw rule to curl localhost for a specific port

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











up vote
0
down vote

favorite












I want to allow curl -if localhost:54321 only with ufw. What rule can I apply from the command line?



I have tried ufw allow proto tcp from any to any port 54321 and ufw status shows the following:



To Action From
-- ------ ----
54321/tcp ALLOW Anywhere
54321/tcp (v6) ALLOW Anywhere (v6)


But still I'm unable to curl -if localhost:54321.







share|improve this question


















  • 2




    There's a pretty clear example on the ufw man page that allows tcp connections from an IP to a port. Did you try that one?
    – Zip
    Oct 30 '17 at 10:31















up vote
0
down vote

favorite












I want to allow curl -if localhost:54321 only with ufw. What rule can I apply from the command line?



I have tried ufw allow proto tcp from any to any port 54321 and ufw status shows the following:



To Action From
-- ------ ----
54321/tcp ALLOW Anywhere
54321/tcp (v6) ALLOW Anywhere (v6)


But still I'm unable to curl -if localhost:54321.







share|improve this question


















  • 2




    There's a pretty clear example on the ufw man page that allows tcp connections from an IP to a port. Did you try that one?
    – Zip
    Oct 30 '17 at 10:31













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I want to allow curl -if localhost:54321 only with ufw. What rule can I apply from the command line?



I have tried ufw allow proto tcp from any to any port 54321 and ufw status shows the following:



To Action From
-- ------ ----
54321/tcp ALLOW Anywhere
54321/tcp (v6) ALLOW Anywhere (v6)


But still I'm unable to curl -if localhost:54321.







share|improve this question














I want to allow curl -if localhost:54321 only with ufw. What rule can I apply from the command line?



I have tried ufw allow proto tcp from any to any port 54321 and ufw status shows the following:



To Action From
-- ------ ----
54321/tcp ALLOW Anywhere
54321/tcp (v6) ALLOW Anywhere (v6)


But still I'm unable to curl -if localhost:54321.









share|improve this question













share|improve this question




share|improve this question








edited Oct 31 '17 at 3:30

























asked Oct 30 '17 at 8:54









Sayanee

1316




1316







  • 2




    There's a pretty clear example on the ufw man page that allows tcp connections from an IP to a port. Did you try that one?
    – Zip
    Oct 30 '17 at 10:31













  • 2




    There's a pretty clear example on the ufw man page that allows tcp connections from an IP to a port. Did you try that one?
    – Zip
    Oct 30 '17 at 10:31








2




2




There's a pretty clear example on the ufw man page that allows tcp connections from an IP to a port. Did you try that one?
– Zip
Oct 30 '17 at 10:31





There's a pretty clear example on the ufw man page that allows tcp connections from an IP to a port. Did you try that one?
– Zip
Oct 30 '17 at 10:31











2 Answers
2






active

oldest

votes

















up vote
0
down vote













From man ufw:




Allow access to udp 1.2.3.4 port 5469 from 1.2.3.5 port 5469:

ufw allow proto udp from 1.2.3.5 port 5469 to 1.2.3.4 port 5469



Hence the command you're looking for is



 ufw allow proto tcp from <ip_source> to <ip_destination> port 54321





share|improve this answer



























    up vote
    0
    down vote













    Got it:



    ufw allow proto tcp from any to any port 54321,54322
    ufw allow out proto tcp from any to any port 54321,54322





    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%2f401368%2fallow-ufw-rule-to-curl-localhost-for-a-specific-port%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      0
      down vote













      From man ufw:




      Allow access to udp 1.2.3.4 port 5469 from 1.2.3.5 port 5469:

      ufw allow proto udp from 1.2.3.5 port 5469 to 1.2.3.4 port 5469



      Hence the command you're looking for is



       ufw allow proto tcp from <ip_source> to <ip_destination> port 54321





      share|improve this answer
























        up vote
        0
        down vote













        From man ufw:




        Allow access to udp 1.2.3.4 port 5469 from 1.2.3.5 port 5469:

        ufw allow proto udp from 1.2.3.5 port 5469 to 1.2.3.4 port 5469



        Hence the command you're looking for is



         ufw allow proto tcp from <ip_source> to <ip_destination> port 54321





        share|improve this answer






















          up vote
          0
          down vote










          up vote
          0
          down vote









          From man ufw:




          Allow access to udp 1.2.3.4 port 5469 from 1.2.3.5 port 5469:

          ufw allow proto udp from 1.2.3.5 port 5469 to 1.2.3.4 port 5469



          Hence the command you're looking for is



           ufw allow proto tcp from <ip_source> to <ip_destination> port 54321





          share|improve this answer












          From man ufw:




          Allow access to udp 1.2.3.4 port 5469 from 1.2.3.5 port 5469:

          ufw allow proto udp from 1.2.3.5 port 5469 to 1.2.3.4 port 5469



          Hence the command you're looking for is



           ufw allow proto tcp from <ip_source> to <ip_destination> port 54321






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 30 '17 at 12:45









          dr01

          15.3k114769




          15.3k114769






















              up vote
              0
              down vote













              Got it:



              ufw allow proto tcp from any to any port 54321,54322
              ufw allow out proto tcp from any to any port 54321,54322





              share|improve this answer
























                up vote
                0
                down vote













                Got it:



                ufw allow proto tcp from any to any port 54321,54322
                ufw allow out proto tcp from any to any port 54321,54322





                share|improve this answer






















                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  Got it:



                  ufw allow proto tcp from any to any port 54321,54322
                  ufw allow out proto tcp from any to any port 54321,54322





                  share|improve this answer












                  Got it:



                  ufw allow proto tcp from any to any port 54321,54322
                  ufw allow out proto tcp from any to any port 54321,54322






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Oct 31 '17 at 7:45









                  Sayanee

                  1316




                  1316



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f401368%2fallow-ufw-rule-to-curl-localhost-for-a-specific-port%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      Peggy Mitchell

                      The Forum (Inglewood, California)

                      Palaiologos