How to communicate two vms

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
youssef
Posts: 10
Joined: 5. Apr 2009, 04:09
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: UBUTU, FEDORA, Window$

How to communicate two vms

Post by youssef »

Hello,

On a mac (host) I have two virtual machine on virtualbox, for a POC, and I need to communicate by networks the two VMs.

The first VM is under windows
The second VM is under Linux CentOS

(Exemple: one vm for the database, and another for the application)

Please, how can I do for the network configurations in order to communicate the two VMs to each other?

thank you
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How to communicate two vms

Post by socratis »

Here are the networking modes available in VirtualBox. Look at the VM1<->VM2 column to be a "Yes".
[pre]+-----------+-------------+-------------+----------------+----------------+
| | VM <-> Host | VM1 <-> VM2 | VM -> Internet | VM <- Internet |
+-----------+-------------+-------------+----------------+----------------+
| HostOnly | Yes | Yes | No | No |
| Internal | No | Yes | No | No |
| Bridged | Yes | Yes | Yes | Yes |
| NAT | No | No | Yes | Port forward |
| NATNet | No | Yes | Yes | Port forward |
+-----------+-------------+-------------+----------------+----------------+[/pre]

More information, ch. 6. Virtual networking. And remember, you can always have more than one network card.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
youssef
Posts: 10
Joined: 5. Apr 2009, 04:09
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: UBUTU, FEDORA, Window$

Re: How to communicate two vms

Post by youssef »

Hello,

Thank you for your answer, it helped me,
I used the bridge mode, it works, but I noticed:
The VMs retrieves an ip address of the return on which the machine host and connected. As I work a lot in a train, (no wifi) or I change several times in the day the networks wifi, the VMs constantly changes IP address.

Is there a method or technique for the VMs to keep the same IP address all the time ?

thank you
BillG
Volunteer
Posts: 5105
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: How to communicate two vms

Post by BillG »

Yes there is. Use a different network for your vm to vm communication. As socratis sais above, you can have more than one NIC in a vm. Use one card set to NAT to give the vms Internet access and a second to communicate with each other.

I would enable a second NIC in each vm, set them to internal and configure these NICs to be in their own IP subnet. Access the database using its internal IP.
Bill
Post Reply