How to access server using public ip when in the network itself? [duplicate]

I’ve asked this question and even searched around but didn’t get a useful answer for me.

Basically what im doing is i have a webserver on internal ip 192.168.0.100 port 80. So if im in the network it would be accessible if i type in 192.168.0.100/myportal/login.php

Ok no prob so far. Now, i would like for internal network users to access it via our public static ip which is 219.92.xx.xxx/myportal/login.php

If im outside of this network, no problem.i can access it. But how do i make it so that if im in the internal network, i can use the public ip?

now it’s not practical because i have to use two different address depending on my network situation.

Why i want this? simple. because i want to buy a domain name and use it with my public ip which im hosting my own webserver. so now i cant access using public ip inside, i wont be able to use my domain later assigned to that ip.

for example, i wont be able to access it via www.vportal.com/myportal/login.php if im inside the network. so to conclude, it’s not practical am i right? i would need to use internal ip when im inside. only can use domain,when im outside.

Now, im certain there is a way around this but i really hope someone can give me some idea or solution because i am NOT a network person. but i do know all the basics.

FYI, my setup is a simple setup which is modem and router.one server is using wired connection. my router is dlink dir615. now what can i do with what i got now?is it possible?

i’ve read about nat loopback but i know it’s not possible for my situation. i really hope somebody can help and explain to me in layman’s way. i really want to learn this.

thanks.

Answer

Mulaz did come up with the right keyword: http://wiki.mikrotik.com/wiki/Hairpin_NAT

The link has diagrams which visualizes the problem and answer more succinctly.

Nat settings conflicts with my port forwarding settings on my router so sometimes a local dns server on a linux server may be required. Your mileage may vary.

Attribution
Source : Link , Question Author : James , Answer Author : paulcube

Leave a Comment