Three connection methods of virtual machine and physical machine

introduction

Many small partners do not understand the three connection methods between the virtual machine and the host when creating a virtual machine (vmware provides us with three network working modes, which are: Bridged (bridge mode), NAT (network address translation mode), Host -Only (host mode only).) How to connect, which leads to the fact that although the virtual machine is created, it cannot communicate with the physical machine, is not connected to the network, and cannot access the outside world. Most online tutorials tell you how to set up a virtual machine and a physical machine alley, but there are few articles that specifically introduce these three connection methods. Let me introduce the three connection methods in detail.

Bridge mode

The bridge mode is to use the virtual bridge to communicate between the host network card and the virtual network card of the virtual machine. Under the effect of bridging, it is similar to virtualizing the physical host as a switch. All virtual machines set up by bridging are connected to an interface of this switch. The physical host is also plugged into this switch, so all network cards and network cards under the bridge are connected. It is an exchange mode, and can visit each other without interference. In the bridge mode, the virtual machine ip address needs to be in the same network segment as the host. If networking is required, the gateway and DNS need to be consistent with the host network card.
Insert picture description here
This connection method has a disadvantage that the ip of the virtual machine and the ip of the physical machine are on the same network segment, and there are 254 available ips in each network segment. This leads to the virtual machine going to the same network segment when many computers share the same network segment. If ip is allocated, ip address is not enough, or ip conflict occurs.

NAT (Address Translation Mode)

If your network IP resources are in short supply, but you want your virtual machine to be able to connect to the Internet, then NAT mode is the best choice. NAT mode uses virtual NAT devices and virtual DHCP servers to enable virtual machines to be networked.
Simple to, when NAT connections, virtual and physical chance to "create" a network segment, the only segment in virtual and physical machines, as:
physical machine
Insert picture description here
virtual machine
Insert picture description here
physical and virtual machines again "create" the ip respectively It is: 192.168.181.1 and 192.168.181.131. It can be seen that the two IP addresses are in the same network segment and do not conflict with the real ip network segment of the physical machine, so that the bridge mode ip address will not be insufficient.
However, this connection method has the disadvantage that if the virtual machine is connected in NAT mode, other computers on the same network segment as the physical machine cannot communicate with the virtual machine, but the virtual machine can be on the same network through the physical machine and the physical machine. Segment of computer communications.

Guess you like

Origin blog.csdn.net/weixin_45837693/article/details/108657825