在OS X中使用pfctl打开端口El Capitan - 允许来自Internet的传入连接


3

我正在努力使用我的mac mini进行的一种配置。我已将我的机器设置在我的网络的DMZ上,因此对我的公共IP的任何请求都将在此机器上结束。

问题是我无法从互联网上获得任何防火墙已启用的功能,我尝试使用PFCTL进行此配置:

rdr pass on lo0 inet proto tcp from any to any port = 8080 -> 127.0.0.1 port 8080
rdr pass on en0 inet proto tcp from any to 192.168.1.100 port = 8080 -> localhost port 8080
#rdr pass on en0 inet proto tcp to port 8080 -> 127.0.0.1 port 8080

rdr pass on en0 inet proto tcp from any to any port = 5000 -> localhost port 5000

#rdr pass on en0 inet proto tcp from any to any port 8080 -> 127.0.0.1 port 8080

#rdr pass on en0 inet proto tcp from any to 192.168.1.100 port = 8080 -> 127.0.0.1 port 8080
#rdr pass on lo0 inet proto tcp from any to 192.168.1.100 port = 8080 -> 127.0.0.1 port 8080

这适用于本地,

curl http://localhost:8080 
curl http://127.0.0.1:8080

如果未启用防火墙,这也适用:

curl http://mypublicip:8080

但是,如果我只启用防火墙,相同的请求将不再起作用,导致超时。

有人能够解决这个问题吗?请问你能帮帮我吗 ?

谢谢

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.