Skip to content

Instantly share code, notes, and snippets.

@Remiii
Created August 19, 2015 15:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Remiii/e81f142aa4acedd46ba4 to your computer and use it in GitHub Desktop.
Save Remiii/e81f142aa4acedd46ba4 to your computer and use it in GitHub Desktop.
Mac pfctl Port Forwarding for your VM/Docker

Mac pfctl Port Forwarding for your VM/Docker

Add rules

$ cat /etc/pf.anchors/remiii.forwarding
rdr pass on lo0 inet proto tcp from any to 127.0.0.1 port 80 -> 127.0.0.1 port 10080
rdr pass on lo0 inet proto tcp from any to 127.0.0.1 port 443 -> 127.0.0.1 port 10443

Enable rules

$ sudo pfctl -ef /etc/pf.anchors/remiii.forwarding

Source: http://salferrarello.com/mac-pfctl-port-forwarding/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment