echo "
rdr pass inet proto tcp from any to any port 3000 -> 127.0.0.1 port 3000
rdr pass inet proto tcp from any to any port 3001 -> 127.0.0.1 port 3001
rdr pass inet proto tcp from any to any port 3002 -> 127.0.0.1 port 3002
rdr pass inet proto tcp from any to any port 3003 -> 127.0.0.1 port 3003
rdr pass inet proto tcp from any to any port 3004 -> 127.0.0.1 port 3004
rdr pass inet proto tcp from any to any port 3005 -> 127.0.0.1 port 3005
rdr pass inet proto tcp from any to any port 3006 -> 127.0.0.1 port 3006
rdr pass inet proto tcp from any to any port 3007 -> 127.0.0.1 port 3007
rdr pass inet proto tcp from any to any port 3008 -> 127.0.0.1 port 3008
rdr pass inet proto tcp from any to any port 3009 -> 127.0.0.1 port 3009
rdr pass inet proto tcp from any to any port 3010 -> 127.0.0.1 port 3010
rdr pass inet proto tcp from any to any port 4242 -> 127.0.0.1 port 4242
rdr pass inet proto tcp from any to any port 9292 -> 127.0.0.1 port 9292
" | sudo pfctl -ef -
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>dev.development.servers</string>
<key>ProgramArguments</key>
<array>
<string>/bin/sh</string>
<string>-c</string>
<string>
echo "
rdr pass inet proto tcp from any to any port 3000 -> 127.0.0.1 port 3000
rdr pass inet proto tcp from any to any port 3001 -> 127.0.0.1 port 3001
rdr pass inet proto tcp from any to any port 3002 -> 127.0.0.1 port 3002
rdr pass inet proto tcp from any to any port 3003 -> 127.0.0.1 port 3003
rdr pass inet proto tcp from any to any port 3004 -> 127.0.0.1 port 3004
rdr pass inet proto tcp from any to any port 3005 -> 127.0.0.1 port 3005
rdr pass inet proto tcp from any to any port 3006 -> 127.0.0.1 port 3006
rdr pass inet proto tcp from any to any port 3007 -> 127.0.0.1 port 3007
rdr pass inet proto tcp from any to any port 3008 -> 127.0.0.1 port 3008
rdr pass inet proto tcp from any to any port 3009 -> 127.0.0.1 port 3009
rdr pass inet proto tcp from any to any port 3010 -> 127.0.0.1 port 3010
rdr pass inet proto tcp from any to any port 4242 -> 127.0.0.1 port 4242
rdr pass inet proto tcp from any to any port 9292 -> 127.0.0.1 port 9292
" | sudo pfctl -ef -
</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>root</string>
</dict>
</plist>
2 回答
问题似乎是无线路由器需要重新启动,在我尝试了一切,重新启动mac(服务器运行的那个)和我尝试连接的设备之后,我重新启动了路由器,如果出于某些奇怪的原因它开始起作用了 .
也许这个信息会帮助别人
再次工作!
MacOS Yosemite完全删除了ipfw(IP-Firewall),现在只使用pf(数据包过滤器) . 所以所有的默认转发,我们已经习惯了!
为了让它再次运行,我使用了这个很棒的教程:来自Sal Ferrarello的Mac pfctl Port Forwarding并将其更改为支持常用的rails服务器 . 把它放在终端,然后再次运行!
处理成功(终端命令)
activate rails port forwarding (如果需要,可添加更多)
show current forwarding rules (检查哪些规则有效)
stop port forwarding (小心!再次停止!)
..我仍然想念SnowLeopard,这个天,一个开发人员的生活如此轻松..
更新:
这只适用于下次重启 . 我尝试了很多让它自动运行,我改变了/etc/pf.conf,我改变了pf守护进程..但没有任何作用!
所以我制作了自己的守护进程,它只是在启动时加载我的开发端口,效果很好!
/Library/LaunchDaemons/dev.development.servers.plist