A useful primer on getting NAT set up under OS X using the new packet filter (pf
) functionality. Key steps are:
Enable IP Forwarding:
$ sudo sysctl -w net.inet.ip.forwarding=1
…or just stick it directly in /etc/sysctl.conf:
net.inet.ip.forwarding=1
Add the nat rule for the packet filter, to
/etc/pf.conf
after thenat-anchor
rule:nat on en0 from 10.0.0.0/24 to any -> 70.36.235.206
Load rules and enable pf:
$ pfctl -F all -f /etc/pf.conf -e
…and make it permanent by editing
/System/Library/LaunchDaemons/com.apple.pfctl.plist
to add-e
toProgramArguments
.
That’s it! You can also check status with:
$ sudo pfctl -s state