0

Working in VMWare vCloud.

Webserver has internal ip 172.16.0.61, public ip 148.25.6.22 (invented numbers); App Server has internal ip 172.16.0.52

From App Server I can ping and surf Webserver using its internal 172.16.0.61, but... how can I reach it (from App Server) using its public 148.25.6.22?

Just searching for something that let me say to the App Server 148.25.6.22 => 172.16.0.61

If I had a domain name I could resolv it in /etc/hosts, but at the moment I have just ip. Thanks in advance

1 Answers1

0

If I understand you correctly, your servers are behind a NAT, which masquerades their IP addresses (which is why your webserver has both an internal and an external IP address - the external one is actually the NAT's public address).

You can define a local route on your appserver, which will direct packets sent to 148.25.6.22 to 172.16.0.61, however that defeats the purpose, as that would cause the appserver to just send everything to the internal address.

What you should do is configure port forwarding on your NAT - this means that the NAT will listen on a port you specify, and all communication which reaches this port will be forwarded to the webserver's internal IP to another port you specify, for example: 148.25.6.22:8080 => 172.16.0.61:8080. Now, if your appserver connects to 148.25.6.22:8080, the packets will reach the webserver at port 8080.

SivanBH
  • 392
  • 3
  • 13
  • Unfortunately I have no access to port forwarding because it is managed strictly by the provider. I solved setting static route in the app server with iptables. – Daniele Cuder Jul 28 '15 at 08:42
  • Glad to hear the problem is solved. The solution you chose is the one I mentioned in the second paragraph, so do note that even though the packets reach the destination, they are, in fact, sent to the private interface (172.16.0.61), so if there is a significance to reaching the public interface (148.25.6.22) you might still have a problem. – SivanBH Jul 28 '15 at 08:46