Vmware virtual machine Three types of network mode most detailed explanation "reprint"

Source: Internet
Author: User

Because Linux is hot now, more and more people are learning Linux, but it is very wasteful to buy a service to study at home. So how to solve this problem? Virtual machine software is a good choice, commonly used virtual machine software has VMware workstations and virtual box and so on. When using virtual machine software, many beginners will encounter many problems, and VMware's network connectivity problem is one of the most problems encountered. In the Learning Exchange group, almost every day there are students ask these questions, write this article is also because the group of children's shoes network failure, and then help him to solve the process, to his understanding also do a summary. Next, let's explore three modes of VMware Workstations network connectivity.

VMware provides us with three network operating modes:bridged (bridge mode),NAT (network address translation mode),host-only (host mode only).

If you open a VMware virtual machine, we can see VMnet0 (bridge mode), VMnet1 (host mode only), VMnet8 (NAT mode) in the Virtual network editor under Edit in the options bar, so what's the effect? In fact, the VMnet0 we see now represents a virtual switch for bridging mode, VMNET1 represents a virtual switch for host-only mode, and VMnet8 represents a virtual switch for NAT mode.

At the same time, there are VMware network Adapter VMnet1 and VMware network Adapter VMnet8 two virtual network cards on the host, which are used for host-only mode and NAT mode respectively. In "Network connection" We can see these two virtual network cards, if you uninstall the two pieces, you can in the VMware "edit" under the "Virtual Network Editor" click on "Restore the default settings", you can re-restore the virtual network card.

Small partners see here, there must be doubt, why there is no VMware network Adapter VMnet0 virtual network card on the real machine? So next, let's take a look at why.

First, bridged (bridge mode)

What is bridging mode? Bridging mode is the use of virtual Bridge to communicate the host network card and virtual machine virtual network card. In the role of bridging, similar to the physical host virtual as a switch, all the bridge settings of the virtual machine connected to the switch on an interface, the physical host is also plugged in the switch, so all the bridge network card and Nic are switched mode, mutual access without interference. In bridging mode, the virtual machine IP address needs to be in the same network segment as the host, and if networking is required, the gateway and DNS need to be consistent with the host NIC. Its network structure is as follows:

Next, we'll do the actual operation, how to set the bridging mode.

First, after installing the system, click "Edit Virtual machine settings" To set the network card mode before turning on the system.

Click "Network Adapter", select "Bridge mode", then "OK"

Before entering the system, we first confirm the host's IP address, gateway, DNS and other information.

Then, enter the system to edit the NIC configuration file, the command is Vi/etc/sysconfig/network-scripts/ifcfg-eth0

Add content as follows:

Edit complete, save exit, then restart the virtual machine nic, ping the extranet IP using the ping command, and test for networking.

Can ping the external network IP, prove that the bridge mode setting is successful.

Is the communication between the host and the virtual machine normal? Let's test it with a remote tool.

The host communicates properly with the virtual machine.

This is the bridge mode Setup step, I believe you should learn how to set up the bridge mode. Bridge mode configuration is simple, but if your network environment is a lack of IP resources or more stringent IP management, then the bridging mode is not very suitable. If this is the case, how can we solve it? Next, let's get to know another VMware Network mode: Nat mode.

NAT (address translation mode)

We just said that if your network IP resources are scarce, but you want your virtual machines to be networked, Nat mode is the best choice. Nat mode enables virtual machines to be networked with virtual NAT devices and virtual DHCP servers. Its network structure is as follows:

In NAT mode, the host network card is connected directly to the virtual NAT device, and then the virtual NAT device is connected to the virtual Switch VMnet8 with the virtual DHCP server, thus enabling virtual machine networking. Then we will find it very strange, why do we need virtual network card vmware network Adapter VMnet8? Our VMware network Adapter VMNET8 virtual network card is primarily designed to enable communication between the host and the virtual machine. We can verify this later in the setup steps.

First, set the options for NAT mode in the virtual machine, open VMware, and click on "Edit" under "Virtual Network Editor" to set NAT parameters and DHCP parameters.

Change the network connection mode of the virtual machine to NAT mode and click "Edit Virtual machine settings".

Click on "Network adapter" and select "Nat Mode"

Then boot the system, edit the NIC configuration file, command for Vi/etc/sysconfig/network-scripts/ifcfg-eth0

The specific configuration is as follows:

Edit complete, save exit, then restart the virtual Machine network card, dynamically obtain the IP address, ping the external IP with the ping command, test whether the network.

Before we talked about the role of the VMware network Adapter VMnet8 virtual network card, let's test it now.

So it seems that the virtual function of the extranet, really not through the VMware Network Adapter VMnet8 virtual network card, then why should have this virtual network card?

We said before that the role of the VMware Network Adapter VMnet8 is the communication between the host and the virtual machine, and then we use the Remote Connection tool to test it.

Then, when you enable VMware Network Adapter VMnet8, you discover that the remote tools can connect to the virtual machine.

So, this is NAT mode, which uses virtual NAT devices and virtual DHCP servers to connect the virtual machines to the extranet, while the VMware network Adapter VMnet8 Virtual network card is used to communicate with the virtual machine.

Three, Host-only (host mode only)

Host-only mode is actually NAT mode to remove the virtual NAT device, then use the VMware Network Adapter VMNET1 Virtual network adapter to connect VMNET1 Virtual Switch to communicate with the virtual machine, Host-only mode separates the virtual machine from the outside, Makes the virtual machine a standalone system that communicates with the host only. Its network structure is as follows:

Through, we can find that if we want to make the virtual function networked, we can share the host network card to the VMware Network Adapter VMNET1 network card, so as to achieve the purpose of virtual machine networking. Next, let's test it out.

Set the virtual network editor first, and you can set the starting range for DHCP.

Set the virtual machine to host-only mode.

Boot the system, and then set the NIC file.

Save the exit, then restart the network card, and use the remote tool to test whether the host communicates with it.

The host and the virtual machine can communicate, and now set up the virtual machine Unicom extranet.

We can see a prompt that forces the VMware network Adapter VMnet1 IP to be set to 192.168.137.1, then we will change the DHCP subnet and start address of the virtual machine, click on "Virtual Network editor"

Reconfigure the network card to route the VMware Network Adapter VMNET1 virtual network card as a virtual machine.

Restart the network card, and then use the remote tool to test whether you can connect to the extranet and communicate with the host.

The test result proves that the virtual machine can be connected to the extranet.

The above is a detailed description of how VMware's three network modes work and are configured.

Original from Http://note.youdao.com/share/web/file.html?id=236896997b6ffbaa8e0d92eacd13abbf&type=note

Vmware virtual machine Three types of network mode most detailed explanation "reprint"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.