OS X: From ipfw to pfctl - Forward port 80 and 443
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
add a comment |
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
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
add a comment |
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
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
macos port-forwarding ipfw pf
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
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
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).
add a comment |
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 -
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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).
add a comment |
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).
add a comment |
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).
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).
answered May 11 '15 at 5:55
GLaDERGLaDER
17618
17618
add a comment |
add a comment |
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 -
add a comment |
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 -
add a comment |
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 -
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 -
edited Dec 18 '18 at 16:22
Worthwelle
2,68731125
2,68731125
answered Dec 18 '18 at 15:50
HewwoCrazinessHewwoCraziness
416
416
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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