title: Using pfctl on Mac OS 10.11 (El Capitan) to forward ports
body: <p>I am currently testing if my developing environment will run on the new upcoming Mac OS 10.11 and if I can upgrade as soon as it's released. On my test machine I am currently running the Beta Preview 3. Everything seems to be running fine. </p>
  
  <p>I just can get <code>pfctl</code> to forward my ports. I use Vagrant and Parallels Desktop to run a Debian system for my local web server. Vagrant forwards port 8080 on the host to 80 on the guest. So <code>127.0.0.1:8080</code> works fine. But in some projects I want to have the exact same domain local as it will be in production. (without the :8080) Also I just like it more. ;-)</p>
  
  <p>To do that I use <code>pfctl</code> to forward 80 to 8080 on the host. Here are my config files:</p>
  
  <p><em>~/port-forwarding/pf.conf</em></p>
  
  <pre><code>rdr-anchor "forwarding"
  load anchor "forwarding" from "/Users/nick/port-forwarding/rules.conf"
  </code></pre>
  
  <p><em>~/port-forwarding/rules.conf</em></p>
  
  <pre><code>rdr pass on lo0 inet proto tcp from any to any port 80 -&gt; 127.0.0.1 port 8080 
  rdr pass on lo0 inet proto tcp from any to any port 443 -&gt; 127.0.0.1 port 4433 
  </code></pre>
  
  <p>To enable it, I run:</p>
  
  <pre><code>sudo pfctl -vnf ~/port-forwarding/pf.conf
  sudo pfctl -evf ~/port-forwarding/pf.conf
  </code></pre>
  
  <p>This gives me this:</p>
  
  <pre><code>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 -&gt; 127.0.0.1 port 8080
  rdr pass on lo0 inet proto tcp from any to any port = 443 -&gt; 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 -&gt; 127.0.0.1 port 8080
  rdr pass on lo0 inet proto tcp from any to any port = 443 -&gt; 127.0.0.1 port 4433
  pf enabled
  logout
  Saving session...completed.
  </code></pre>
  
  <p><em>sudo pfctl -s nat</em> says:</p>
  
  <pre><code>No ALTQ support in kernel
  ALTQ related functions disabled
  rdr-anchor "forwarding" all
  </code></pre>
  
  <p>So far it looks good, I think. But it just does not work. </p>
  
  <p><code>127.0.0.1:80</code> - no connection
  <code>127.0.0.1:8080</code> - works</p>
  
  <p>I use the same files on Yosemite and it works fine there. </p>
  
  <p>Does anyone know if there's been a change on how to use <code>pfctl</code> or if I am doing something wrong or if there's a bug which can be reported.</p>
  
  <p>Thanks a lot</p>
  
  <p>Nick</p>