OS X: From ipfw to pfctl - Forward port 80 and 443












10















I found a way to forward ports 80 and 443 to other arbitrary ports (3000 and 3001 in my case) using ipfw. But ipfw is deprecated and replaced by pfctl. Here are my ipfw declarations:



sudo ipfw flush
sudo ipfw add 100 fwd 127.0.0.1,3000 tcp from any to me 443
sudo ipfw add 200 fwd 127.0.0.1,3001 tcp from any to me 80
sudo ipfw show


How can I do the same thing with pfctl please?










share|improve this question























  • this is a duplicate whatch for your answer here: superuser.com/questions/473039/pfctl-port-forwarding-in-mac-osx

    – chris
    Aug 11 '14 at 11:34
















10















I found a way to forward ports 80 and 443 to other arbitrary ports (3000 and 3001 in my case) using ipfw. But ipfw is deprecated and replaced by pfctl. Here are my ipfw declarations:



sudo ipfw flush
sudo ipfw add 100 fwd 127.0.0.1,3000 tcp from any to me 443
sudo ipfw add 200 fwd 127.0.0.1,3001 tcp from any to me 80
sudo ipfw show


How can I do the same thing with pfctl please?










share|improve this question























  • this is a duplicate whatch for your answer here: superuser.com/questions/473039/pfctl-port-forwarding-in-mac-osx

    – chris
    Aug 11 '14 at 11:34














10












10








10


1






I found a way to forward ports 80 and 443 to other arbitrary ports (3000 and 3001 in my case) using ipfw. But ipfw is deprecated and replaced by pfctl. Here are my ipfw declarations:



sudo ipfw flush
sudo ipfw add 100 fwd 127.0.0.1,3000 tcp from any to me 443
sudo ipfw add 200 fwd 127.0.0.1,3001 tcp from any to me 80
sudo ipfw show


How can I do the same thing with pfctl please?










share|improve this question














I found a way to forward ports 80 and 443 to other arbitrary ports (3000 and 3001 in my case) using ipfw. But ipfw is deprecated and replaced by pfctl. Here are my ipfw declarations:



sudo ipfw flush
sudo ipfw add 100 fwd 127.0.0.1,3000 tcp from any to me 443
sudo ipfw add 200 fwd 127.0.0.1,3001 tcp from any to me 80
sudo ipfw show


How can I do the same thing with pfctl please?







macos port-forwarding ipfw pf






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jul 8 '13 at 18:32









Robert AudiRobert Audi

230415




230415













  • this is a duplicate whatch for your answer here: superuser.com/questions/473039/pfctl-port-forwarding-in-mac-osx

    – chris
    Aug 11 '14 at 11:34



















  • this is a duplicate whatch for your answer here: superuser.com/questions/473039/pfctl-port-forwarding-in-mac-osx

    – chris
    Aug 11 '14 at 11:34

















this is a duplicate whatch for your answer here: superuser.com/questions/473039/pfctl-port-forwarding-in-mac-osx

– chris
Aug 11 '14 at 11:34





this is a duplicate whatch for your answer here: superuser.com/questions/473039/pfctl-port-forwarding-in-mac-osx

– chris
Aug 11 '14 at 11:34










2 Answers
2






active

oldest

votes


















0














I am still using Mountain Lion on my laptop so I am not currently available to try this, but look around a bit on BSD-related forums for "pf port forwarding" and such if this does not help you!



Port forwarding in Mavericks (and above).






share|improve this answer































    0














    See this AskDifferent answer:




    To forward all port 80 traffic to port 8080, you can enter the following from the Terminal command line.



    echo "rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080" | sudo pfctl -ef -


    Taken from https://salferrarello.com/mac-pfctl-port-forwarding/




    To forward ports 80 and 443 to ports 3000 and 3001, use these commands:



    echo "rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 3000" | sudo pfctl -ef -
    echo "rdr pass inet proto tcp from any to any port 443 -> 127.0.0.1 port 3001" | sudo pfctl -ef -





    share|improve this answer

























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "3"
      };
      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: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      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%2fsuperuser.com%2fquestions%2f617103%2fos-x-from-ipfw-to-pfctl-forward-port-80-and-443%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      I am still using Mountain Lion on my laptop so I am not currently available to try this, but look around a bit on BSD-related forums for "pf port forwarding" and such if this does not help you!



      Port forwarding in Mavericks (and above).






      share|improve this answer




























        0














        I am still using Mountain Lion on my laptop so I am not currently available to try this, but look around a bit on BSD-related forums for "pf port forwarding" and such if this does not help you!



        Port forwarding in Mavericks (and above).






        share|improve this answer


























          0












          0








          0







          I am still using Mountain Lion on my laptop so I am not currently available to try this, but look around a bit on BSD-related forums for "pf port forwarding" and such if this does not help you!



          Port forwarding in Mavericks (and above).






          share|improve this answer













          I am still using Mountain Lion on my laptop so I am not currently available to try this, but look around a bit on BSD-related forums for "pf port forwarding" and such if this does not help you!



          Port forwarding in Mavericks (and above).







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered May 11 '15 at 5:55









          GLaDERGLaDER

          17618




          17618

























              0














              See this AskDifferent answer:




              To forward all port 80 traffic to port 8080, you can enter the following from the Terminal command line.



              echo "rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080" | sudo pfctl -ef -


              Taken from https://salferrarello.com/mac-pfctl-port-forwarding/




              To forward ports 80 and 443 to ports 3000 and 3001, use these commands:



              echo "rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 3000" | sudo pfctl -ef -
              echo "rdr pass inet proto tcp from any to any port 443 -> 127.0.0.1 port 3001" | sudo pfctl -ef -





              share|improve this answer






























                0














                See this AskDifferent answer:




                To forward all port 80 traffic to port 8080, you can enter the following from the Terminal command line.



                echo "rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080" | sudo pfctl -ef -


                Taken from https://salferrarello.com/mac-pfctl-port-forwarding/




                To forward ports 80 and 443 to ports 3000 and 3001, use these commands:



                echo "rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 3000" | sudo pfctl -ef -
                echo "rdr pass inet proto tcp from any to any port 443 -> 127.0.0.1 port 3001" | sudo pfctl -ef -





                share|improve this answer




























                  0












                  0








                  0







                  See this AskDifferent answer:




                  To forward all port 80 traffic to port 8080, you can enter the following from the Terminal command line.



                  echo "rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080" | sudo pfctl -ef -


                  Taken from https://salferrarello.com/mac-pfctl-port-forwarding/




                  To forward ports 80 and 443 to ports 3000 and 3001, use these commands:



                  echo "rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 3000" | sudo pfctl -ef -
                  echo "rdr pass inet proto tcp from any to any port 443 -> 127.0.0.1 port 3001" | sudo pfctl -ef -





                  share|improve this answer















                  See this AskDifferent answer:




                  To forward all port 80 traffic to port 8080, you can enter the following from the Terminal command line.



                  echo "rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080" | sudo pfctl -ef -


                  Taken from https://salferrarello.com/mac-pfctl-port-forwarding/




                  To forward ports 80 and 443 to ports 3000 and 3001, use these commands:



                  echo "rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 3000" | sudo pfctl -ef -
                  echo "rdr pass inet proto tcp from any to any port 443 -> 127.0.0.1 port 3001" | sudo pfctl -ef -






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Dec 18 '18 at 16:22









                  Worthwelle

                  2,68731125




                  2,68731125










                  answered Dec 18 '18 at 15:50









                  HewwoCrazinessHewwoCraziness

                  416




                  416






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Super User!


                      • 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%2fsuperuser.com%2fquestions%2f617103%2fos-x-from-ipfw-to-pfctl-forward-port-80-and-443%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

                      Plaza Victoria

                      In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

                      How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...