MAC Port Forwarding

Source: Internet
Author: User
Tags lua pow

From:

http://my.oschina.net/91jason/blog/546711

If you don't see the content, click Edit view (author only, follow-up and change)

Summary

Mac OS 10.10 above the open port forwarding-solve Mac default does not turn on 1024 the following port permissions issues

Mac OS 10.10 above the open port forwarding-to solve the MAC default does not turn on 102 port permissions issues

I 10.10.2 mac Os,tomcat want to start on the 80 port, the online search n more data is not working, only this scheme is feasible:

The older version of OS X uses IPFW to set up port forwarding, but the new version, especially in my OSX Yosemite (10.10.3), has not been able to use IPFW, but instead has been replaced by PF.

PF Configuration Port forwarding articles on the internet there are a lot of, but the use of not solve the problem, but let me confused anger, the following gives the most correct configuration:

首先在 /etc/pf.anchors/ 新建一个 com.pow 文件内容如下:
RdrPassOnLo0inetProtoTcpFromAnyToAnyPort 80127.0.0.1Port 8080
RdrPassOnLo0inetProtoTCP from all to any Port 127. 0. 0. 1 port 8080

where Lo0 for your ifconfig when the name of the network card queried 80 is the Tomcat port, 8080 is the port you want to forward

Note: Be sure to add a newline at the end of the paragraph, or you will be syntax error.

Then use the PFCTL command to detect the configuration file

sudo pfctl -vnf /etc/pf.anchors/com.pow

Adding to the master configuration file

The/etc/pf.conf file is automatically loaded when PF starts, so the anchor file is linked to /etc/pf.confand the forwarding rules are automatically established.

Under Rdr-anchor "com.apple/*" add:

rdr-anchor "pow"

In: Load Anchor "Com.apple" from "/etc/pf.anchors/com.apple" after adding:

load anchor "pow" from "/etc/pf.anchors/com.pow"

The final modified pf.conf file is as follows:

scrub-anchor "com.apple/*"nat-anchor "com.apple/*"rdr-anchor "com.apple/*"rdr-anchor "pow"dummynet-anchor "com.apple/*"anchor "com.apple/*"load anchor "com.apple" from "/etc/pf.anchors/com.apple"load anchor "pow" from "/etc/pf.anchors/com.pow"

Import and Run PF command (critical)

Be sure to note the commands to import and allow PF to run, and one of the following is written in all of the online tutorials:

sudo pfctl -f /etc/pf.conf

The above in OSX Yosemite (10.10) should be no problem, but in my OSX Yosemite (10.10.3) is useless, to replace the following to succeed:

sudo pfctl -evf /etc/pf.anchors/com.pow

Set PF to turn on automatically

sudo pfctl -e

The-e parameter is added, which is the Enable

If you want to close pf, the command is:

sudo pfctl -d

Mac Port forwarding

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.