I am currently testing whether my development environment will work on the new Mac OS 10.11, and if I can upgrade as soon as it is released. On my test machine, I am currently running Beta Preview 3. Everything seems to be working fine.
I just can get pfctl to forward my ports. I use Vagrant and Parallels Desktop to run the Debian system for my local web server. Vagrant sends port 8080 to the host, up to 80 per guest. So 127.0.0.1:8080 working fine. But in some projects I want to have the same local domain as in production. (without: 8080) I also like it better .; -)
For this, I use pfctl to forward from 80 to 8080 to the host. Here are my configuration files:
~ / port forwarding /pf.conf
rdr-anchor "forwarding" load anchor "forwarding" from "/Users/nick/port-forwarding/rules.conf"
~ / port forwarding /rules.conf
rdr pass on lo0 inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080 rdr pass on lo0 inet proto tcp from any to any port 443 -> 127.0.0.1 port 4433
To enable it, I ran:
sudo pfctl -vnf ~/port-forwarding/pf.conf sudo pfctl -evf ~/port-forwarding/pf.conf
This gives me the following:
pfctl: Use of -f option, could result in flushing of rules present in the main ruleset added by the system at startup. See /etc/pf.conf for further details. rdr-anchor "forwarding" all Loading anchor forwarding from /Users/nick/port-forwarding/rules.conf rdr pass on lo0 inet proto tcp from any to any port = 80 -> 127.0.0.1 port 8080 rdr pass on lo0 inet proto tcp from any to any port = 443 -> 127.0.0.1 port 4433 pfctl: Use of -f option, could result in flushing of rules present in the main ruleset added by the system at startup. See /etc/pf.conf for further details. No ALTQ support in kernel ALTQ related functions disabled rdr-anchor "forwarding" all Loading anchor forwarding from /Users/nick/port-forwarding/rules.conf rdr pass on lo0 inet proto tcp from any to any port = 80 -> 127.0.0.1 port 8080 rdr pass on lo0 inet proto tcp from any to any port = 443 -> 127.0.0.1 port 4433 pf enabled logout Saving session...completed.
sudo pfctl -s nat says:
No ALTQ support in kernel ALTQ related functions disabled rdr-anchor "forwarding" all
So far it looks good, I think. But that just doesn't work.
127.0.0.1:80 - no connection 127.0.0.1:8080 - working
I use the same files on Yosemite and it works great.
Does anyone know if there was a change on how to use pfctl , or if I am doing something wrong or if there is an error that can be reported.
Thank you so much
Nick
vagrant apache osx-elcapitan portforwarding macos
Dafen
source share