Skip to content

Instantly share code, notes, and snippets.

@fbion
Forked from retspen/pf_nat
Created October 8, 2022 08:56
Show Gist options
  • Save fbion/01a2b9e93618eb62993781bd1b4edb80 to your computer and use it in GitHub Desktop.
Save fbion/01a2b9e93618eb62993781bd1b4edb80 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