# # # #图片以及部分内容来源: https://note.youdao.com/share/?id=236896997b6ffbaa8e0d92eacd13abbf&type=note#/
When you install a virtual machine, you often see 3 network modes when you set up a network adapter for your virtual machines. Bridging mode, Nat mode, and host-only mode. So what's the difference between these 3 models?
1. Bridging mode (VMNET0)
In this mode, the virtual machine and the host are connected to the same network, the virtual machine and the host are side-by-side relations, the status is quite. For example, your computer and your phone are connected to the WiFi provided by the router, so their relationship is this mode.
By choosing this mode, your host is connected directly to the router.
If your router has DHCP enabled, both the host and the virtual machine can get the IP automatically.
If your router does not have DHCP enabled, then your virtual machines manually set the IP address. First check the Internet host's IP address is how much, and then imitate the host network card IP address, set a different IP address of the same network segment can be.
Working principle:
Summary: Bridge mode is the most common mode of our normal life, the home of various electronic devices connected to the home router, they are in the same network segment, their relationship is bridging mode.
2.NAT Mode (VMNET8)
Nat mode, which is the network address translation mode. With this model, the main opportunity serves as a "router" role, and if the host is able to surf the Internet, the virtual machine will be able to surf the Internet. At this point the virtual machine is in a new network segment, the DHCP service provided by VMware automatically assigns the IP address, and then the shared host implements the Internet via the NAT service provided by VMware.
Working principle:
Summary: The NAT mode of data flow is through the Host network card NAT forwarded to the VMNET8 network card, and then through the virtual DHCP server automatically assigned IP, so as to achieve the Internet, when the host equivalent to "router."
3. Host-only mode (VMNET1)
This mode is NAT mode to remove the virtual NAT device, essentially the equivalent of a network cable to connect the host and virtual machine. Host-only mode separates the virtual machine from the outside network, making the virtual machine a standalone system that communicates with the host only.
Working principle:
Summary: Only the host mode is equivalent to take a network cable directly connected to the host and virtual machine, the virtual machine can not access the network, want to access the network only share the host's network card. And the virtual machine can not communicate with other computers on the LAN, only the host can communicate with it.
3 Network models from VMware