Naster
Naster

Reputation: 724

How to access a lamp server in lan using public ip

I have a LAMP server. It works great if I access using the private ip e.g. 192.168... I also did port forwarding to access to it using its public ip and it works great if I'm not in the same LAN as the server, so if I use mobile data, I can access to it, but if I'm with my laptop which is connected to the same router, I can't.

How can I access to a lamp server using the public ip and being in the same LAN? I've read about creating a DNS server but I think that's too complex for this and there must be an easier answer.

Thank you!

Upvotes: 0

Views: 564

Answers (1)

Srinu Babu Ruppa
Srinu Babu Ruppa

Reputation: 15

What you need is NAT hair-pinning on the router. Presently Cisco routers support it.

You may also create a DNS host-entry on your PC which points the public IP(or DNS name) to local IP.

If two hosts (called X1 and X2) are behind the same NAT and exchanging traffic, the NAT may allocate an address on the outside of the NAT for X2, called X2':x2'. If X1 sends traffic to X2':x2', it goes to the NAT, which must relay the traffic from X1 to X2. This is referred to as hairpinning. Source

Upvotes: 1

Related Questions