Virtual machine network connection mode

https://www.cnblogs.com/linjiaxin/p/6476480.html


Because linux is currently very popular, more and more people are learning linux, but put the house to buy a service learning, it is very wasteful. So how to solve this problem? Virtual machine software is a good choice, commonly used virtual machine software vmware workstations and virtual box and so on. When using virtual machine software, many beginners will encounter many problems, and the network connection vmware problem is one of the largest problems we encountered. In the study group inside the exchange, almost every day there are students asked these questions, explain to write this is because the group in the process of children's shoes network fails, then help him in understanding of their own to do a summary. Next, we will work together to explore three modes vmware workstations on the network connection.

vmware network offers three operating modes for us, they are: Bridged (bridge mode), NAT (network address translation mode), Host-Only (Host mode only).

Open vmware virtual machine, we can see VMnet0 (bridge mode) in the options bar of the "Virtual Network Editor," "Edit" in, VMnet1 (Host mode only), VMnet8 (NAT mode), then these are what role in it? In fact, we now see VMnet0 represents the virtual switch used in bridge mode; VMnet1 represents the virtual switch used only under the host mode; VMnet8 is represented in the virtual switch for NAT mode.

Meanwhile, in the corresponding host has VMware Network Adapter VMnet1 and VMware Network Adapter VMnet8 two virtual network cards, which are acting on the host-only mode and NAT mode. In the "Network Connections", we can see these two virtual NICs, if these two uninstalled, you can click on the "Restore Defaults" in vmware "Virtual Network Editor", "Edit", you can re virtual LAN reduction.

Small partners see here, certainly in doubt, why not VMware Network Adapter VMnet0 virtual network adapter on the real machine do? So then, we take a look at why.

A, Bridged (bridge mode)

What is the bridge mode? Bridge mode is to host virtual machine virtual card and the card using a virtual bridge for communication . Under the action of the bridge, the physical host is similar to a virtual switch, bridging all virtual machines provided on an interface connected to the switch, the physical host is also inserted in the switch which, in the card so that card and the bridge are all exchange mode, you can access without interfering with each other. In bridge mode, the virtual machine ip address need the same network segment, if you need a network, gateway and DNS needs to be consistent with the host and the host network card. Network structure as shown below:

Next, we come to practice, how to set the bridge mode.

First, after installing the system, before turning on the system, click on the "Edit virtual machine settings" to set the card mode.

Click on "Network Adapters" and select "bridge mode", then "OK"

Before entering the system, we would like to confirm ip address of the host, gateway, DNS and other information.

Then, edit the card into the system configuration files, command vi / etc / sysconfig / network-scripts / ifcfg-eth0

Adding content is as follows:

Editing is complete, save and exit, and then restart the virtual machine network card, use the ping command ping outside the network ip, test whether networking.

Can ping the external network ip, proved successful bridging mode setting.

Does that communication between the host and the virtual machines normal? We will use remote tools to test.

Host and virtual machine communication is normal.

This is the bridge mode setting step, I believe we should learn how to set up bridge mode. Bridge mode configuration is simple, but if your network environment is the very lack of resources or ip ip for more stringent management, then the bridge mode is not as useful. If this is the case, then how do we solve it? Next, we come to know of another network mode vmware: NAT mode.

Two, NAT (address translation mode)

We just said, if your network ip scarcity of resources, but you also want your virtual machine capable of networking, NAT mode at this time is the best choice. With NAT NAT mode virtual appliances and virtual DHCP server so that virtual machines can be networked. Network structure as shown below:

In NAT mode, the virtual card and the host is directly connected to the NAT device, the NAT device and the virtual connection with a virtual DHCP server on the VMnet8 virtual switch, thus achieving a virtual machine network. Then we will find it very strange why the virtual network adapter VMware Network Adapter VMnet8 it? Our original virtual network adapter VMware Network Adapter VMnet8 primarily to enable communication between the host and the virtual machines. After the placing step, we can be verified.

First, set the NAT mode virtual machine option, open vmware, click on the "Virtual Network Editor", "Edit", set NAT parameters and DHCP parameters.

The network connection mode virtual machine modified to NAT mode, click on the "Edit virtual machine settings."

Click on "Network adapters", select the "NAT Mode"

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

Specific configuration is as follows:

Editing is complete, save and exit, and then restart the virtual machine network card, obtain the dynamic ip address, use the ping command ping ip outside the network, whether the test network.

Before, we said that the role of virtual network adapter VMware Network Adapter VMnet8, then we now have to test it.

The VMware Network Adapter VMnet8 virtual network card is disabled, and then, from the virtual machine ping outside the network, see if you can ping pass?

In view of this, China Unicom virtual machines outside the network, does not by VMware Network Adapter VMnet8 virtual card, then why have a piece of virtual network adapter do?

Before we say that the role of VMware Network Adapter VMnet8 is the communication between the host and the virtual machine, then, we used to test remote connectivity tools.

Then, after the VMware Network Adapter VMnet8 enabled, remote discovery tools can be connected to the virtual machine.

So, this is NAT mode, using the virtual NAT devices and a virtual DHCP server to the virtual machines connect to external networks, and VMware Network Adapter VMnet8 virtual network adapter is used to communicate with the virtual machine.

Three, Host-Only (master mode only)

Host-Only mode is actually removed virtual mode NAT NAT device, then VMware Network Adapter VMnet1 VMnet1 virtual NIC is connected to the virtual switch, Host-Onl virtual machines to communicate with the y mode virtual machine spaced from the external network, so that the virtual machine become an independent system, communicate with each other only with the host. Network structure as shown below:

By the map, we can see that if you want to make a virtual networking function, we can share the host network card to VMware Network Adapter VMnet1 card, so as to achieve the purpose of virtual machine networking. Next, we have to test it.

First set "Virtual Network Editor", you can set the start of DHCP range.

Set the virtual machine to Host-Only mode.

Power on the system, and then set the card file.

Save and exit, and then restart the card, using a remote test tools can communicate with the host.

You can communicate, provided the external network link is now the virtual machine between the host and the virtual machine.

We can see on the map there is a hint to force the VMware Network Adapter VMnet1 is set to ip 192.168.137.1, then the next, we have to subnet and DHCP start address of the virtual machine to be modified, click on the "virtual network editor"

Reconfigure the network card, the virtual network adapter VMware Network Adapter VMnet1 as the routing of the virtual machine.

Restart card, then outside the network and China Unicom can communicate with the host via a remote testing tool.

The test results prove that you can make a virtual machine connected to the Internet.

These are the working principle and configuration in detail about vmware three network modes.

 

Guess you like

Origin blog.csdn.net/u013755520/article/details/90950828