为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

VMware网卡连接详解

2011-07-17 15页 doc 507KB 16阅读

用户头像

is_004465

暂无简介

举报
VMware网卡连接详解你好 理解VMware的3种网络模型 很多朋友都曾问到关于Guest和Host互联,其实这并不是一件困难的事情,只要能够理解VMware的网络模型即可,今天结合着我的虚拟机,来详细介绍一下VMware的3种网络结构 在说到VMware的网络模型之前,先说一下VMware的几个虚拟设备: VMnet0:这是VMware用于虚拟桥接网络下的虚拟交换机; VMnet1:这是VMware用于虚拟Host-Only网络下的虚拟交换机; VMnet8:这是VMware用于虚拟NAT网络下的虚拟交换机; VMware Network Ada...
VMware网卡连接详解
你好 理解VMware的3种网络模型 很多朋友都曾问到关于Guest和Host互联,其实这并不是一件困难的事情,只要能够理解VMware的网络模型即可,今天结合着我的虚拟机,来详细介绍一下VMware的3种网络结构 在说到VMware的网络模型之前,先说一下VMware的几个虚拟设备: VMnet0:这是VMware用于虚拟桥接网络下的虚拟交换机; VMnet1:这是VMware用于虚拟Host-Only网络下的虚拟交换机; VMnet8:这是VMware用于虚拟NAT网络下的虚拟交换机; VMware Network Adapter VMnet1:这是Host用于与Host-Only虚拟网络进行通信的虚拟网卡; VMware Network Adapter VMnet8:这是Host用于与NAT虚拟网络进行通信的虚拟网卡; 关于桥接网络: 拓扑图: Host的物理网卡和Guest的网卡在VMnet0交换机上通过虚拟网桥进行桥接,这也就是说,你的物理网卡和你的Guest的虚拟网卡(注:这个虚拟网卡不等于VMware Network Adapter VMnet1或者VMware Network Adapter VMnet8)处于同等地位,此时的Guest就好像你的Host主机所在的一个网段所在的另外一台机器。打个比方来说: 我的Host的物理网卡配置如下: IP地址为手工指定方式,网关为192.168.0.1 那么我的Guest就应该和你的Host处于同一个网段,它的配置可为: 同样,IP地址也为手工指定方式,网关也为192.168.0.1 这样的话,IP地址为192.168.0.2的Host和IP地址为192.168.0.158的Guest就可以互通了: 当然,Guest所配置的IP一定要在192.168.0网段没有被占用,而且你的网络管理员允许你使用这个IP地址。 如果在192.168.0网段,存在DHCP服务器,那么Host和Guest都可以把IP地址获取方式设置为DHCP方式。 看一下VMware中对于Bridged网络的定义: Bridged networking connects a virtual machine to a network using the host computer's Ethernet adapter. Bridged networking is set up automatically if you select Use bridged networking in the New Virtual Machine Wizard or if you select the Typical setup path. This selection is available on a Linux host only if you enable the bridged networking option when you install GSX Server. If your host computer is on an Ethernet network, bridged networking is often the easiest way to give your virtual machine access to that network. On a Windows host, you can use bridged networking to connect to either a wired or a wireless network. On a Linux host, you can use bridged networking to connect to a wired network. If you use bridged networking, your virtual machine needs to have its own identity on the network. For example, on a TCP/IP network, the virtual machine needs its own IP address. Your network administrator can tell you whether IP addresses are available for your virtual machine and what networking settings you should use in the guest operating system. Generally, your guest operating system may acquire an IP address and other network details automatically from a DHCP server, or you may need to set the IP address and other details manually in the guest operating system. If you use bridged networking, the virtual machine is a full participant in the network. It has access to other machines on the network and can be contacted by other machines on the network as if it were a physical computer on the network. Be aware that if the host computer is set up to boot multiple operating systems and you run one or more of them in virtual machines, you need to configure each operating system with a unique network address. People who boot multiple operating systems often assign all systems the same address, since they assume only one operating system will run at a time. If you use one or more of the operating systems in a virtual machine, this assumption is no longer true. If you make some other selection in the New Virtual Machine Wizard and later decide you want to use bridged networking, you can make that change in the virtual machine settings editor (VM > Settings). For details, see Changing the Networking Configuration. 关于NAT网络 拓扑图 在NAT网络中,会使用到VMnet8虚拟交换机,Host上的VMware Network Adapter VMnet8虚拟网卡被连接到VMnet8交换机上,来与Guest进行通信,但是VMware Network Adapter VMnet8虚拟网卡仅仅是用于和VMnet8网段通信用的,它并不为VMnet8网段提供路由功能,处于虚拟NAT网络下的Guest是使用虚拟的NAT服务器连接的Internet的。 如图:我的VMware Network Adapter VMnet8虚拟网卡的IP地址配置如下: IP地址是手工指定的,但却不是由我来指定的,而是VMware在安装的时候自动随机指定的一个IP地址(注意,不要修改VMware Network Adapter VMnet8虚拟网卡所在的网络ID,这样的话有可能造成Host和Guest无法通信) 那么,我的NAT网络的虚拟机的IP地址也为192.168.85.0这个网段,其IP地址配置为: 那么,它的IP地址分配方式是DHCP方式指定的,为什么会有DHCP方式呢?这是因为VMware安装之后,会有一台虚拟的DHCP服务器为虚拟机来分配IP地址,实际上它就是一个系统服务而已,在开始--->运行中输入services.msc,就会看到这个服务: 此时可以看到,Guest的IP地址我的VMware Network Adapter VMnet8虚拟网卡处于相同的网络ID,这样的话,ping通就没有问题了: 有一点需要说明的是,在NAT方式的网络中,Guest的Gateway都指向了192.168.X.2,在本例中,X=85,也就是那个虚拟的NAT服务器的地址,这个服务器是一台虚拟的NAT服务器,你可以ping通它,但是却无法访问到这台虚拟机,因为这同样也是一个系统服务: 这时候,你的Guest和Host就可以实现互访了,并且如果你的Host此时已经连接到了Internet,那么你的Guest也就可以连上Internet了。那么VMware Network Adapter VMnet8虚拟网卡在这里扮演了一个什么角色呢?它仅仅是为Host和NAT虚拟网络下的Guest通信提供一个接口,所以,即便Disable掉这块虚拟网卡,Guest仍然是可以上网的,只是Host无法再访问VMnet8网段而已。 参看VMware中关于NAT网络的描述: NAT gives a virtual machine access to network resources using the host computer's IP address. A network address translation connection is set up automatically if you follow the Custom path in the New Virtual Machine Wizard and select Use network address translation. If you want to connect to the Internet or other TCP/IP network using the host computer's dial-up networking or broadband connection and you are not able to give your virtual machine an IP address on the external network, NAT is often the easiest way to give your virtual machine access to that network. NAT also allows you to connect to a TCP/IP network using a Token Ring adapter on the host computer. If you use NAT, your virtual machine does not have its own IP address on the external network. Instead, a separate private network is set up on the host computer. Your virtual machine gets an address on that network from the VMware virtual DHCP server. The VMware NAT device passes network data between one or more virtual machines and the external network. It identifies incoming data packets intended for each virtual machine and sends them to the correct destination. If you select NAT, the virtual machine can use many standard TCP/IP protocols to connect to other machines on the external network. For example, you can use HTTP to browse Web sites, FTP to transfer files and Telnet to log on to other computers. In the default configuration, computers on the external network cannot initiate connections to the virtual machine. That means, for example, that the default configuration does not let you use the virtual machine as a Web server to send Web pages to computers on the external network. If you make some other selection in the New Virtual Machine Wizard and later decide you want to use NAT, you can make that change in the virtual machine settings editor (VM > Settings). For details, see Changing the Networking Configuration. For a more thorough discussion of NAT, see Understanding NAT. 关于Host-Only网络: 拓扑图: 在Host-Only网络中,Host-Only网络被用来设计成一个与外界隔绝的网络,其实Host-Only网络和NAT网络非常相似,唯一不同的地方就是在Host-Only网络中,没有用到NAT服务,没有服务器为VMnet1做路由,它当然就没有访问Internet啦,可是如果我的Host要和Guest通信呢?怎么办?对了!当然就要用到VMware Network Adapter VMnet1这块虚拟网卡了。 如图,这是我的Host的VMware Network Adapter VMnet1虚拟网卡的配置: 那么如果我把Host的网络设置成了Host-Only的话,把它的IP获取方式设置为DHCP获取,它会到虚拟的DHCP服务器上拿到IP,这个IP和我的Host的VMware Network Adapter VMnet1虚拟网卡的IP处于同一个网络ID下: 可以看到,在Host-Only网络下,Guest的Default Gateway被设置为NULL,这是由于没有使用虚拟NAT服务器的缘故,但是,即便使用route add命令加上某个地址做它的路由,它仍然不能访问Internet(实际上也没有地址可加)。这样,我的Guest虽然没有办法访问Internet,但是仍然可以和我的Host进行通信: 至于为何要把Host-Only网络设置为没有Default Gateway的方式,这是VMware的设计使然,它就是为我们来建立一个isolated的网络来使用的,可以看看VMware中关于Host-Only网络的描述: Host-only networking creates a network that is completely contained within the host computer. A host-only network is set up automatically if you select Use Host-Only Networking in the New Virtual Machine Wizard. On Linux hosts, this selection is available only if you enabled the host-only networking option when you installed GSX Server. Host-only networking provides a network connection between the virtual machine and the host computer, using a virtual Ethernet adapter that is visible to the host operating system. This approach can be useful if you need to set up an isolated virtual network. If you use host-only networking, your virtual machine and the host virtual adapter are connected to a private TCP/IP network. Addresses on this network are provided by the VMware DHCP server. If you make some other selection in the New Virtual Machine Wizard and later decide you want to use host-only networking, you can make that change in the virtual machine settings editor (VM > Settings). For details, see Changing the Networking Configuration. Routing and Connection Sharing If you install the proper routing or proxy software on your host computer, you can establish a connection between the host virtual Ethernet adapter and a physical network adapter on the host computer. This allows you, for example, to connect the virtual machine to a Token Ring or other non-Ethernet network. On a Windows 2000 or Windows Server 2003 host computer, you can use host-only networking in combination with the Internet connection sharing feature in Windows to allow a virtual machine to use the host's dial-up networking adapter or other connection to the Internet. See your Windows documentation for details on configuring Internet connection sharing. 实施上,如果我们足够BT,也可以在Host上来为VMware Network Adapter VMnet1虚拟网卡来做路由,比如,我们可以用Windows 2000的RRAS来做,这样的话,处于Host-Only网络下的Guest就又可以上网了,他们只需要使用route add命令把自己的Default Gateway改成VMware Network Adapter VMnet1网卡即可,不过这样不推荐,也没有必要 至此,VMware的3种网络,就应该可以理解了,那么如果嫌VMware为你分配的网络不好,比如它给你分了个192.168.148.0的网络ID,那么你可以到这里来修改,单击VMware上的“Host”菜单,选择“Virtual Network Settings ...” 选择“Host Virtual Network Mapping”中的VMnet1虚拟交换机,单击后边的按钮,选择“Subnet”菜单,即可以调整你的网络ID。 我在这里调整的是VMnet1,那么VMnet8当然也可以用这样的方式来调整 记住,在调整之后你的VMware Network Adapter VMnet1和VMware Network Adapter VMnet8也需要调整到相应的网络ID,不然Host和Guest如何通信呢? 切记,初学者在使用VMware的时候总是喜欢直接修改VMware Network Adapter VMnet1和VMware Network Adapter VMnet8虚拟网卡的IP,以为把它们设置为与Host在一个网段就可以实现通信和上网,实际上在看过这篇文章之后,应该明白,修改这两块虚拟网卡,对于实现网络通信,是多么的没有帮助!
/
本文档为【VMware网卡连接详解】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索