The difference between the four network connection modes in VMware

After installing VMware Workstations, there are four network connection methods for virtual machine network configuration, bridge, host only, NAT, and LAN segment.
Write picture description here
Write picture description here
The reason why there are different modes, in my opinion, is to meet different network requirements. In general: bridging and NAT can meet the needs of virtual machines connecting to the external network, while the host-only mode cannot connect to the external network, but it can be realized Communication with physical machines.
After VMware Workstations is installed, two virtual network cards will be generated by default. Open the network and sharing center as follows, VMnet1 is used as hostonly mode, and VMnet8 is used as NAT mode: the
Write picture description here
differences between the four network connection methods are as follows:
1. Bridge mode
Bridge mode is divided into two types One is to directly connect the network card of the virtual machine to the physical network, as shown in the figure below: In
Write picture description here
this method, the network card of the virtual machine communicates directly with the network card of the physical machine. It may be very convenient for Windows virtual machines. You don’t need to think too much about it. It can also be used in Linux virtual machines, but this method is not recommended, which is not conducive to maintenance. Sometimes the virtual machine may not be able to connect to the Internet.
Another method is to bridge through a virtual network, as shown in the figure below:
Write picture description here
Open the virtual network editor (menu bar, "Edit" - "Virtual Network Editor"):
Write picture description here
this method is equivalent to connecting the network card of the virtual machine with the physical network card of the physical machine Add a virtual network VMnet0 directly. VMnet0 can choose whether the bridged network card is a wired network card or a wireless network card, or it can be selected automatically. For example, the physical machine is connected to the Internet through the wireless network card. At this time, VMnet0 selects the wired network card, and the network connection cannot be realized. Personal experience is to select "Automatic" to let VMnet0 automatically select a network card that can access the Internet.
"Bridging" means that the network card of the virtual machine directly passes the data packets to the physical network card of the physical machine for processing. Although it can directly communicate with the outside world, the virtual machine must have its own IP address, DNS, gateway and other information. At this time, the status of the physical machine and the virtual machine is the same. For example: the physical machine is the landlord, the virtual machine is the tenant, and the network card of the physical machine is the gate. Both the landlord and the tenant can pass through the gate, but each has a key and does not affect each other, but the owner of the gate is the landlord.
Write picture description here
As shown in the figure, VMnet0 serves as a route selection function for the physical network card.
Scenarios where bridging can be used: There is a DHCP service in the network where the physical machine is located, which can automatically assign IP addresses to the hosts in the network.
Unsuitable scenarios: campus network, internal virtual machines may not be able to connect to the Internet; physical machines dial-up to the Internet.

2. NAT mode
NAT (Network Address Translation), network address translation
is equivalent to adding a switch directly between the virtual machine and the physical machine, which is equivalent to having the NAT address translation function, which can automatically convert the IP of the virtual machine to the same address as the physical machine The IP of the network segment.
For example, the network card of the virtual machine is connected to the virtual network card VMnet8 on the physical machine. When VMnet8 receives the data packet of the virtual machine, it will forward the data packet to the physical network card of the physical machine. It is equivalent to that the physical network card does not directly contact the data packets of the virtual machine, but contacts VMnet8 for processing. In fact, VMnet8 is in NAT mode, with its own DHCP function, which can assign IP addresses to virtual machines.
Write picture description here
Write picture description here
It can realize the communication between the virtual machine and the physical machine, and the communication between the virtual machine and the external network, but the external network cannot communicate with the virtual machine.
Write picture description here
3. Host only mode (hostonly)
In this mode, the internal virtual machine is connected to a virtual network card VMnet1 that can provide the DHCP function. VMnet1 is equivalent to a switch that forwards the data packets sent by the virtual machine to the physical network card, but the physical network card does not The packet will be forwarded outward. Therefore, the host-only mode can only be used for communication between virtual machines and virtual machines, and between virtual machines and physical machines.
Write picture description here
Write picture description here
4. LAN segment
Write picture description here
Write picture description here
The LAN segment is equivalent to simulating a switch or hub to connect different virtual machines without data exchange with the physical machine or with the external network to build an independent network. Without the DHCP function, you need to manually configure the IP or configure the DHCP server separately.
Write picture description here

Guess you like

Origin blog.csdn.net/chengshiruxia/article/details/112474239