I have setup multiple guest hosts with NAT networking. On each hosts i have some portforwards so i can connect from my host (like 2222 to 22 host 1, 2223 to 22 host 2, ...).
How can i setup a guest-guest network connection with virtualbox?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityI would suggest just adding a second network adapter to each of your virtual machines that is configured with the "Host-Only" option. You could also use a bridged interface but that can do weird things if you have a wireless network adapter. The Host-only option allows your VMs to communicate with your host, as well as each other. This also means you can get rid of the port forwards on your NAT configuration as your host will be able to directly talk to each guest. There is a DHCP configured on the Host-only network by default, and it will typically hand out addresses in the 192.168.56.101-254 range - so you can use the .1-100 addresses for static assignments as well.
On linux guests simply modify /etc/network/interfaces
and add a static up address, netmask and gateway.
e.g.
auto eth1
iface eth1 inet static
address 192.168.56.101
netmask 255.255.255.0
gateway 192.168.56.1
The address range, gateway and netmask can be found from virtualbox -> preferences -> network
just like Goyuix mentioned above.
Side note: I cloned one base VM to create a network of VMs. This also required changes to /etc/hostname
and /etc/hosts
files to give each VM guest a unique hostname. Also, adding a static entry in /etc/hosts
for each networked VM helps DNS addressing (i.e. address by name instead of ip address).
if you mean Guest - Guest as in running 2 virtual machines on the same host and have them communicate then you could use Bridged adapters and set them all in the same subnet.