Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm an Android developer and often my applications require server-side code. I typically use Ruby on Rails for the web app, and during development will run the server on my local machine (Mac OS X) with WEBrick. In the morning when I get to the office, I'll run ifconfig in the console to see what IP my laptop has been given that day. I'll use that IP in my Android app when making requests to the web app in question.

This all works fine, when I'm in my office.

When I get home, I attempt to do the same thing, find my laptop's IP via ifconfig, set it in my app's config file, but the destination can never be found. To exclude my app from the set of hurdles, I attempt to visit the web server IP (e.g., http://192.168.1.4:3000) from my phone's browser, and it cannot connect. If I try from my laptop, which is running the web server, it works fine. If I try from another machine, on the same network, it also is unable to connect.

Given this, I think I've narrowed it down to some kind of configuration in my home network, but I frankly have no idea what the cause could be. I don't have anything special at home, your basic Verizon FiOS router/modem with everything connected via Wi-Fi (Wi-Fi for both phone and laptop at work as well, fyi). I've tried disabling the firewall on my Verizon router, enabling port forwarding, and just about everything else I could do for port 3000, and nothing has changed.

Dear Server Fault geniuses, please help a poor developer out. :)

Edit:

Some follow up items to add. My Mac's firewall is not active, and all incoming requests are allowed. I've also verified on my phone and laptop, that they're on the same network (192.168.1.4 Mac, 192.168.1.9 Phone). I have no idea why this isn't working.

Edit 2:

I went into System Preferences, enabled Web Sharing, and tried to view the website from my phone and it didn't connect. So it's not WEBrick or related to Rails. The firewall on my machine is off and the firewall on my router is off.

Edit 3:

Some progress. I set up port forwarding for port 3000 to my laptop, found the external IP, and used that and it connected fine. So, there's definitely something not quite set up correctly on my internal network.

share|improve this question

migrated from serverfault.com Dec 10 '11 at 21:50

This question came from our site for professional system and network administrators.

    
Did you check if there is any incoming attempt on that IP:port at TCP level? My first guess is that incoming requests are blocked. From the same machine it is not blocked naturally. Try to look for firewalling options in your router. –  karatedog Dec 10 '11 at 22:29
    
I looked around in the router options and never found an access log, just general configuration logs. I disabled the firewall completely and still couldn't get a connection. –  Chris Stewart Dec 13 '11 at 21:30
    
Not in your router :-) in your computer's firewall's log (I'm not sure if it is iptables on Mac or what). You can even use tcpdump to listen on that specific :3000 port to see if anything is happening. –  karatedog Dec 14 '11 at 10:02
    
It works when I'm in my office, so I can't imagine incoming requests on blocked on my machine. –  Chris Stewart Dec 15 '11 at 18:33
    
You could always try to reset the settings on your router and reconfigure them. –  kobaltz Dec 17 '11 at 3:15
add comment

3 Answers

Have you tried running WEBrick like this rails s -p 80 to force port 80. If you have a problem with your router, trying a different port could help.

I would suggest plugging your computer in directly and access it from a computer plugged in directly. Your router may be one of those funny ones that have two networks; main wireless network and guest wireless network. Even though all of your devices are connected to the same physical router, you are on different networks that are separated from each other. I would check your wireless settings on the laptop and make sure that this is not the case.

share|improve this answer
    
I did try forcing port 80 with no difference, will look into the possibility of different networks. –  Chris Stewart Dec 16 '11 at 1:53
    
Can you check what IP and Gateway your Android device gets when it connects to the router? Your router should be able to list the connected devices along with at least the IP address. –  karatedog Dec 16 '11 at 10:09
    
I've added the IP of both my laptop and phone to the original post. I can't find the gateway information anywhere. –  Chris Stewart Dec 17 '11 at 1:59
add comment

Some routers have an option to disable communication between wireless clients. Check through the wireless settings for your router and see if such an option is enabled. It might be called "Isolation" mode, or similar. If you can provide an actual manufacturer/model # for the router, it might be possible to hunt through the documentation and help see if such an option is available on the router.

If your phone and your laptop both have 192.168.1.4 as their IP address (as you described), then they are not on the same network (or seriously misconfigured and cannot access the internet).

share|improve this answer
    
Thanks, I'll take a look. I fixed my original question, the phone is .9 and the laptop is .4. –  Chris Stewart Dec 19 '11 at 21:27
add comment

I know that on some Windows 7 machines, you have different networks (Public, Home, Work). You may have your machine connected as Public at home which could cause it to not display the site. However at your office, the connection is set to Work or Home which opened up the Webrick. I would try disabling your connection to your home and forgetting that connection. Try to establish a new one and set it to Home.

Under Network, click on either the Home network, Work network, or Public network link depending on what you currently have selected as your network location. (see screenshot below) enter image description here enter image description here enter image description here

share|improve this answer
    
My laptop is a Mac, so it doesn't have that distinction. –  Chris Stewart Dec 22 '11 at 0:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.