Skip to content

Instantly share code, notes, and snippets.

@diegograssato
Forked from retspen/pf_nat
Created August 4, 2021 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diegograssato/483e7a5f7e9fc58a6a3a1c158c419374 to your computer and use it in GitHub Desktop.
Save diegograssato/483e7a5f7e9fc58a6a3a1c158c419374 to your computer and use it in GitHub Desktop.
Enable NAT on macOS
#!/bin/bash
cat > /usr/local/etc/pf-nat.conf << EOF
nat on en0 from vnic1:network to any -> (en0)
EOF
sudo pfctl -d
sudo sysctl -w net.inet.ip.forwarding=1
sudo pfctl -f /usr/local/etc/pf-nat.conf -e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment