Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vapopov/9e1b3cc108ecc3f78c68a5978b4b2f1c to your computer and use it in GitHub Desktop.
Save vapopov/9e1b3cc108ecc3f78c68a5978b4b2f1c to your computer and use it in GitHub Desktop.
# enable IP forwarding and firewall in the kernel
sudo sysctl -w net.inet.ip.forwarding=1
sudo sysctl -w net.inet.ip.fw.enable=1
#flush all FW rules
sudo pfctl -F all # or -F nat, for just the nat rules
cat ./nat-rules
nat on en0 from 192.168.1.0/24 to any -> ozelmacpro #put this line in a text file
# en0 is the interface pointing to the network with internet access
# ozelmacpro is the local hostname or ip associated with the network that has internet access
# 192.168.1.0/24 is a separate network that shall get internet via ozelmacpro on interface en0
# final hint on this via https://discussions.apple.com/thread/6757798?start=0&tstart=0
# load NAT rules from file
sudo pfctl -f nat-rules -e
# list all FW config
sudo pfctl -s all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment