Not able to access local server running after VPN connection
Asked Answered
A

5

22

I have local application server running and I can access it using http://localhost:4554.

If I connect to VPN not able to load above url. I am using dongle to connect to internet.

Please help!

Assimilate answered 19/8, 2015 at 19:18 Comment(4)
Have you tried to telnet to port 4554? Checked that the firewall is not blocking and that the process is listening on either 0.0.0.0 or 127.0.0.1?Kimberlykimberlyn
I am able to telnet localhost 4554, getting message - Trying 127.0.0.1... Connected to localhost.Assimilate
Then your application is correct but your completely missing the consept of ("localhost" and 127.0.0.1)[tools.ietf.org/html/rfc6761] as set out in the rfc. localhost means loop x connection back upon itself. Thus, at remotehost1> telnet localhost is the same as telnet remotehost1 while remotehost2> telnet localhost is the same as telnet remotehost 2 but not the same as telnet remotehost1.Kimberlykimberlyn
The only other thing I can suggest outside of reading the RFC's for basic tcp networking is to check that your vpn routes are correct and assuming your connecting through the vpn your initiating localhost on the correct server or typing in the remote server's IP addres with the application bound to 0.0.0.0 not 127.0.0.1.Kimberlykimberlyn
D
9

Using 127.0.0.1 instead of localhost as my host in the mysql connection settings solved the issue for me. I am on Avaya VPN

Descartes answered 13/7, 2017 at 9:12 Comment(5)
You're GOD! Thanks a lot. :-)Sufflate
Glad it helped youDescartes
How do you achieve this? I'm using Mamp Pro but I can't find any mysql connection settings withinPrestige
I tried didn't worked for me. :-(Mustachio
This isn't a solution. I use Cyberghost VPN and Local sites load extremely slow ~ 30secs. Issue with all these VPN providers, is that they don't allow port forwarding on their servers for security reasons . (Got this answer from Cyberghost Support)Casta
D
5

To connect to localhost you must be connected to the same network as the device that is hosting the files. When you connect to a VPN however this is not the case. When you connect to a VPN it is similar to being on a completely different network as your external ip address will change therefore the local files cannot be reached. To access localhost in this case what you have to do is

  1. Ensure that VPN is off
  2. Set up port forwarding and then find out your external ip address.
  3. Test it by using the external ip address instead of localhost. At this point you should be connected to the your local server.
  4. Enable VPN and enter your previous external ip address because remember that your external ip address will change once VPN is enabled
Danialdaniala answered 8/4, 2016 at 3:58 Comment(2)
localhost means on the same computer not the same network.Retractile
Yes I know. Other devices on the same network may connect to the device hosting the server (referred to as localhost from its point of view) using its private IP address. If the connecting device is on another network it will have to connect using the public IP address of the server, which has been changed as a result of using the VPN.Danialdaniala
T
2

One problem might cause this kind of behavior. If you are connected to a corporate network by VPN, the VPN connection will change the search domain, for example, mycompany.corp.

On the other hand, some systems in the corporate network might register themselves as 'localhost.mycompany.corp' ( this should be a mistake ).

The result is localhost.mycompany.corp will now be resolved to a private IP like 10.xx.xx.xx, and when you tried to access http://localhost:4554/ , the request is sent to 10.xx.xx.xx port 4554, instead of the supposed 127.0.0.1 port 4544.

Tacmahack answered 2/9, 2019 at 11:30 Comment(0)
M
0

None of the mentioned answers worked for me. What worked for me is performing port forwarding[Windows 10].

  1. Open CMD with administrator privilege. Fire command ipconfig.
  2. Depending upon whether you're using LAN/Wifi, copy the IP address.
  3. In mentioned command modify the IP address and port to which you want to connect netsh interface portproxy add v4tov4 listenaddress=127.0.0.1 listenport=9000 connectaddress=192.168.0.10 connectport=9000
  4. To verify you can use, netcut nc -zv 192.168.0.10 9000 in output you will get 9000 port open
  5. To remove the rule return back to CMD and fire netsh interface portproxy delete v4tov4 listenaddress=127.0.0.1 listenport=9000

Reference: Original_Post

Mustachio answered 21/3, 2022 at 6:38 Comment(0)
S
0

Check if your VPN has a feature to whitelist some IPs. I'd say you can mess up with IP tables and such, but most modern VPNs provide an option to whitelist IPS or ranges (subnets).

Each VPN may be different and you don't mention which one you are using, still check if the feature exists for you, and add your local net to the whitelist. You should be good to go then.

Seals answered 13/4, 2023 at 17:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.