Skip to content

Instantly share code, notes, and snippets.

@davidhamann
Last active April 13, 2017 20:48
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 davidhamann/8703e111a2907e49610ed5c1ac459f21 to your computer and use it in GitHub Desktop.
Save davidhamann/8703e111a2907e49610ed5c1ac459f21 to your computer and use it in GitHub Desktop.
Forward VPN traffic on macOS >=10.11; Create nat-rules load file first. Then, from other Mac, set gateway address to the Mac with the VPN running. Et voilà!
#!/bin/sh
sysctl -w net.inet.ip.forwarding=1
sysctl -w net.inet.ip.fw.enable=1
pfctl -f ./nat-rules -e
# nat-rules could look like this:
# nat on utun0 from en0:network to any -> (utun0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment