vmware virtual machine created three models of

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

To prevent failure of the original link, so reprint this article

ps: the process of their actual configuration, simply configure the content found in eth0 below, you can successfully link network:

BOOTPROTO=dhcp

HWADDR = 00: 0c: 29: a3: d3: 45 // this value in its own virtual machine, whichever

ONBOOT=yes

If we add DEVICE = eht0, the configuration will fail. linux beginner, the specific cause is not clear how it was.

The following is the complete contents of the original article:

Because Linux has become 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.

Virtual Network Editor

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.

Restore Defaults

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:

Bridge Mode

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.

Set NIC mode

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

network adapter

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.

这就是桥接模式的设置步骤,相信大家应该学会了如何去设置桥接模式了。桥接模式配置简单,但如果你的网络环境是ip资源很缺少或对ip管理比较严格的话,那桥接模式就不太适用了。如果真是这种情况的话,我们该如何解决呢?接下来,我们就来认识vmware的另一种网络模式:NAT模式。

二、NAT(地址转换模式)

刚刚我们说到,如果你的网络ip资源紧缺,但是你又希望你的虚拟机能够联网,这时候NAT模式是最好的选择。NAT模式借助虚拟NAT设备和虚拟DHCP服务器,使得虚拟机可以联网。其网络结构如下图所示:

NAT模式

在NAT模式中,主机网卡直接与虚拟NAT设备相连,然后虚拟NAT设备与虚拟DHCP服务器一起连接在虚拟交换机VMnet8上,这样就实现了虚拟机联网。那么我们会觉得很奇怪,为什么需要虚拟网卡VMware Network Adapter VMnet8呢?原来我们的VMware Network Adapter VMnet8虚拟网卡主要是为了实现主机与虚拟机之间的通信。在之后的设置步骤中,我们可以加以验证。

首先,设置虚拟机中NAT模式的选项,打开vmware,点击“编辑”下的“虚拟网络编辑器”,设置NAT参数及DHCP参数。

虚拟网络编辑器

NAT参数

DHCP参数

将虚拟机的网络连接模式修改成NAT模式,点击“编辑虚拟机设置”。

编辑虚拟机设置

点击“网络适配器”,选择“NAT模式”

NAT模式

然后开机启动系统,编辑网卡配置文件,命令为vi /etc/sysconfig/network-scripts/ifcfg-eth0

编辑网卡配置文件

具体配置如下:

具体配置

编辑完成,保存退出,然后重启虚拟机网卡,动态获取ip地址,使用ping命令ping外网ip,测试能否联网。

测试能否联网

之前,我们说过VMware Network Adapter VMnet8虚拟网卡的作用,那我们现在就来测试一下。

虚拟网卡禁用

是否能ping通

如此看来,虚拟机能联通外网,确实不是通过VMware Network Adapter VMnet8虚拟网卡,那么为什么要有这块虚拟网卡呢?

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-Only mode virtual machine and spaced apart from the external network to communicate with the virtual machine, so that the virtual machine to be a stand-alone system, communicate with each other only with the host. Network structure as shown below:

Host-Only模式

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.

设置Host-Only模式

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 www.cnblogs.com/zomicc/p/12332233.html