Page 1 of 1

How to configure network for multiple communicating guest ?

Posted: 10. Jun 2022, 10:45
by Sowapps
Hello,

From years, I tried to configure the network of my guests but everytime, i got some trouble with it.
I would like to get multiple VirtualBox VM guests that I can access from my Windows 10 host (a laptop). All VM here are locally hosted.
I need the network of my guest to work from any place my laptop is, so I may have no access to laptop's LAN administration.

Here is my detailed needs:
  1. If laptop has access to internet, all guest should have too.
  2. My host should be able to connect to all guest through network connection from any service.
  3. Any guest should be able to connect to other through SSH at least.
  4. Any guest has access to internet.
  5. Everything work independently of the LAN of the laptop.
  6. Each guest is having an IP address that host and other guest could use to connect to.
  7. Optionally, each guest is able to ping host
  8. Optionally, any other device from the LAN of the laptop could access to guest web access at least.
I tried so much configurations, followed so much tutorials about how to configure network and tried any access mode without success.
I could make it works in one case but each time I try from another place, it's hell.

What should be the perfect configuration for my needs ? Which access mode should I choose for my guests pls ?
Any help is appreciated, pls.

Re: How to configure network for multiple communicating guest ?

Posted: 10. Jun 2022, 14:58
by scottgus1
Please see Virtualbox Networks: In Pictures, so you can know what each form of Virtualbox networking does.

I think Virtualbox "NAT Network" (not plain "NAT") should cover everything in your list. 2 and 8 will be covered through port forwarding, and 6 will be covered for host access to the VMs through port forwarding.

Host and LAN access into the VMs must be through port forwarding, since NAT Network puts a "router" between the VMs and the host. It is this "router" that gives the VMs internet access regardless of the host's LAN settings and restrictions, so the "router" is necessary to "work from any place my laptop is". On the host itself, you access via the loopback address 127.0.0.1:port#. From the LAN you'd access the VMs through host.LAN.IP.address:port#. Inside the VMs, each VM is given its own IP address, or you can set static IP addresses for the VMs. NAT Network's port forwarding requires that you know the VM's IP address to set up the port forward, so static IPs might be a good idea. Fully configure the NAT Network IP range (see the main Virtualbox window, File menu, Preferences, Network) before you use the NAT Network for the first time.

If your project requires direct IP-address-based access from the host to the VMs without port numbers, you'd have to go with Host-Only. That's a direct independent network between host and VMs, but no internet. You could add a second network card to each VM set to plain NAT, which would get internet into each VM. LAN access to the VMs would still be through port-forwarding through each NAT interface.

Each port forward number for either scheme must be unique. Example, when accessing a web service on port 80 from two VMs, one VM's NAT/NAT Network port number might be 8080 and the other 8081, but they cannot both be 8080.

Bridged is the ultimate setup, placing each VM on the LAN along with the host, no port forwarding required. But Bridged doesn't always work every place your laptop is, and the VMs' IP addresses might have to change ranges to be compatible.