I’m looking for an updated (Big Sur) MacOS alternative for this iptables command:
sudo sysctl net.ipv4.ip_forward=1 sudo iptables -t nat -I PREROUTING -p tcp --dport 55 -j REDIRECT --to-port 8080
E.g. allow port forwarding, and forward all tcp traffic destined to port 55 to a tcp proxy listening at 127.0.0.1:8080
Trying to accomplish the same, I got to the following on Mac:
sudo sysctl -w net.inet.ip.forwarding=1 echo "rdr pass inet proto tcp from any to any port 55 -> 127.0.0.1 port 8080" | sudo pfctl -ef -
This however doesn’t work, and instead clogs the packets in a way that they never reach my proxy.
Any help appreciated.