Network of VirtualBox'es

48 views Asked by At

I've installed VirtualBox on Debian Stretch together with two virtual machines: another Debian Stretch and a Win 10.

I installed a servlet server on the Win 10 VM (Jenkins/Jetty) that listens on port 8080. Locally, in Windows it works fine with http://localhost:8080. But how to reach it from outside?

Retrieving the locally known ip, I get 10.0.2.15 on both, the Debian VM (using ifconfig) and the Win 10 VM (using ipconfig).

Would it be possible - and if, how? - to reach the servlet server on the Win 10 VM from the Debian VM and/or the Debian host?

2

There are 2 answers

2
GabrieleMartini On

Yes, it is possible.

The virtual machines cannot talk to the world outside the host

You have to set network configuration on "host-only" for each virtual machine. In this way, the guests and the host are on the same network.

For each guest: power off the virtual machine. Open settings -> network configuration -> select "host-only". Configure ip and dhcp server so the guests are on the same network.

The virtual machines can talk to the world outside the host

You have to set network configuration on "bridged adapter" for each virtual machine. In this way, the guests and the host are on the same network.

For each guest: power off the virtual machine. Open settings -> network configuration -> select "bridged adapter". Configure ip and dhcp server so the guests are on the same network.

0
ngong On

I switched to using "Bridge" mode with guests networking instead of "host-only". It does exactly what I want: The DHCP server in the external router supplies IP addresses for all machines, the host and all the guests configured to "Bridge".

The host and all the guests can reach each other, including the servlet server (Jenkins) on the Win10 guest from the Firefox in the Debian guest.