What is the Correct 'pf' Syntax for an 'iptables' Port Redirection Rule I am looking to implement a rule like the following iptables rule on my Mac, to redirect traffic from my development workstation (hosting a development copy of a Ruby on Rails project) to another host on my LAN that is running the PostgreSQL database server. Without having to change the database.yml config file on my local copy of the code:

iptables -t nat -I PREROUTING -d 127.0.0.1 -p tcp --destination-port 5432 -j DNAT --to-destination 192.168.1.104:5432
After some brief googling, I came up with this, which seems to work great.

echo "rdr pass on lo0 inet proto tcp from any to 127.0.0.1 port 5432 -&gt; 192.168.1.104 port 5432" | sudo pfctl -ef -


I am not sure that it is the best way, which is why I am posting here.  I would love to learn the best way to do this on Mac.

I did get this warning, though I don't know that it actually flushed any rules:

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
pfctl: pf already enabled


From the man page, -f is just telling it to parse the file, which I am sending in via stdin.

Any discussion, improvements, or hints would be great!