HomeApplefirewall - iptables like forwarding of packets with pfctl on mac os

firewall – iptables like forwarding of packets with pfctl on mac os


I want to construct a bridge between two interfaces with pf, like with iptables:

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE  
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT

This snippet simply forwards all packets from wifi to an ethernet interface. The best way to accomplish similar with pf? I see fairly often one thing like this in pf.conf:

rdr on en0 inet proto tcp from 192.168.1.0/24 to 192.168.1.186 port 1234 -> 192.168.1.198 port 80
nat on en0 inet proto tcp from 192.168.1.0/24 to 192.168.1.198 port 80 -> 192.168.1.186

However is not it only a ahead for a selected port and never a variety of ports?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments