Can't access localhost from computer running on same network
I'm working on two computers on the same network. Computer A has an app working on localhost:4444. However, I can't access it from the browser of Computer B.
Here is my situation:
- I pinged it's IP and I'm getting successful responses.
- I've tried accessing through the browser: http://192.168.X.X:4444
- I'm currently sharing files across both computers via the same network successfully.
Can anyone please help me make this work?
Solution 1:
I know this is an older question, but @PimpJuiceIT answer worked for me in a very similar situation, so full credit to @PimpJuiceIT
Open an elevated command prompt (press windows, type "cmd", right click on "Command prompt" and run as administrator)
Type in the following code, but replace the "4444" with the port you need to access
netsh advfirewall firewall add rule name="TCP Port 4444" dir=in localport=4444 protocol=TCP action=allow
press enter, you should get a confirmation text.
Test to ensure you can now access the app through network.
Solution 2:
Open a Command Prompt window and execute the following command to confirm whether or not your web application is listening on all IP addresses:
netstat -a -o
You'll see output similar to the following:
Active Connections Proto Local Address Foreign Address State PID TCP 0.0.0.0:135 JHUEBEL-VM:0 LISTENING 944 TCP 192.168.0.173:5040 JHUEBEL-VM:0 LISTENING 5096
I've trimmed the output above down to a couple of examples.
Note how the first line has the IP address "0.0.0.0". This indicates that the service using port 135 (":135") is listening on all IP addresses. That would include localhost (127.0.0.1), as well as the LAN IP address (192.168.0.173).
But if you look at the second line, the service using port 5040 is only listening to the LAN IP address (192.168.0.173). So, I wouldn't be able to access that service via localhost.
So, what you're looking for is a line that starts something like this:
TCP 127.0.0.1:4444
If you see "127.0.0.1" (or really any IP address starting with "127."), then the web application you're trying to access is only listening to localhost and is not accessible by computers on your LAN.
So, how do you fix this? That really depends on the application. It will probably require editing a config file. Without knowing the application you're using I really can't help there. Please update the OP with more information about the application and I'll try to help further.