Forked from ozel/enable NAT and IP forwarding on Mac OS X (10.10)
Created
February 13, 2024 07:53
-
-
Save vapopov/9e1b3cc108ecc3f78c68a5978b4b2f1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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