Using pfctl on Mac OS 10.11 (El Capitan) to forward ports Using pfctl on Mac OS 10.11 (El Capitan) to forward ports apache apache

Using pfctl on Mac OS 10.11 (El Capitan) to forward ports


This only applies to OSX 10.11 - El Capitan - Public Beta 1

x-post from: https://superuser.com/questions/938999/osx-10-11-el-capitan-beta-pf-conf-behaviour-changed/943981#943981

In the latest 10.11 beta, 127.0.0.1 is blocked. The solution? Use 127.0.0.2. To do this:

First add 127.0.0.2 to the loopback aliassudo ifconfig lo0 alias 127.0.0.2 up

Modify your pf rule to use the the new alias.rdr pass proto tcp from any to any port 80 -> 127.0.0.2 port 8080

From the command line, without using a file:

echo "rdr pass proto tcp from any to any port {80,8080} -> 127.0.0.2 port 8080" | pfctl -Ef - <-- Be sure to add this last tick, you're piping in STDIN)