Skip to content

Instantly share code, notes, and snippets.

@woodedlawn
Forked from kujohn/portforwarding.md
Last active January 1, 2016 17:39
Show Gist options
  • Select an option

  • Save woodedlawn/8178405 to your computer and use it in GitHub Desktop.

Select an option

Save woodedlawn/8178405 to your computer and use it in GitHub Desktop.

Port Forwarding in Mavericks


Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

####1. anchor file Create an anchor file somewhere with your redirection rule like:

rdr pass on lo0 inet proto tcp from any to 127.0.0.1 port 80 -> 127.0.0.1 port 5000

####2. config file Create a config file somewhere to load the anchor file:

rdr-anchor "forwarding"
load anchor "forwarding" from "/path/to/<anchor file>"

####3. test the configuration file

sudo pfctl -vnf /path/to/<config file>

####4. load the configuration file

sudo pfctl -evf /path/to/<config file>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment