Yosemite在WiFi上升级到10.10.3后,Rails服务器在网络上不可见
我的机器上运行的rails服务器可用于本地网络,一切正常,我可以使用本地服装192.168.xx:3000从其他设备访问我的服务器,在更新操作系统到10.10.3之后(我以前有优胜美地,但我不记得版本)这不再有效,我的防火墙被禁用,我试图使用“rails server –binding = 0.0.0.0”启动服务器,但它仍然不可见其他网络上的设备。
编辑:我现在看到问题是只有当我使用WIFI如果我通过霹雳和以太网连接一切正常
有谁知道如何解决这个问题?
谢谢!
问题似乎是无线路由器需要重新启动,在我尝试了一切,重新启动mac(服务器运行的那个)和我尝试连接的设备之后,我重新启动了路由器,如果出于某些奇怪的原因它开始起作用了。
也许这个信息会帮助别人
再次工作!
MacOS Yosemite完全删除了ipfw (IP-Firewall) ,现在只使用pf (数据包filter) 。 所以所有的默认转发,我们已经习惯了!
为了让它再次运行,我使用了这个很棒的教程:来自Sal Ferrarello的 Mac pfctl Port Forwarding并将其更改为支持常用的rails服务器。 把它放在终端,然后再次运行!
成功的过程(终端命令)
激活rails端口转发 (如果需要,添加更多)
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 -
显示当前转发规则 (检查哪些规则处于活动状态)
sudo pfctl -s nat
停止端口转发 (CAREFULL!再次停止!)
sudo pfctl -F all -f /etc/pf.conf
.. 我仍然想念SnowLeopard,这个天,一个开发人员的生活如此轻松 ..
更新:
这只适用于下次重启。 我尝试了很多让它自动运行,我改变了/etc/pf.conf ,我改变了pf守护进程..但没有任何作用!
所以我制作了自己的守护进程,它只是在启动时加载我的开发端口,效果很好!
/Library/LaunchDaemons/dev.development.servers.plist
Label dev.development.servers ProgramArguments /bin/sh -c 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 - RunAtLoad UserName root