2

I have:

  • A Linux Mint 18.3 host machine (192.168.1.19)
  • A VirtualBox Windows Server 2012 guest machine with a Joomla installation on IIS8.5+PHP7 (192.168.1.8)
  • A VirtualBox Windows Server 2012 guest machine with a MySql Server 5.7 installation (192.168.1.12)

Both virtual machines have a bridge connection. How communications work:

  • Linux can ping Joomla and MySql virtual machines
  • Both virtual machines can ping Linux
  • The virtual machines cannot ping each other (I don't know why)
  • From Linux I can use a MySql client to connect to the MySql Server inside the Windows virtual machine

What I need:

  • I need that Joomla (installed in the first virtual machine) uses the database installed in the second virtual machine

Any help? :)

Because the two virtual machines cannot communicate directly (why?), I thought that in the Joomla configuration.php I could set 192.168.1.19 as the database host, and in the Linux machine I could forward all MySql connections from 192.168.1.8 to 192.168.1.12, however I don't know how to achieve it, because I've done some trials with iptables but I don't really know how to use it to realize the forwarding.

1

1 Answer 1

1

Solution to make VirtualBox virtual machines communicating each other:

  1. First of all, assign new random MAC addresses to the Network Adapters of the two virtual machines (without doing that, I wasn't able to solve this issue)

  2. In the VirtualBox manager, go to "File", "Preferences", "Network", add a new NAT network (I named it "JoomlaDatabase"), with Network CIDR = 10.0.2.0/24. In the network options of this new created NAT, Disable DHCP (it's not necessary to disable it, but it's useful for the maximum control and avoid random IP addresses assigned to the virtual machines).

  3. In the settings of both virtual machines, open the Network Adapter configuration and attach it to the "NAT Network" named "JoomlaDatabase".

  4. Poweroff the virtual machines.

  5. Restart the virtual machines and in the TCP/IPv4 settings insert these values (the DNS IPs are the OpenDNS ones): IP address = 10.0.2.5 (Joomla) or 10.0.2.6 (MySQL); Subnet mask = 255.255.255.0; Gateway = 10.0.2.1; DNS 1 = 208.67.222.222; DNS 2 = 208.67.220.220.

  6. Poweroff and then restart the virtual machines.

  7. Now both virtual machines can connect to the Internet and can ping each other successfully.

  8. Open the configuration.php of Joomla and change this value: public $host = '10.0.2.6';

That's all: now Joomla can use the database server of the other virtual machine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .