mac上原本使用ipfw来完成类似iptable的事情,但是
The ipfw command is deprecated in OS X Mountain Lion and later, but it has not been removed from Mavericks. If you run man ipfw
, a message will appear saying: This utility is DEPRECATED. Please use pfctl(8)
instead. While you may want to do port forwarding with pfctl
to future proof your solution, these instructions showing how to use ipfw
to do port forwarding will still work on OS X Mavericks.
http://knowm.org/port-forwarding-80-to-8080-using-ipfw-on-mac-os-x/
关于pfctl的使用: https://gist.github.com/kujohn/7209628