Skip to content

Instantly share code, notes, and snippets.

@freakadell
Forked from retspen/pf_nat
Created February 8, 2022 21:51
Show Gist options
  • Save freakadell/dad29a64d9a9500fa8a60e77490de477 to your computer and use it in GitHub Desktop.
Save freakadell/dad29a64d9a9500fa8a60e77490de477 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