Question

Everytime I host a server I can only connect through localhost(127.0.0.1) and not my IP.

My ISP is rogers. Ok, let's say my IP is 12.34.56.789.

Now, when I try to host a XAMPP Server, I port forwarded 80, anyone can connect to my website through 12.34.56.789 but me. I can only connect through localhost(127.0.0.1) or my internal Ip (192.168.2.1x). When i try to connect with 12.34.56.789 it shows me my internet service page (the site, usually 192.168.x.xx, where you do the portwarding).

Another example, when I host a Minecraft Server, I portforward 25565, everyone connects through 12.34.56.789:25565 but if I go onto my client i cannot connect to 12.34.56.789:25565, only localhost:25565.

Is there something I need to configure or change in order for me to use my external IP to connect to myself because for something like wordpress you cant have the same site on localhost and 12.34.56.789 and if I do it's either only I can view it properly or everyone but me can view it properly.

Was it helpful?

Solution

You use NAT to forward from your external IP to your internal IP - this runs into problems, when NOT accessed from the outside. Consider this packet flow:

  • You (192.168.2.1x) -> 12.34.56.789
  • NAT changes this to 192.168.2.1x -> 192.168.2.1x
  • Requested service doesn't know about the 12.34.56.789 intermediate
  • So requested service answers 192.168.2.1x -> 192.168.2.1x
  • This is not an expected answer to 192.168.2.1x -> 12.34.56.789
  • So it is silently discarded

Since this is a very common scenario, most SOHO routers simply do not perform the NAT for packets coming from the inside, requesting the default service instead (e.g. the internet service page)

More professional routers will allow this configuration with the unavoidable caveats, as showing the wrong connecting IP address. This is known as "full NAT", consisting of "destination NAT" or SNAT (what is called "port forwarding" in a SOHO router) and "source NAT" (which on a SOHO router is used only from the inside to the outside)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top