How to setup communication between virtual machines

1

Probably my issue is not hard to resolve but I got a stuck.

I have several LXC containers. One of them has MySQL, RabbitMQ, MongoDB (and several other services) installed and configured. Every other container has running on the board a service which requires MySQL, RabbitMQ, MongoDB and others. Beside that every container communicates (HTTP, sockets) between each other.

The problem is that IPs of these containers changes. And when this happens I need to change config files on each container. IPs changes because they gets IPs from DHCP server which changes when I move my laptop from one place to another. And this is not the only reason why IPs could be changed. Also I need some IPs to be public, so I will be able to connect from other PC to some container within the same LAN.

One solution which comes to mind is to bring up and configure dnsmasq (or other local DHCP server) on the host machine, but I'm not sure that that will resolve the issue. And also quite important note: I would like to avoid additional configuration of the host machine.

Is there any other way to setup communication between virtual machines? How would you resolve such a task?

Edited: Static IPs for sorry are not suitable for my needs because sometimes I want to bring up the set of containers on the different PCs but within the same LAN.

Andriy Tykhonov

Posted 2014-06-17T15:31:22.467

Reputation: 117

How does moving your laptop change the IPs? – Lincoln Bergeson – 2014-06-17T15:36:03.613

Please note: not only that... But that just for example. In the different location it communicates with another DHCP server which returns other IPs. – Andriy Tykhonov – 2014-06-17T15:38:24.407

OK. Have you tried setting up static IPs? – Lincoln Bergeson – 2014-06-17T15:38:49.930

Static IPs for sorry are not suitable for my needs because sometimes I want to bring up the set of containers on the different PCs but within the same LAN. – Andriy Tykhonov – 2014-06-17T15:41:12.573

1I recommend editing your question to say that. – Lincoln Bergeson – 2014-06-17T15:43:32.423

No answers