VMware's networking mode

There are three VMware networking modes:

  1. bridge mode;
  2. host-only mode;
  3. NAT mode.

1 bridge mode

In bridge mode, the virtual machine uses the network card of the host machine to directly connect to the Internet.

The NIC has two IP addresses, one for the virtual machine and one for the host.

The router generally has a DHCP server enabled, and the host generally obtains an IP address automatically. In order to avoid IP conflicts, it is recommended to set the virtual machine to obtain an IP address automatically (virtual machines generally require a fixed IP address, which is why bridge mode is not recommended).

Note: In the campus network environment, the bridge mode may not be available.

2 Host-only mode

2.1 Host

The host is connected to two networks:

  1. Internet (connected using a real physical NIC);
  2. A virtual network (named VMnet1, connected using the virtual network card VMware Virtual Ethernet Adapter for VMnet1).

VMnet1 is the name of the network, and the name of the network card is VMware Virtual Ethernet Adapter for VMnet1. If there is no ambiguity, it can be referred to as VMnet1 for short.

Note that the virtual network card VMnet1 is for the host machine, not for the virtual machine! View the virtual network card on the host:

insert image description here
The host machine is connected to two networks and must have two IP addresses, one is the IP on the Internet and the other is the IP on the virtual network.

2.2 Virtual Machine

The virtual machine is only connected to the virtual network, and the virtual machine cannot access the Internet.

VMware comes with its own DHCP server, which is responsible for assigning IP addresses on the virtual network to hosts and virtual machines .

3 NAT mode

3.1 Host

The host is connected to two networks:

  1. Internet (connected using a real physical NIC);
  2. A virtual network (named VMnet8, connected using the virtual network card VMware Virtual Ethernet Adapter for VMnet8).

The virtual network card VMnet8 is for the host machine, not for the virtual machine!

The host machine is connected to two networks and must have two IP addresses, one is the IP on the Internet and the other is the IP on the virtual network.

3.2 Virtual Machine

VMware provides the NAT function, and the gateway is 192.168.x.2. (The gateway in VMware appears to be a transparent gateway)

When the virtual machine accesses an IP address other than the local network segment (such as an Internet address), the IP packet is sent to the gateway, and then through NAT, the IP packet is sent to the external network.

VMware comes with its own DHCP server, which is responsible for assigning IP addresses on the virtual network to hosts and virtual machines.

4 VMware's DHCP server

First of all, let me explain that when the IP is manually assigned, the DHCP server is not used, and it can be turned off (of course, it is also fine).

If VMware's built-in DHCP is turned off, the host's VMnet1 network card (or VMnet8 network card), and the virtual machine's network card must manually set the IP address .

To cancel the check in the figure below, the DHCP server will be closed: 编辑-虚拟网络编辑器The function of DHCP is as follows:
insert image description here
insert image description here

  1. The host's virtual network cards VMnet1 and VMnet8 default to "obtain an IP address automatically". At this time, DHCP will assign an IP to the host, which is 192.168.x.1 by default (192.168.x.0 with all zeros indicates the subnet network number, 192.168.x.2 is reserved for gateway).
    insert image description here

  2. The network card of the virtual machine is generally also "obtain an IP address automatically" by default. At this time, DHCP is also responsible for assigning an IP to the virtual machine, the default is 192.168.x.128 (range 192.168. Indicates the broadcast address).
    insert image description here

The IP address of the virtual machine cannot be seen on the host machine, only on the virtual machine.

5 View the IP address of the host

ipconfigEnter or command in CMD ipconfig /allto view the IP addresses of all adapters on the host:
insert image description here

6 Ping the host

The firewall is enabled on the Windows host, and the ping fails by default.

Solution: Add an ICMP inbound rule (of course, you can also directly close Windows Defender Firewall, but this is not recommended).
insert image description here

Guess you like

Origin blog.csdn.net/qq_42679415/article/details/132567397