vmvare虚拟机的三种网络连接方式(bridged、NAT、Host-only)及区别

时间:2021-07-07 14:52:35

三种模式是针对不同行为进行预配置的特定虚拟网络交换机(“VMnets”)的别名。 与正常的网络交换机一样,连接到同一交换机的所有机器彼此可见。
这意味着连接到仅主机网络的所有VM将对主机和彼此可见。 如果希望仅对主机可见的VM,则需要为其分配专用VMnet,并避免将任何其他虚拟机分配给该VMnet。

  • Bridged: Your VM will be in the same network as your host, if your host IP is 172.16.120.45 then your VM will be like 172.16.120.50. It can be accessed by all computers in your host network.
    vmvare虚拟机的三种网络连接方式(bridged、NAT、Host-only)及区别

    虚拟机VM和主机host处在同一层,都被视为实际物理路由器下的节点(兄弟关系)。物理网卡的混杂模式。默认网络适配器接口是vmnet0。

  • NAT: Just like your home network with a wireless router, the VM will be assigned in a separate subnet, like 192.168.6.1 is your host computer, and VM is 192.168.6.3, then your VM can access outside network like your host, but no outside access to your VM directly, it’s protected.
    vmvare虚拟机的三种网络连接方式(bridged、NAT、Host-only)及区别

    将主机host视为路由器节点,虚拟机VM作为该路由器下面的节点(父子关系)。利用主机IP进行外部通信。默认网络适配器接口为vmnet8。

  • Host-Only: The VM will be assigned one IP, but it’s only accessible by the box VM is running on. No other computers can access it.Host-only networking creates a network that is completely contained within the host computer. Host-only networking provides a network connection between the virtual machine and the host system by using a virtual network adapter that is visible on the host operating system.
    vmvare虚拟机的三种网络连接方式(bridged、NAT、Host-only)及区别

    Note that it does not say that the VM will be accessible only by the host.
    You should be aware that the Host-only, NAT, and Bridged modes are aliases to specific virtual networking switches (“VMnets”) that are preconfigured for the different behaviors. As with a normal network switch, all machines connected to the same switch are visible to each other.
    This means that all VMs connected to a host-only network will be visible to the host and to each other. If you want a VM that is visible only to the host, you will need to assign it a dedicated VMnet and avoid assigning any other VMs to that VMnet.

    虚拟机VM和主机host可互相通信,各虚拟机间也可以通信。但虚拟机不能联通外部网络或主机所在的局域网的其他机器。默认的网络适配器接口是vmnet1。

    参考链接:

  • VMware官方文档-网络配置章节
  • 整体介绍+host-only联通外部网络的思考
  • 图解原理
  • 实际操作1
  • 实际操作2
  • 其他