I have a server running on my iMac (port 8000) and I want my iPad to be able to visit it through the local network so I set this rule using pf anchors (hence ipfw is gone).

It doesn't work, what am I missing?

file: /etc/pf.anchors/com.test

rdr pass on lo0 inet proto tcp from any to port 80 -> port 8000
rdr pass on lo0 inet proto tcp from any to port 8000 -> port 8000

enable the command:

pfctl -ef /etc/pf.anchors/com.test

Visiting my iMac's IP-address from the iPad gives me an unreachable message (Safari)

From my iMac all seems OK:

# nc -v 80
found 0 associations
found 1 connections:
     1: flags=82<CONNECTED,PREFERRED>
    outif lo0
    src port 52342
    dst port 5001
    rank info not available
    TCP aux info available

Connection to port 80 [tcp/http] succeeded!

# curl -I
HTTP/1.0 302 FOUND
Date: Wed, 25 Feb 2015 10:39:47 GMT
Server: WSGIServer/0.1 Python/2.7.6
Vary: Cookie
Content-Type: text/html; charset=utf-8

Try using this command:

echo "rdr pass inet proto tcp from any to any port 80 -> port 8000" | sudo pfctl -ef -

That command should forward your port 80 to port 8000. I got that from this website http://salferrarello.com/mac-pfctl-port-forwarding/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .