The difference between virtual machine bridging, NAT and host-only mode

1. Bridge mode
VMware bridge mode is to transfer the virtual network adapter of the virtual machine to the physical network adapter of the host. The virtual network adapter in the virtual machine can directly access the external network through the physical network adapter in the host. In short, it's like adding a new, separate computer to your LAN. Therefore, the virtual machine also occupies an IP address in the local area network, and can communicate with other terminals.

Bridged-mode networking supports both wired and wireless host network adapters. If you want to treat the virtual machine as a completely independent computer and allow it to communicate with the network like other terminals, then bridge mode is usually the easiest way for the virtual machine to access the network.

Two, NAT mode
NAT, the abbreviation of Network Address Translation, that is, Network Address Translation.

NAT mode is also the default network connection mode for VMware to create virtual machines. When using NAT mode network connection, VMware will establish a separate private network on the host to communicate between the host and the virtual machine.

The request data "package" sent by the virtual machine to the external network will be handed over to the NAT network adapter with a "special mark" and forwarded in the name of the host. The response data "package" returned by the external network will also be received by the host first, and then Handed over to the NAT network adapter to identify and forward to the corresponding virtual machine according to the "special mark",

Therefore, the virtual machine does not have to have its own IP address in the external network. From the perspective of the external network, the virtual machine and the host are sharing an IP address. By default, external network terminals cannot access the virtual machine.

Additionally, only one NAT-mode virtual network is allowed on a host. Therefore, multiple virtual machines connected to the NAT mode network on the same host can also access each other.

NAT setting realizes port forwarding :
By default, the external network cannot access the virtual machine, but the port forwarding function can also be realized by manually modifying the NAT setting, and the data sent from the external network to the specified port of the host is forwarded to the specified virtual machine. For example, we "established" a site on port 80 of the virtual machine. As long as we set port forwarding and forward the data on port 88 of the host to port 80 of the virtual machine, the external network can be accessed through port 88 of the host. The site on port 80 of the virtual machine.

3. Host mode
host-only, host-only mode, is a more closed network connection mode than NAT mode, which will create a private network completely contained in the host.
A host-only virtual network adapter is visible only to the host and provides network connectivity between the virtual machine and the host.
Compared with the NAT mode, the host-only mode does not have the NAT function, so by default, the virtual machine using the host-only mode network connection cannot connect to the Internet (install appropriate routing or proxy software on the host, or If you use the Internet Connection Sharing function on the host machine, you can still connect the virtual machine to the Internet or other networks).

Multiple host-only virtual networks can be created on the same host. If multiple virtual machines are in the same host-only network, they can communicate with each other; if they are in different host-only networks, By default, they cannot communicate with each other (you can communicate with each other by setting up a router between them).

4. Summary:

A virtual machine in bridge mode is like an adult who has "registered" at the "Civil Affairs Bureau" of the router. It has its own separate residential address. Although it lives in the same compound as the host, it is a person with registered permanent residence. , You can directly communicate with the outside world swaggeringly.

The virtual machine in NAT mode is purely a black account that has not registered. The router "Civil Affairs Bureau" has no idea that there is such a person, and naturally it will not actively communicate with it. Even if the virtual machine occasionally sends some letters to the outside, it has to be forwarded to the host in the name of the host. The host also specially invited an old man called NAT to be responsible for the sending and receiving of these virtual machines.

The virtual machine in the host-only mode is purely a black slave. Not only does it have no household registration, and the router "Civil Affairs Bureau" does not know such a person, it is also locked in a small dark room by the host, and is not even allowed to send out letters.

Guess you like

Origin blog.csdn.net/qq_41320433/article/details/126607635