Tutorial: Configure Network Address Translation (NAT) on macOS
This tutorial shows you the steps to take to enable NAT on your macOS computer.
Steps: Enable NAT on macOS
Create a file titled “
pf-nat.conf
” and add this rule:nat on enX from 100.96.0.0/11 to any -> enX
Note
Where
enX
is the main network interface of the host and100.96.0.0/11
is the default WPC subnet. If the WPC subnet was changed in the CloudConnexa Portal - Settings > WPC, "please replace 100.96.0.0/11, in the command above, with the updated IPv4 WPC subnet:
Save the pf-nat.conf file.
Start pfctl using the rule from the pf-nat.conf file.
sudo pfctl -d
#disablespfctl
sudo pfctl -F all
#flushes allpfctl
rulessudo pfctl -f /Path/to/file/pf-nat.conf -e
#starts pfctl and loads the rules from thepf-nat.conf
file
If you want the NAT rule to be permanent:
Create a backup of the default
pf.conf
file (sudo cp -p /etc/pf.conf /etc/pf.conf.bak
)Add your own rules to
/etc/pf.conf
(appending them after the default Apple anchors):nat
onenX
from100.96.0.0/11
to any ->enX
Load your custom rules (
sudo pfctl -f /etc/pf.conf)
(Re)Enable the packet filter firewall (
sudo pfctl -E
)