VMware Virtual Machine Three Networking Methods and Principles of Summary

  • 2021-01-22 08:17:12
  • OfStack

1. Brigde -- Bridging: VMnet0 is used by default

1. Principle:

"Bridge bridge" is a host machine with two network cards, each on the two LANs, and running a program on the "bridge" that allows all packets from LAN A to flow to B intact and vice versa. In this way, the LAN A and B will be seamlessly connected at the link layer. When bridging, the VMWare and physical network cards will be in the same segment as the 1IP, of course, ensuring that the two LANs do not conflict with IP.

The bridge in VMWare is the same, except that what was originally a network card as hardware is now virtualized by VMWare software! When bridging, VMWare will bridge a virtual network card to the actual physical network card, so that all packets sent to the physical network card will be sent to the VMWare virtual machine, and packets sent from VMWare will also be sent from the physical network card across the bridge.

So, if the physical network card can connect to the Internet, then there is no problem with the bridge soft network card, this is the principle of the bridge network.

2. Networking mode:

This is the simplest way to network, in the LAN, your host network is how you network in the virtual machine. The virtual machine as another computer in the LAN on the line!

Note: The host network card is in a LAN that can access Internet, so the virtual machine can access Internet via Bridge.

2. ES36en -- Network address translation: ES37en8 is used by default

1. Principle:

NAT is short for Network address translate. NAT technology application on internet gateways and routers, such as 192.168.0.123 this address to access internet, the packet will be through a gateway or router, and gateway or router has access to one internet ip address, the gateway and the router will when sending and receiving data packets, the packets IP protocol layer data changes (i.e. NAT), in order to make the host would be able to access a private network segment internet. This technique solves the problem of scarce IP addresses. The same private IP can access the Internet through the gateway NAT.

NAT of VMWare is also the same reason, it in the host and virtual machine between the software forged a network card, this network card and virtual machine ip in a address segment. At the same time, NAT is performed between this network card and the network interface of the host. Each packet sent by the virtual machine will pass through the virtual network card, then NAT, and then be sent by the host interface.

Virtual network card and virtual machine in a address segment, virtual machine and host different 1 address segment, the host is equivalent to the gateway of the virtual machine, so the virtual machine ping to the host IP, but the host ping is less than the virtual machine IP.

2. Networking mode:

Method 1. Dynamic IP address.

It doesn't matter whether the host is static IP or dynamic IP. Set the virtual machine to use DHCP to access the Internet. Select "Automatic access to IP" under Windows, and start DHCP service under linux. (This method is the simplest, not too many Settings, but to "edit → virtual network Settings" in VMware, NAT and DHCP are opened. NAT on by default, DHCP off by default)

Method 2 Static IP address.

If you do not want to use ES96en, you can also set it manually:

IP set with vmnet1 segment, the gateway is set to vmnet8 gateway (in "Settings" virtual network Net option card can find Gateway) is usually xxx. xxx. xxx. 2.

The setting of the subnet mask is the same as VMnet8 (the subnet mask will be generated automatically after the IP address is set)

The DNS setup is the same as the host.

For example, host IP is 10.70.54.31, and virtual machine IP is 10.70.54.22. Netmask,Gateway,DNS are the same as the host to implement the virtual machine -- the host virtual machine < ---- > Internet communication.

Tip: With NAT technology, if the host has Internet access, the virtual machine can access Internet, but the host cannot access the virtual machine.

3. Host-Only -- Private Network Shared Host: The default is VMnet1

1. Principle:

It provides network access between hosts and virtual machines. This setting is used for data exchange between the virtual machine and the host, but not for access to ES140en by the virtual machine.

Host-only condition, VMWare in the real Windows system, build a soft network card. This network card can be seen in the network connection, usually VMNET1. The purpose of this network card is to make Windows see IP of the virtual machine.

2. Networking methods:

Method 1. Dynamic IP address.

When DHCP is turned on as above, the virtual machine automatically gets the IP address and DNS directly. You can connect to the mainframe. Of course, there are also some LAN sharing operations, which will not be described here.

Method 2: static IP address.

You can also manually set the virtual machine IP and VMnet1 with the same network segment, gateway set VMnet1 gateway is the same, other Settings are the same as VMnet1,DNS Settings are the same as the host.

For example: VMnet1 IP:172.16.249.1 Gateway :172.16.249.2

So virtual machine IP:172.16.249.100 Gateway: 172.16.249.2

So, virtual machine < --- > Host can communicate
However, virtual machines < --- > The Internet can't communicate

Note: Host-only technology is only used for host and virtual machine visits, not for access to internet.


Related articles: