-
-
Save fernyb/4daf9254af85641291ee to your computer and use it in GitHub Desktop.
Port Forwarding and Domain Tricks (MAC OSX Yosemite)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In /etc/hosts, add: | |
127.0.0.1 foo.com | |
Create /etc/pf.anchors/foo.conf | |
$sudo vim /etc/pf.anchors/foo.conf | |
rdr pass on lo0 inet proto tcp from any to any port 80 -> 127.0.0.1 port 3000 | |
Add this to /etc/pf.conf: | |
$sudo vim /etc/pf.conf | |
rdr-anchor "forwarding" | |
load anchor "forwarding" from "/etc/pf.anchors/foo.conf" | |
Then load it up: | |
$ sudo pfctl -ef /etc/pf.anchors/foo.conf | |
If it doesnt work make sure the following is set: | |
$ sudo sysctl -a | grep forwarding | |
net.inet.ip.forwarding: 1 | |
net.inet6.ip6.forwarding: 1 | |
set it like this: | |
sudo sysctl -w net.inet.ip.forwarding=1 | |
sudo sysctl -w net.inet6.ip6.forwarding=1 | |
Add it to /etc/sysctl.conf and reboot for changes to take effect. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment