Here I will give you a brief introduction to the vbox network configuration and application.
Virtualbox provides four network access modes:
1. Nat network address translation mode (NAT, Network Address Translation)
2. bridged adapter Bridging Mode
3. Internal internal network mode
4. Host-only adapter Host Mode
The following describes the four network modes:
First Nat Mode
The NAT configuration diagram is as follows (the figure cannot be displayed and I deleted it)
The Nat network structure is as follows:
Explanation:
The Nat mode is the simplest way to access the Internet through virtual machines. You can understand that all data accessed by vhost is provided by the host, and vhost does not actually exist in the network, the existence of the vhost cannot be viewed or accessed by any host on the host or network.
Relationship between virtual machines and hosts:
Only one-way access is allowed. virtual machines can access the host through the network, and the host cannot access the virtual machine through the network.
Relationship between virtual machines and other hosts in the network:
Only one-way access is allowed. virtual machines can access other hosts in the network, while other hosts cannot access virtual machines through the network.
Relationship between virtual machines:
Mutual access is not allowed. virtual machines and virtual machines are completely independent of each other and cannot access each other through the network.
The second bridged adapter Mode
The bridged configuration diagram is as follows:
The bridged network structure is as follows:
Explanation:
The bridge mode is my favorite mode, and the simulation degree is also quite perfect. As you can understand, it sets up a bridge through the host Nic and connects it directly to the network. Therefore, it allows virtual machines to be allocated to independent IP addresses in a network. All network functions are the same as those of real machines in the network.
Relationship between virtual machines and hosts:
Mutual access is allowed because the virtual machine has an independent IP address in the real network segment. The host and the virtual machine are in the same network segment and can access each other through their respective IP addresses.
Other VM relationships in the network:
Mutual access is allowed. Because the virtual machine has an independent IP address in the real network segment, the virtual machine and other hosts on the network are in the same network segment and can access each other through their respective IP addresses.
Relationship between virtual machines and virtual machines:
They can access each other for the same reason.
Third Internal Mode
The internal configuration diagram is as follows:
The internal network structure is as follows:
Explanation:
Intranet mode, as its name implies, is the internal network mode. virtual machines are completely disconnected from the Internet, and only the internal network mode between virtual machines is implemented.
Relationship between virtual machines and hosts:
They cannot access each other. They do not belong to the same network and cannot access each other.
Relationships between virtual machines and other hosts in the network:
Mutual access is not allowed for the same reason.
Relationship between virtual machines and virtual machines:
Mutual access is allowed, provided that the two virtual machines set the same network name when setting the network. In the preceding configuration chart, the name is intnet.
Fourth host-only adapter Mode
The host-only configuration is illustrated as follows:
The network structure of host-only is as follows:
Explanation:
Host mode. This is a complex mode that requires a solid basic network knowledge. It can be said that the functions implemented in the previous modes can be achieved through virtual machine and nic settings in this mode.
We can understand that the vbox model a dedicated Nic for the virtual machine in the host. All virtual machines are connected to the NIC. We can set this Nic to achieve Internet access and many other functions, such as NIC sharing and nic bridging ).
Relationship between virtual machines and hosts
Mutual access is not allowed by default. Both parties do not belong to the same IP segment. The default IP segment of the Host-only NIC is 192.168.56.x, And the subnet mask is 255.255.255.0. The virtual machines allocated to the backend are also located in This CIDR block. Through Nic sharing and nic bridging, virtual machines can access each other on the host.
Relationship between virtual machines and network hosts
Mutual access is not allowed by default. The reason is the same as above. Mutual access can be achieved through settings.
Relationship between virtual machines and virtual machines
Mutual access is allowed by default, and both are in the same network segment.
Network structure of four network combinations of applications
By understanding the above several network modes, we can use them flexibly to simulate the establishment of any network environment we want.
For example, I want to simulate a host to monitor the network environment of a local area network.
First, I started two virtual machines, vhost1 and vhost2. Of course, if the hardware permits, I can also add vhost3, vhost4...
All vhosts are set to internat Intranet. The network name is intnal and the gateway is 192.168.56.100.
192.168.56.100 Nic. One vhost1 is set as a dual-nic, one is in Intranet mode (192.168.56.100), and the other is in Bridge Mode.
(192.168.1.101 ). Set two NICs to share the Internet
There is a LAN between virtual machines. One of them is connected to the Internet through vhost1, and all the virtual machines in the LAN are connected to the Internet through vhost1. In this way, vhost1 can monitor the Internet access of the entire virtual machine LAN.