TransWikia.com

MacOS pf equivalent to iptables rule

Ask Different Asked by Diogo Ferreira on January 5, 2021

I am looking to implement a rule like the following iptables rule on my Mac.

sudo iptables -t nat -A OUTPUT -d 10.244.1.8 -p tcp --dport 4369 -j DNAT --to-destination 127.0.0.1:4369

Context: In my current setup I am port forwarding a container in k8s through kubectl port-forward and I am trying to, when I ping the IP of the running erlang node on the container be able to translate this IP into the localhost to carry the processing (the setup can be found on this post https://www.mendrugory.com/post/remote-elixir-node-kubernetes/)

Thanks in advance!

One Answer

After having struggle with this issue for a long time I was able to achieve the desired effect by:

sudo ifconfig lo0 alias <ip>
rdr pass on lo0 inet proto tcp from any to <ip> port <port> -> 127.0.0.1

Answered by Diogo Ferreira on January 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP