VMware的3种网络模型

上传人:lis****210 文档编号:184024961 上传时间:2023-02-01 格式:DOCX 页数:10 大小:415.39KB
返回 下载 相关 举报
VMware的3种网络模型_第1页
第1页 / 共10页
VMware的3种网络模型_第2页
第2页 / 共10页
VMware的3种网络模型_第3页
第3页 / 共10页
点击查看更多>>
资源描述
理解VMware的3种网络模型很多朋友都曾问到关于Guest和Host互联,其实这并不是一件困难的事情,只要能够理解VMware的网络模型即可,今天结合着我的虚拟机,来详细介绍一下VMware的3种网络结构在说到VMware的网络模型之前,先说一下VMware的几个虚拟设备: VMnet0:这是VMware用于虚拟桥接网络下的虚拟交换机; VMnetl:这是VMware用于虚拟Host-Only网络下的虚拟交换机; VMnet8:这是VMware用于虚拟NAT网络下的虚拟交换机; VMware Network Adapter VMnet1这是Host用于与Host-Only虚拟网络进行通信的 虚拟网卡; VMware Network Adapter VMnet8 :这是Host用于与NAT虚拟网络进行通信的虚拟 网卡;关于桥接网络:拓扑图:Bridged NetworkingVlrtitalEthernetadapterHostHhHiTa以Host的物理网卡和Guest的网卡在VMnet0交换机上通过虚拟网桥进行桥接,这也就是说,RTLS139/810X通 E0-4C-88-69-1AHo19 幻 168.乩 2Sublet Mask .De f ait It Gat e 己芋:255.255-255.0我的物理网卡和我的Guest的虚拟网卡(注:这个虚拟网卡不等于VMware Network Adapter VMnet1或者VMware Network Adapter VMnet8)处于同等地位,此时的Guest就好像我的 Host所在的一个网段上的另外一台机器。打个比方来说:我的Host的物理网卡配置如下:Ethernct adapter Connected to the Private Hetwrk:Con nect ions pec if ic DNS Suf f ix .: Descript ion:Address.-.-.-Dhcp Enabled. . . - . . - . . R -:IP Address -.zC:XDccunents and SettingsSteve oungIP地址为手工指定方式,网关为192.168.0.1,那么我的Guest就应该和我的Host处于同 一个网段,它的配置可为:C: Documents and SettingsMldministratorMpconf igUindous 2000 IP ConfigurationEthernet adapter Bridged:Ccnnecfcionspecific DNS Suffix .:IP Address:192 . iG8.0.1S8Subnet Mask:2S5.2552&5,0Default Gateway :192.1G8.0.1C: Docuinents and SettingsfidniinistFatoF同样,IP地址也为手工指定方式,网关也为192.168.0.1,这样的话,IP地址为192.168.0.2的Host和IP地址为192.168.0.158 的 Guest 就可以互通了:PC: M)ocunents and Set tings Xfidnin ist pat&i!*ipconf igWindovis 290团 IP ConfigurationEt hernfit: adiiptev-Connection-specific DNS SufFix .: IP Address - .*.*.,* ,: 192 - 1G9 n B. ISA Subnet Mask _. : 25S. 55 k . 0Def atilt: 192.168.0.1C:Docunents and SettingsSAdninistratGPping 12.168.0.2 -tPinking 192.168*0,2 with 32 bytes of dataiReply ft*opi 192-168.0.2: bytti=32 tine18ns TTL=128 Hep I y f F*nn t 9Z . 1 .H . 2 :卜辣伸;以 r i ne Settings). For details, see Changing the Networking Configuration.关于NAT网络 拓扑图:Network Address Translation (NAT)VErtualEthernet adaptervirtual Ether net switch(VMnetS:-在NAT网络中,会使用到VMnet8虚拟交换机,Host上的VMware Network Adapter VMnet8虚拟网卡被连接到VMnet8交换机上,来与Guest进行通信,但是VMware Network Adapter VMnet8虚拟网卡仅仅是用于和VMnet8网段通信用的,它并不为VMnet8网段提供路由功能,处于虚拟NAT网络下的Guest是使用虚拟的NAT服务器来连接到Internet的。VMware功能非常强大,在NAT网络下,我们甚至可使用Port Forwarding功能,来把Host的某一个TCP或者UDP端口映射到Guest上!如图:我的VMware Network Adapter VMnet8虚拟网卡的IP地址配置如下:Ethernet adapter UMware Network Adapter UMnetS-Cc imect ion -spec if ic DNS Suffix -: Description *:UMware Uirtual Ethernet Adapter for UMnetHPhys ical Address:00-50-56-C0-00-08Dhcp Enabled:NoIP Address:192.1GU .85.1Subnet Mask:Default Gateway :IP地址是手工指定的,但却不是由我来指定的,而是VMware在安装的时候自动随机指定的 一个IP地址(注意,不要修改VMware Network Adapter VMnet8虚拟网卡所在的网络ID, 这样的话会造成Host和Guest无法通信)那么,我的 NAT网络的虚拟机的IP地址也为 192.168.85.0这个网段,其IP地址配置为:可以看到,它的IP地址分是由DHCP服务器分配的的,DHCP服务器的地址为 192.168.85.254,那为什么会有DHCP服务器存在呢?这是因为VMware安装之后,会有一台VMware DHCP ServiceStartedAutomaticCHCP service for virtual networks虚拟的DHCP服务器为虚拟机来分配IP地址,这个DHCP服务器,你可以ping通它,但是无 法进行访问,因为实际上它就是一个系统服务而已,在开始运行中输入services.msc,就会看到这个服务:此时可以看到,Guest的网卡和Host上的VMware Network Adapter VMnet8虚拟网卡拥有相同的网络ID,这样的话,在Guest中,ping通Host就没有问题了:FromFromFromFromC: xDocuments and SettingsXfldininistFatorping 192.168.85.1Pinging 192.168.85.1 uith 32 bytes of data:技 ,C: xDocuments and SettinReplyReplyReplyReplybytes=32bytes=32bytes=32bytes=32TTL=128TTL=128TTL=128192.168.85.1:192.168.8S.1:192.168.8S.1:192.168.85.1:time=1ms TTL=128 t ir!e10ns t ime10ins t ime10 Settings). For details, see Changing the Networking Configuration.For a more thorough discussion of NAT, see Understanding NAT.关于Host-Only网络:拓扑图:在Host-Only网络中,Host-Only网络被用来设计成一个与外界隔绝的(isolated)网络, 其实Host-Only网络和NAT网络非常相似,唯一不同的地方就是在Host-Only网络中,没有用 到NAT服务,没有服务器为VMnet1网络做路由,它当然就没有办法访问Internet啦,可是如果此时我的 Host要和 Guest通信怎么办呢?当然就要用到 VMware Network Adapter VMnetl这块虚拟网卡了。如下图,这是我的Host上的VMware Network Adapter VMnetl虚拟网卡的配置,同样,VMware也为我自动随机分配好了它的IP:Ethernet adapter UMware Network Adapter UMnctl言Connfection-specif ic DHS Suffix “ : Descript ion :UMware Uirtual tthernet Adapter for UMnetiPhysical Aidiess.函 50-56 -C0 00 -01IHicp Enabled- . P RIP Address:192.168.163.1Subnet Mask :255.255.255.0Default G/te购y :那么如果我把Guest的网络设置成了 Host-Only的话,把它的IP获取方式设置为DHCP,它会 到虚拟的DHCP服务器上拿到IP,这个DHCP服务器仍然是一个虚拟的DHCP服务器(仅仅是 一个系统服务而 已),而且在下图中, 可以看到,这个 DHCP服务器的IP地址仍然是 192.168.X.254,这里X=163,因为要和我的VMnet1的网络ID相同。所以,Guest所获得的IP和我的Host的VMware Network Adapter VMnet1虚拟网卡的IP使用同一个网络ID:Microsoft Windows 2000 Uersion 5.2195 Copyright 1985-2000 Microsoft Corp.C: XDocuments and SettingsfldniinistFatoFipconf ig /allUindous 2QQQ IP ConfigurationHost Name . . . :vir2000picenPrimary DNS Suffix :Node Type:MixedIP HoutingEnabled:NoWINS ProxiFEnabled:NoDNS Suf f ix Search List.localdomainEthernet adapter Host-Only:Connection-specific DNS Suffix Description RPhysical Address-DHCP EnabledAutoc;.1 nf iguratinn Enabled , , IP AddressSubnet Mask Default Gateway .,. DHCP Sefubf -DNS Seruers Lease ObtainedLease Expires R localdomainUMware PCI Ethernet Adapter tt200-0C-29-63-2A-F7eses192.168.163.128255.255.255.0192.168.163.254192.16S.163.1Uednesdai/, October 2&, 200S 20:32 :52Wednesday, October 26, 2&QS 21-Q2-S2可以看到,在Host-Only网络下,Guest的Default Gateway被设置为NULL,这是由于 没有默认路由器为它到外部网络提供路由的缘故,也即是上边说到的Host-Only网络没有NAT服 务器!如果使用route add命令加上某个地址做为它的路由器,它仍然不能访问Internet(实际 上也没有地址可加)。这样,我的Guest虽然没有办法访问Internet,但是仍然可以和我的Host 进行通信,这正是因为我的Host上的VMware Network Adapter VMnet1虚拟网卡起到了作 用,它负责和VMnet1网络相连,为我访问Host-Only网络下的Guest提供了通信接口。下图 显示了在Host-Only网络中的Guest与我的Host的通信情况::C: XDocuments and Sett logs fldmin 1st rat or pinjr 192.168 -163Pinging 192 q163.163.1 with 32 bytes of data:Reply|ReplyReplyiHeplyfrom from f Film f Film192.168.163.1:192.1S8.163.1:192.1S8.163.1:192.1S8.163.1:bi?tes=32bytes=32bytes=32bytes=32tine=3nis TTL=128t imelS3nstime13ns time163.1 -Packets- Sent = 4, Receiued = 4, Lost = & , Approximate round trip times in milli-seconds-Minimum = 0ms, Maximum = 3ms, Auerage = 0ms峪:XPcicuiiEnt零 and Sett ingwXfidministFedzoa?至于为何要把Host-Only网络设置为没有Default Gateway的方式,这是VMware的设计 使然,它就是让我们建立一个与外界隔离(isolated)的网络时而使用的。VMware 中对于 Host-Only 网络的定义(引用自 VMware GSX Server Users Manual ):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 hosts 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指 向Host上的VMware Network Adapter VMnet1虚拟网卡即可,不过这样做不推荐,也没有 必要.(有兴趣的朋友可以自己实际做一下看看)。至此,VMware的3种网络,就应该可以理解了。可以看到,如果想要Guest上网,在3 种网络模型中,最为简单的方式就是NAT,因为它不需要任何的网卡设置,IP地址也可以从虚拟 的DHCP服务器来获得,要做的仅仅就是把它的网络设置为NAT方式即可。至于Bridged模式, 则需要额外的IP地址,这有可能会实现不了,因为并不是每个 ISP都那么大方.。如果是 Host-Only,则又需要设置RRAS,没有几个人会愿意为了让虚拟机上网而换OS的,所以就用 NAT最好了。在这里要强调的一点是,如果设置了 Host-Only网络,非要为VMnetl做路由,一 定要用RRAS,而不要用Windows XP或者2000的ICS,因为它会自动把内网的接口地址改 为192.168.0.1。你在安装虚拟机的时候,VMware不会正好给你的VMware Network Adapter VMnet1虚拟网卡分配为192.168.0.1的地址吧?这样的话会造成VMware Network Adapter VMnet1虚拟网卡和VMnet1网段的网络ID不一致,自然,你的Guest就没有办法和Host通 信了!实际上经常还会遇到这样的情况:比如VMware为我分配的网络ID在将来会被我用到,或者 嫌VMware为你分配的网络不好(比如它给你分了个192.168.148.0的网络ID),那么可以到 这里来修改:单击 VMware 的“Host菜单,选择“Virtual Network Settings .选择“Host Virtual Network Mapping中, VMnet1所在的虚拟网络,单击后边的按钮,选 择“Subnet菜单,即可以调整你的网络ID。我在这里调整的是VMnetl,那么VMnet8当然也可以用这样的方式来调整。.记住,在调整之后你的 VMware Network Adapter VMnetl和 VMware Network Adapter VMnet8也需要调整到相应的网络ID,不然Host和Guest如何通信呢?初学者在使用VMware的时候,总是喜欢直接修改VMware Network Adapter VMnet1和 VMware Network Adapter VMnet8这两块虚拟网卡的IP地址,以为把它们设置为与Host在 一个网段就可以实现通信和上网,实际上在看过这篇文章之后,应该明白,修改这两块虚拟网卡, 对于实现网络通信,是多么的没有帮助!
展开阅读全文
相关资源
相关搜索

最新文档


当前位置:首页 > 图纸设计 > 毕设全套


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!