How to access one VM from another VM?

5,027

Got it working. :)

Look @ following.

$ netstat -an | grep LISTEN | grep 9990

tcp 0 0 127.0.0.1:9990 0.0.0.0:* LISTEN

Meaning, my web service on VM2 was not bound to 192.168.181.174, but to default - 127.0.0.1 (localhost). I have done appropriate changes in web server's configuration file. After restarting the web server, thins are working as per expectation. :)

Share:
5,027
MiKu
Author by

MiKu

Updated on September 18, 2022

Comments

  • MiKu
    MiKu almost 2 years

    I have two VMs running on my machine, using VmWare Player (Linux). The network configuration used is NAT for each VM. Here is the link to vmware player's network configuration i have used.

    VM1: 192.168.181.175

    VM2: 192.168.181.174

    Host Machine - vmnet8 : 192.168.181.1

    There is one http service running on VM2 at port 9990.

    Now, the following works...

    VM2 -> Browser -> http://localhost:9990/some-path <- trying to access VM2's http service from VM2 itself, using "localhost"

    But, the below does not work.

    VM1 -> Browser -> http://192.168.181.174:9990/some-path <- trying to access VM2's http service from VM1

    VM2 -> Browser -> http://192.168.181.174:9990/some-path <- trying to access VM2's http service from VM2 itself, using IP address

    Similarly, here is what telnet complains, from both VM1 and VM2

    telnet 192.168.181.174 9990 Trying 192.168.181.174... telnet: Unable to connect to remote host: Connection refused

    And here is what the host machine's telnet complains,

    telnet 192.168.181.174 9990 Trying 192.168.181.174... telnet: Unable to connect to remote host: No route to host

    The firewall is inactive on all - the host machine, VM1 and VM2.

    Also, the ping from VM1 -> VM2, VM2 -> VM1, and Host-Machine -> VM1 or VM2 works fine.

    I want VM1 to be able to access http service which is hosted on VM2. Can someone suggest how to get it through?

    Note: I am primarily a software programmer/dev. I am not aware of nitty-gritty configurations of the firewalls etc. So in advance apologies, if the details provided are insufficient. ;)

  • Arman Ortega
    Arman Ortega about 5 years
    Hi.. i also encountered this problem, how did you manage to solve it ? How did you bound the IP 192.168.181.174? Thanks