I am looking for the equivalent Macos command to the linux:
sudo iptables -t nat -A POSTROUTING -o en0 -j MASQUERADE
The reason i want to do this is I have a VPN that has the default route, but i would like certain apps to go over the physical uplink rather than the VPN.
Using pfctl i have done the following:
pass out route-to (en0 192.168.4.1) group skipvpn flags any
Where 192.168.4.1 is the ip of my gateway, and this does appear to route all packets from apps in the skipvpn group to the en0 interface (rather than the tunnel). I verify this using tcpdump
However the 'source ips' of all the packets that have been re-routed still have the source ip of the VPN (a 10.0.0.0/8 range-ip), causing things to break of course (i.e returning packets can never find their way back..)
As a result I tried to nat the source ips using this:
nat on en0 from any to any -> en0
But this does NOT appear to work, the source IPs are still broken, and do not correspond to the source ip of my en0 interface.
How do i ensure that the source ips are set correctly for these re-routed packets?