Access localhost from another computer not on network
Asked Answered
M

2

6

Before you say that it is a dupe, this is not the same as this, this, this or this.

My question is how do you do it globally.

For instance, consider this. I have EasyPHP running in my computer. At present my ip address (global) is 223.231.178.118

Now, let's say there is someone else (maybe in a different country altogether) who wants to access my ip (223.231.178.118). I do know how to access 192.168.x.x from the same network. I just want to know how you can do this globally, if possible.

P.S 1 : The computer running EasyPHP is behind a router.

P.S 2 : My IP (local IP is, but global one is not) is not static. But let us assume the person who wants to access my localhost does know my Dynamic IP. For example, let us assume I tell the person who wants to access my localhost is my friend and I tell him over phone what my IP is.

Marlite answered 15/5, 2012 at 10:36 Comment(0)
A
1

Your local IP address "192.168.x.x" is only known to your router and unknown to everyone outside your LAN. The global IP address (223.231.178.118 in your example) is the global address of your router.

To be able to access the EasyPHP server on your local computer you need to forward the corresponding port (for http webservers the default is 80 but it might be different for EasyPHP) from your router to your local IP. You need to check your routers manual on how to do this.

After you have done that you can just tell the person who wants to access your local computer the global ip address of your router and he will see your EasyPHP response by browsing to that global address.

Antiquary answered 15/5, 2012 at 10:48 Comment(8)
What is the default for EasyPHP by the way ? Also, how of they do that : by typing google.com, I get directed to 74.125.228.99. How ?Marlite
Also, do I need to register my IP with my ISP (for dynamic ip itself, which my friend knows my ip address)Marlite
Regarding port: Short google search reported port 80 as the default for EasyPHP. Regarding domains: Every domain in the internet is mapped to an IP that handles the requests for that URL (That is where the http server sits in simple cases). The IP mapping is resolved via DNS-servers (Domain Name System).Antiquary
Regarding IP and ISP: Yes, every time your router reconnects you might get a new dynamic IP so the one you gave away might be no longer correct. Check if your router supports Dynamic DNS. You can register such a DNS on certain sites. Just google for it. Add the registered account in your router and it will update the dynamic DNS you reserved with the new global IP of your router if it changes.Antiquary
but all that is not necessary if my friend knows my global IP and I have fowarded port 80 and have EasyPHP running right ?Marlite
Huh ? I have port 443 open (forwarded to 192.168.0.100, my computer local IP), and am running EasyPHP a, configured httpd.conf to listen to port 443, still when I try 117.202.90.211:443 (my new IP) in firefox, I am getting "Unable to Connect Error". Please help where I am wrong.Marlite
Yep, all that is unnecessary if your friend has your router's global IP. Port 443 is usually used for SSL connections. Maybe EasyPHP fails to interpret the request if it comes from :443 and if it's only listening on that port. Better to try it on default port 80. Port 443 might also be blocked by a firewall on your local computer.Antiquary
let us continue this discussion in chatMarlite
S
5

There are some good free services that let access localhost from another computer not on network.

https://pinggy.io
http://localtunnel.me/
https://ngrok.com/
https://forwardhq.com/

Here is a comprehensive list of all such services and open source alternatives: https://github.com/anderspitman/awesome-tunneling

Schism answered 15/4, 2016 at 7:40 Comment(1)
Those doesn't work if you want to use webRTC and janus-gateway. ;/Llama
A
1

Your local IP address "192.168.x.x" is only known to your router and unknown to everyone outside your LAN. The global IP address (223.231.178.118 in your example) is the global address of your router.

To be able to access the EasyPHP server on your local computer you need to forward the corresponding port (for http webservers the default is 80 but it might be different for EasyPHP) from your router to your local IP. You need to check your routers manual on how to do this.

After you have done that you can just tell the person who wants to access your local computer the global ip address of your router and he will see your EasyPHP response by browsing to that global address.

Antiquary answered 15/5, 2012 at 10:48 Comment(8)
What is the default for EasyPHP by the way ? Also, how of they do that : by typing google.com, I get directed to 74.125.228.99. How ?Marlite
Also, do I need to register my IP with my ISP (for dynamic ip itself, which my friend knows my ip address)Marlite
Regarding port: Short google search reported port 80 as the default for EasyPHP. Regarding domains: Every domain in the internet is mapped to an IP that handles the requests for that URL (That is where the http server sits in simple cases). The IP mapping is resolved via DNS-servers (Domain Name System).Antiquary
Regarding IP and ISP: Yes, every time your router reconnects you might get a new dynamic IP so the one you gave away might be no longer correct. Check if your router supports Dynamic DNS. You can register such a DNS on certain sites. Just google for it. Add the registered account in your router and it will update the dynamic DNS you reserved with the new global IP of your router if it changes.Antiquary
but all that is not necessary if my friend knows my global IP and I have fowarded port 80 and have EasyPHP running right ?Marlite
Huh ? I have port 443 open (forwarded to 192.168.0.100, my computer local IP), and am running EasyPHP a, configured httpd.conf to listen to port 443, still when I try 117.202.90.211:443 (my new IP) in firefox, I am getting "Unable to Connect Error". Please help where I am wrong.Marlite
Yep, all that is unnecessary if your friend has your router's global IP. Port 443 is usually used for SSL connections. Maybe EasyPHP fails to interpret the request if it comes from :443 and if it's only listening on that port. Better to try it on default port 80. Port 443 might also be blocked by a firewall on your local computer.Antiquary
let us continue this discussion in chatMarlite

© 2022 - 2024 — McMap. All rights reserved.