2016年6月1日 星期三

[MacOS] 如何在MacOSX EI Capitan做Port Forwarding

由於在MacOS上裝了Tomcat,而Tomcat的Default Port為8080,若想將80Port的Request轉到8080 Port,則可使用以下Command。

  • Forwaring Port 80 to 8080
    #echo "rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080" | sudo pfctl -ef -

  • Remove Port Forwarding
    #sudo pfctl -F all -f /etc/pf.conf

  • Show Rule
    #sudo pfctl -s nat

Reference:
[1] Mac pfctl Port Forwarding

沒有留言:

張貼留言