一、深入理解Vmware Server常用的网络类型: 

    首先介绍VMware 的几个虚拟设备: 

 VMnet0:这是VMware 用于虚拟桥接网络下的虚拟交换机; 
 VMnet1:这是VMware 用于虚拟Host-Only 网络下的虚拟交换机; 
 VMnet8:这是VMware 用于虚拟NAT 网络下的虚拟交换机; 
 VMware Network Adapter VMnet1:这是Host 用于与Host-Only 虚拟网络进行通信的虚拟网卡; 
 VMware Network Adapter VMnet8:这是Host 用于与NAT 虚拟网络进行通信的虚拟网卡; 

    1. 桥接网络 

    桥接网络是网络连接的一种类型,其中虚拟机显示为和主机在同一个物理以太网上的一台额外的计算机。说得更专业一些,虚拟机通过一个虚拟网络适配器(在它的配置中,它连接到主机上的一块以太网卡)直接连接到以太网。如果在你的 PC 上有一块以太网卡并且在一个局域网(LAN)上,你可以使用这种网络类型。 一台桥接的虚拟机可以透明地使用它被桥接到的网络上的任何可用服务: 
打印机、文件服务器网关以及其他服务。同样,当一台虚拟机被桥接后,配置使用桥接网络的任何物理主机或者其他虚拟机可以使用该虚拟机上的资源。如果使用桥接网络,你的虚拟机需要在网络上有它自己的身份。例如,在一个 TCP/IP 网络上,虚拟机需要有它自己的 IP 地址。你的网络管理员会告诉你虚拟机的 IP 地址是否可用以及在客户操作系统中你应该使用什么网络设置。一般来说,你的客户操作系统可以从一台动态主机配置协议(DHCP)服务器上自动获取一个 IP 地址和其他网络细节,如果不是这样,你可能需要在客户操作系统中手动设置 IP 地址和其他细节。说明: 如果你的主机安装了一个无线 NIC,你不能使用桥接网络。如果你希望在一台使用无线 NIC 的主机上运行虚拟机,你需要配置你的虚拟机使用 NAT。图5是桥接网络拓扑图。 

图5桥接网络拓扑图 

    要设置一台虚拟机使用桥接网络,你需要按照下面这些步骤进行: 
    添加一个虚拟网络适配器 到你的虚拟机,它连接到桥接(VMnet0)网络。 
    为虚拟网络适配器配置操作系统支持,然后要么为它指定一个固定的网络地址,要么使用 DHCP 或者 BOOTP 激活使用动态地址分配。 
    打开虚拟机。 

    2. 仅主机网络。

    仅为主机网络是一种网络连接的类型,其中虚拟机通过虚拟私有网络连接到你的 PC 上的主机操作系统。所有配置为使用仅为主机网络的虚拟机通过一个虚拟网络适配器或者对于主机操作系统可见的 交换机 连接到该私有网络。尽管也可以使用其它通讯协议,在这个虚拟私有网络上的所有成员典型地使用 TCP/IP 协议。正常情况下,虚拟私有网络在主机以外不可见,如果你需要建立一个隔离的虚拟网络,这非常有用;例如,一个隔离的虚拟网络可以用于测试网络
软件。仅为主机网络允许你的虚拟机互相通讯以及和主机通讯,即使在你的 PC 中并没有一块网卡。 必须为主机的虚拟私有网络上的每一台虚拟机指定一个唯一的网络地址。一台使用仅为主机网络的虚拟机可以从运行在主机上的 VMware Workstation DHCP 服务器上动态获取它的网络地址。否则,你可以指定一个静态的网络地址到虚拟机。在这两种情况下,没有必要联系你的网络管理员。图6是仅主机网络拓扑图。 

图6仅主机网络拓扑图 

    要设置一台虚拟机使用仅为主机网络,你需要按照下面这些步骤进行: 
    添加一个虚拟网络适配器 到你的虚拟机,它连接到仅为主机(VMnet1)网络。 
    为虚拟网络适配器配置操作系统支持,然后为它指一个固定的网络地址,或者使用 DHCP 或 BOOTP.启用动态地址分配。>>有关指定网络地址的更多信息 
    打开虚拟机。 
    说明:对于仅为主机网络,如果不使用一台代理服务器,虚拟机 不能 与主机以外的任何系统通讯。>>有关使用一台代理服务器的更多信息 

    3. 网络地址翻译(NAT)。

    NAT 为虚拟机通过到主机的几乎任何可用的网络连接类型使用大多数客户端应用程序提供一种简单的方式。唯一的要求是网络连接必须支持 TCP/IP。 当你拥有一个有限的 IP 地址供应或者通过一个非以太网络适配器连接到网络时,NAT 非常有用。NAT 通过将在一个私有 VMnet 网络中的虚拟机的地址翻译为主机的地址进行工作。当一台虚拟机发送一个访问网络资源的请求时,对于网络资源而言,这个请求好像来自主机。 NAT 使用主机自身的网络资源连接到外部网络。这样,主机可以访问到的任何 TCP/IP 网络资源通过 NAT 连接应该可用。 NAT 主要的优点在于,它为虚拟机获得对于网络资源的访问提供一种透明的、容易配置的方式。图7是NAT网络拓扑图。 

图7NAT网络拓扑图 

    要设置一台虚拟机使用 NAT 网络,你需要按照下面这些步骤进行: 
    添加一个虚拟网络适配器 到你的虚拟机,它连接到 NAT 网络。 
    为虚拟网络适配器配置操作系统支持,为它指一个固定的网络地址,或者使用 DHCP 或 BOOTP.启用动态地址分配。 
    打开虚拟机。 

    4. 用于虚拟私有网络的网络地址 

    无论你正在使用仅为主机、网络地址翻译(NAT)还是桥接网络,必须为每一台虚拟机分配一个 IP 地址。对于仅为主机网络,也必须为主机分配一个 IP 地址。注意,对于每一个虚拟私有网络,使用显示在下表中的规范将可用的 IP 地址分割为几个部分,其中 <net> 是分配给你的仅为主机或者 NAT 网络的网络数字。VMware sever 总是为仅为主机和 NAT 网络使用一个 C 类地址。如下表。 

    上面这里我们详细介绍Vmware Server常用的网络类型,后边将要使用。
二、开始为Linux 服务器安装Vmware Server 

    安装程序会提问一些问题,并同时给出缺省的答案。 

    1. 切换到超级用户权限 

    $ su - 
    Password: 
    [root@localhost root]# cd vmware-server-distrib 

    2. 开始安装 

    #./vmware-install.pl 

    3. 选择二进制文件安装路径 

     # Creating a new installer database using the tar3 format. 
    Installing the content of the package. 
    In which directory do you want to install the binary files? 
    [/usr/bin] 
    What is the directory that contains the init directories (rc0.d to rc6.d)? 
    [/etc/rc.d] #选择初始化目录安装路径 
    What is the directory that contains the init scripts? 
    [/etc/rc.d/init.d] #选择初始化脚本文件安装路径 
    In which directory do you want to install the daemon files? 
    [/usr/sbin] 
    In which directory do you want to install the library files? 
    [/usr/lib/vmware] 

    4. 选择相关文件安装路径

    #The path “/usr/lib/vmware” does not exist currently. This program is going to 
    create it, including needed parent directories. Is this what you want? 
    [yes] 
    In which directory do you want to install the manual files? 
    [/usr/share/man] #选择操作手册页面文件安装路径 
    In which directory do you want to install the documentation files? 
    [/usr/share/doc/vmware] #选择文档文件安装路径 

    5. 安装结束 

    #The path “/usr/share/doc/vmware” does not exist currently. This program is going 
    to create it, including needed parent directories. Is this what you want? 
    [yes] 
    The main install is now complete and you should see something similar to what follows: 
    The installation of VMware Server <build number> for Linux competed successfully. 
    You can decide to remove this software from your system at any time by invoking thefollowing command:     “/usr/bin/vmware-uninstall.pl”. #安装结束 

    6. 启动vmware 配置 

    # Before running VMware Server for the first time, you need to configure it by 
    invoking the following command: “/usr/bin/vmware-config.pl”. Do you want this 
    program to invoke the command for you now? [yes] 
    此时系统会自动关闭现有的Vmware服务守护进程,如图 8 。 

图8 系统会自动关闭现有的Vmware服务守护进程 

    7. 选择图标文件安装路径 

    In which directory do you want to install the mime type icons? 
    [/usr/share/icons] 
    What directory contains your desktop menu entry files? These files have a .desktop 
    file extension. [/usr/share/applications] 
    In which directory do you want to install the application’s icon? 
    [/usr/share/pixmaps] 

    8. 阅读接受终端用户许可协议 

    Do you accept? (yes/no) yes #接受许可协议 

    9. 安装相关模块

    Trying to find a suitable vmmon module for your running kernel. 
    The module bld-2.6.9-5.EL-i686-RHEL4 loads perfectly in the running kernel. 
    Trying to find a suitable vmmon module for your running kernel. 
    None of the pre-built vmmon modules for VMware Server is suitable for your running 
    kernel. Do you want this program to try to build the vmmon module for your system 
    (you need to have a C compiler installed on your system)? [yes] #安装虚拟网络模块 

    10. 配置网络 

    Do you want networking for your virtual machines? (yes/no/help) [yes] yes 
 选择网络接口名称 

    Your computer has multiple Ethernet network interfaces available: eth0, eth1. 
    Which one do you want to bridge to vmnet0? [eth0] 
 配置vmnet0 
    The following bridged networks have been defined: 
.     vmnet0 is bridged to eth0 
    Do you wish to configure another bridged network? (yes/no) [no] 
 配置vmnet8 
    Configuring a NAT network for vmnet8. 
    Do you want this program to probe for an unused private subnet? (yes/no/help) [yes] 
 探测DHCP 子网,自动探测,随机选择 
    Probing for an unused private subnet (this can take some time)... 
    The subnet 172.16.127.0/255.255.255.0 appears to be unused. 
    The following NAT networks have been defined: 
.   vmnet8 is a NAT network on private subnet 172.16.127.0. 
    Do you wish to configure another NAT network? (yes/no) [no] 
 配置host-only 网络环境 
    Do you want to be able to use host-only networking in your virtual machines? 
    [yes] 
    Configuring a host-only network for vmnet1. 
    Do you want this program to probe for an unused private subnet? (yes/no/help) [yes] 
    Probing for an unused private subnet (this can take some time)... 
    The subnet 172.16.183.0/255.255.255.0 appears to be unused. 
    The following host-only networks have been defined: 
  . vmnet1 is a host-only network on private subnet 172.16.183.0. 
    Do you wish to configure another host-only network? (yes/no) [no] 

    11. 安装内核模块 

    Trying to find a suitable vmnet module for your running kernel. 
    The module bld-2.6.9-5.EL-i686-RHEL4 loads perfectly in the running kernel. 
    The module loads perfectly in the running kernel. 

    12. 选择远程服务端口 

    Please specify a port for remote console connections to use. [902] 

    13. 建立perl脚本文件 

    Building the VMware VmPerl Scripting API. 
    Using compiler “/usr/bin/gcc”. Use environment variable CC to override. 
    Installing the VMware VmPerl Scripting API. 
    The installation of the VMware VmPerl Scripting API succeeded. 

    14. 生成SSL证书文件 

    Generating SSL Server Certificate 
    In which directory do you want to keep your virtual machine files? 
   [/var/lib/vmware/Virtual Machines] 

    15. 输入注册时获得的20位产品序列号如图9. 。 

图9 输入注册时获得的20位产品序列号 

    16.如果配置过程和序列号正确,系统会完成配置并且启动Vmware
服务器。如图10 。 

图10 Vmware Server配置成功界面 

    17. 系统会自动在系统工具菜单建立一个:“Vmware Service Console”服务控制台的子选项。如图 11 。 

图11 系统工具中的Vmware Service Console 
三、安装 VMware Server Management Interface on Linux
    安装好此软件包后,可以通过浏覽器(以加密SSL方式)控制机器(可以进行重启,关机等操作,默认使用8333端口)。安装程序会提问一些问题,并同时给出缺省的答案。 

    1. 切换到超级用户权限 

    $ su - 
    Password: 
    [root@localhost root]# cd vmware-server-distrib 

    2. 开始安装 

    #wget http://download3.vmware.com/software/vmserver/VMware-mui-1.0.2-39867.tar.gz 
    #tar VMware-mui-1.0.2-39867.tar.gz ;cd /tmp/vmware-mui-distrib 
    #./vmware-install.pl 

    3. 阅读接受终端用户许可协议 

    Do you accept? (yes/no) yes #接受许可协议 

    4. 选择二进制文件安装路径 

    # In which directory do you want to install the binary files? 
    [/usr/bin] 
    What is the directory that contains the init directories (rc0.d/ to rc6.d/)? 
    [/etc/rc.d] #选择初始化目录安装路径 
    What is the directory that contains the init scripts? 
    [/etc/rc.d/init.d] #选择初始化脚本文件安装路径 
    In which directory do you want to install the VMware Management Interface files? 
    [/usr/lib/vmware-mui] 
    The path “/usr/lib/vmware-mui” does not exist currently. This program is going tocreate it, including needed parentdirectories. Is this what you want? [yes] 
    In which directory would you like to install the documentation files? 
    [/usr/lib/vmware-mui/doc] #选择文档文件安装路径 
    The path “/usr/lib/vmware-mui/doc” does not exist currently. This program is going 
    to create it, including needed parent directories. Is this what you want? [yes] 

    5.设置vmware-config-mui.pl配置文件 

    Before running VMware Management Interface for the first time, you need to 
    configure it by invoking the following command: 
    “/usr/bin/vmware-config-mui.pl”. Do you want this program to invoke the command 
    for you now? [yes] 

    6. 设置最大闲置时间单位分种 

    Set the number of minutes before an http session times out. (This is the length 
    of time before someone connecting to VMware Management Interface will be logged 
    out) [60] 

    7.安装成功

    如果系统设定成功会出现图12 界面。 


12 VMware Server Management Interface设定成功界面