问题
I have a rails server running on my machine that was available to the local network, everything worked fine and i could access my server from other devices using the local dress 192.168.x.x:3000, after the updating the os to 10.10.3 (i had Yosemite before but i can't remember the version) this no longer works, my firewall is disabled and i've tried to start the server using "rails server --binding=0.0.0.0" but it is still not visible for other devices on the network.
EDIT: i now see that the problem is only when i'm using the WIFI if i connect via a thunderbolt and ethernet everything works fine
Does anyone know how to solve this problem ?
Thank you!
回答1:
The problem seemed to be that the wireless router needed a restart, after I tried everything, restarting the mac (the one on which the server runs) and the devices from which i try to connect to, i restarted the router if for some strange reason it started to work.
Maybe this info it will help others
回答2:
Works Again!
MacOS Yosemite completly removed ipfw (IP-Firewall) and now only uses pf (Packet Filter). So all the default forwarding, we are used to is gone!
To make it work again, I used this great tutorial: Mac pfctl Port Forwarding from Sal Ferrarello and changed it to support usual rails servers. Put it in the terminal and .. it Works again!
Process to Success (Terminal commands)
activate rails port forwarding (add more if needed)
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 -
show current forwarding rules (check which rules are active)
sudo pfctl -s nat
stop port forwarding (CAREFULL! stops it again!)
sudo pfctl -F all -f /etc/pf.conf
.. I still miss SnowLeopard, live of a dev guy was so easy this days ..
UPDATE:
this only works until next restart. I tried a lot to get it work automatically, I changed /etc/pf.conf, I changed the pf daemon .. but nothing works!
So I made my own Daemon which just loads my dev ports on startup, which works great!
/Library/LaunchDaemons/dev.development.servers.plist
<?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>
来源:https://stackoverflow.com/questions/29621393/rails-server-not-visible-on-network-after-yosemite-upgrade-to-10-10-3-on-wifi