▷ Ways to connect two virtual machines in virtualbox network
Table of contents:
- Network connection types for virtual machines
- Access the virtual machine network settings
- Connection mode: Internal network
- Connection mode: NAT
- Connection mode: Bridge Adapter
- Connection mode: NAT network
Continuing with the VirtualBox tutorials, today we will see an interesting section, and that is to see the ways to connect two virtual machines in the VirtualBox network to be able to transfer our files between them and interact as we would in a real LAN. We will see that there are different ways of doing things, depending on the objective we have, we will be more interested in one way or another.
Index of contents
VirtualBox is one of the most complete free Hypervisors that exists to create a virtual machine on our home computer or in small and medium-sized companies. This program allows us to make many configurations to our virtual equipment, and one of the most interesting is the possibility of connecting these equipment via network.
Network connection types for virtual machines
In VirtualBox there are several types of network configurations for our machines. We are going to dedicate ourselves to see what each of the most useful and used settings does.
For practical purposes, the network configuration will ultimately be at the expense of each specific operating system. VirtualBox gives us the tools to make the connection, but it will be each user who has to configure the network characteristics of each operating system to connect them, for example, to see a shared folder or use remote control.
Access the virtual machine network settings
The first thing we will have to know, as is normal, is to know where this configuration is. We can do it in two different ways, either from the virtual machine execution window or from the main panel of the VirtualBox administrator.
From the window of each virtual machine, we will have to go to the toolbar in the upper area and click on " Devices -> Network -> Network Preference ".
In each of the virtual machines we will have to do the same procedure to access this configuration.
We can also do it through the general panel selected the virtual machine in question, and clicking on the configuration button. In the window, we will go to the network section to access these properties.
For our part, we see the first option better since we can do the actions simultaneously on each machine. We will also have to take into account that it will not be necessary to have the machine turned off, since the changes will be made directly when hot.
Connection mode: Internal network
This type of connection does not have much mystery, although it is very useful if what we want is to obtain the maximum protection against external intrusions for our virtual machine.
Through this mode, we will be able to communicate the virtual machines among themselves as if it were a LAN network, but we will NOT have access neither to the Internet (external network) nor even to host computers.
This is especially useful when we want to do network tests between machines without external intervention or danger of security holes.
If we look at the network connection of the operating system, we will see that we do not have a gateway, and we will not even have an IP address similar to that of our host computer.
And of course we will have restricted Internet access.
If, for example, we ping the other virtual machine, we will effectively get a response from you, so we will be perfectly capable of sharing files and performing typical actions.
If we now ping our host we would get an interesting connection error. This shows that the internal network works only for virtual machines.
Connection mode: NAT
The NAT or Network Address Translation connection mode is another connection mode whereby the host computer provides the IP address to the virtual machine. Through this mode, we can browse the Internet from the virtual machine and download a file.
On the contrary, we will not be able to establish a connection, neither between virtual machines, nor between the machines and the host. If we check if there is a connection between these three computers we will obtain the following:
Also, both virtual machines will have the same IP address, making it impossible for them to see each other. This will be the most limited type of connection that we will have in addition to that of not connected.
Connection mode: Bridge Adapter
This is undoubtedly the most useful way to connect virtual machines. This type of connection simulates a physical connection to the virtual machine network. This means that our virtual machine will be connected through a network adapter created on the host machine to the router or server in our environment.
In this way, each virtual machine obtains an IP address directly from the Internet gateway, so we will have exactly the same possibilities as if we were on a physical computer.
We can both browse the Internet and connect physical machines. We can also create our own servers and access them remotely from outside our network using the public IP or domain created.
We see here how we have obtained an IP directly from our router.
We can also check from our physical host computer that we see all the computers connected to the network, virtual machines and our own. It is not necessary to ping because we already know that they are visible to each other.
Connection mode: NAT network
This connection mode is, so to speak, an extension of the NAT mode to be able to create a network between the virtual machines and that in turn can access the internet. We could say that it is the union between the characteristics of a NAT network (for the internet) and an Internal network (connection between virtual machines)
To activate this type of connection, we will first have to configure this network from the VirtualBox main window.
We go to " File " and click on " preferences ". Then we are located on the " Network " section and click on the icon on the right to add a new network.
Now in the new created item, we double click to edit it. Now we can put a name and we can also assign an IP address.
In principle it does not matter what we put, whether it is type A, B or C, but some of it we will keep the “/ 24”. We also have to take into account that the final digit is 0.
Now we go to the virtual machines to be ready to choose the corresponding option.
Now we will see that, in this mode, the machines have different IP addresses and also have internet access
If we ping or look at the virtual machines on the NAT network, we will see that we will have access between them. Of course, we will not have accessibility from the physical equipment to the virtual machines.
In this way we can configure to our liking and according to what we need the network connections of the virtual machines.
We also recommend:
What type of network do you need? We hope this article has shed more light and information about the different options we have for connecting computers to the network.
How to connect to a wifi network using the terminal
There are numerous procedures to connect to a Wi-Fi network using the Linux terminal, we will tell you which is the simplest and most efficient
▷ Install guest additions virtualbox for virtual machines
We teach you how to install the guest additions VirtualBox tools ás you will improve performance and functionality of your machines
▷ How to connect two network computers with windows
Connecting two computers on a network will help you share files from several computers and quickly access them ás you will see here how to do it