2

I have 2 computers and both are connected to same network via WAN. Now i have started 1 application on 8080 port and also i have open 8080 port on my router.

Now my 1 computer's ip - 192.168.0.150(on which i am running application using 8080 port) and 2nd computer's ip -192.168.0.151.

Now i can access my 1st computer application via my 2nd computer - i have simply enter 192.168.0.150:8080 in browser and i am able to access application through my 2nd pc.

Now have static ip - 104.435.xx.xx . So i can also access my application with this static ip from anywhere(not on my network. have to connect different network/net)

Now the problem is - When i type 104.435.xx.xx:8080 from my 2nd pc then it shows message unable to connect . The connection has timed out .

Now i want to access 1st computer application on same network with my static ip.

So how can i access my 1st pc application with my static ip through my 2nd pc on same network ??

1
  • You are going to have to provide much more information. A network diagram would be great, and we need to know the network device models and configurations.
    – Ron Maupin
    Mar 15 '17 at 15:05
2

Your problem is that the port forwarding you configured works only for connection coming from outside.

The router that connect you to the Internet has two interfaces and two IP addresses: one on the LAN and the second that connect to the Internet.

The port forwarding rule must match all criteria :

  • destination = 104.435.xx.xx
  • protocol = TCP
  • port = 8080
  • interface = WAN interface

When you connect from the LAN , the last criteria is not met and so the port forwarding doesn't apply

Some routers, but not all, allow to configure a rule that will work on connection coming through the LAN interface. This is know as "NAT hairpin" or "NAT loopback".

Edit

If your router support NAT hairpin, this is the easiest way to go.

Usually the need for such feature is that you want to connect from both inside and outside with the same DNS name. In this case, split DNS is sometime used.

Split DNS is when you have, for the same domain name an internal DNS server that resolve the names with the internal (private) IP while the public DNS server resolve the same name with the public IP.

So when accessible server.example.com from the LAN, the internal DNS server will respond with 192.168.0.151 and you can connect to the server without going through the router.

When accessing server.example.com from the Internet, the public DNS server will respond with 104.435.xx.xx

Some DNS servers allow to have a single DNS to answer with a different response based on (for example) the asker IP address, in which case you can configure such a split DNS scheme on a single server.

2
  • Thanks for great explanation. So,is there any other way to perform this ? or need to use that NAT loopback ?
    – deepak
    Mar 16 '17 at 4:22
  • @deepak See my edit.
    – JFL
    Mar 16 '17 at 8:26
0

NAT reflection or (if you are willing to use DNS) a split DNS configuration would solve your problem.

Right now, your internal 2nd PC is trying an external IP to use a resource but the request will go out of your network (per routing) and go back in the same path which is rejected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.