1 安装vmware workstation 9.0.2 for linux, 可参考:http://www.iyunv.com/Linux/2012-10/73141.htm
2 用vmware创建一个虚机用于安装windows 2012 server, 给了16G的硬盘空间, 并在此启用hyper-v角色。网络为vmware的NAT模式。
2.1 因为是在虚拟机上又虚拟化,所以确保vmware虚拟机setting选项中的processors启用了Virtualize intel VT-x/EPT or ADM-V/RVT和Virtualize cpu performance counters这两个选项, 参见:http://hi.baidu.com/cjp19882009/item/a72f743636b42880f4e4ad6e 或http://communities.vmware.com/docs/DOC-8970/
2.2 再修改配置文件/run/media/hua/E/vmwareimage/WindowsServer2012/WindowsServer2012.vmx,添加下面两行。
hypervisor.cpuid.v0 = "FALSE"
mce.enable = "TRUE"
2.3 最后,关闭windows server 2012的防火墙。
2.4 在hyper-v管理器中创建一网桥br-int, 它报错:The virtual machine's operating system has attempted to enable promiscuous mode on adapter Ethernet0. This is not allowed for security reasons. Please go to the Web page "http://vmware.com/info?id=161" for help enabling promiscuousmode in the virtual machine.
所以需要人工将网卡vmnet8(NAT模式使用的是vmnet8)设置为混杂模式,因为vmnet8网卡是由root用户安装的,而vmware workstation是通过普通用户hua启动的。对于不使用udev而直接用/dev的linux的改动如下:
http://blog.martinshouse.com/2011/05/vmware-on-linux-promiscuous-mode.html
[hua@zhanghua WindowsServer2012]$ sudo groupadd vmwaregroup
[hua@zhanghua WindowsServer2012]$ sudo usermod -a -G vmwaregroup hua
[hua@zhanghua WindowsServer2012]$ id hua
uid=1000(hua) gid=1000(hua) groups=1000(hua),1001(libvirtd),1002(vmwaregroup)
[hua@zhanghua WindowsServer2012]$ sudo chgrp vmwaregroup /dev/vmnet8
[hua@zhanghua WindowsServer2012]$ sudo chmod g+rw /dev/vmnet8
[hua@zhanghua WindowsServer2012]$ ll /dev/vmnet8
crw-rw---- 1 root vmwaregroup 119, 8 Mar 20 09:49 /dev/vmnet8
[hua@zhanghua WindowsServer2012]$ sudo chmod a+rw /dev/vmnet8
[hua@zhanghua WindowsServer2012]$ ll /dev/vmnet8
crw-rw-rw- 1 root vmwaregroup 119, 8 Mar 20 09:49 /dev/vmnet8
sudo service vmware restart
上述方法在系统重启后会消失,A more permanent fix is to edit /etc/init.d/vmware on the Host, by adding the lines in red:
# Start the virtual ethernet kernel service
vmwareStartVmnet() {
vmwareLoadModule $vnet
"$BINDIR"/vmware-networks --start >> $VNETLIB_LOG 2>&1
chgrp vmwaregroup /dev/vmnet*
chmod a+rw /dev/vmnet*
这里老外有个建议,说是最好用bridge,而不是nat, 如下:
you'll be able to boot your Guest VM, and use Wireshark or whatever in the Guest. Just Remember! Your VM Guest's Network Adapter must be set to BRIDGED (connected directly to the physical network), not NAT (used to share the host's IP address).
2.5 关于vmware中的vlan
vmware中的vlan有三种方式, 可参见Vmware ESX Server 3 802.1Q解决方案:http://wenku.baidu.com/view/90b76687ec3a87c24028c4b9.html
1, VGT 即在虚机里就打了标签, 将端口组的vlan_id属性设为4095(相当于端口组就设为TRUCK了), 并且在虚拟机中运行802.1Q VLAN trunking驱动。
2,EST 在外部交换机打标签, 默认行为,端口组的vlan_id属性为0,相当于disable掉了端口组的tag功能 。
3,VST 在vmware的虚拟交换机上打标签, vmware用了端口组的概念,所以想定义一个vlan的话就要定义一个端口组,在端口组的vlan_id属性设值(1-4094)。然后虚机和端口组关联。
To configure a VLAN on the portgroup using the VMware Infrastructure/vSphere Client:
Click the ESXi/ESX host.
Click the Configuration tab.
Click the Networking link.
Click Properties.
Click the virtual switch / portgroups in the Ports tab and click Edit.
Click the General tab.
Assign a VLAN number in VLAN ID (optional).
Click the NIC Teaming tab.
From the Load Balancing dropdown, choose Route based on originating virtual port ID.
Verify that there is at least one network adapter listed under Active Adapters.
Verify the VST configuration using the ping command to confirm the connection between the ESXi/ESX host and the gateway interfaces and another host on the same VLAN.
Note: For additional information on VLAN configuration of a VirtualSwitch (vSwitch) port group, see Configuring a VLAN on a portgroup (1003825).
To configure via the command line:
esxcfg-vswitch -p "portgroup_name" -v VLAN_ID virtual_switch_name
参见文章:Sample configuration of virtual switch VLAN tagging (VST Mode) (1004074)
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1004074
所以想要把esx设置为trunk模式的话(VGT),需要做两件事:
1)配置一个端口组, vlan_id关联为4095, 步骤如上。
2) 这种VGT模式还需要特定的虚机网卡驱动 ( 802.1Q VLAN trunking driver is required inside the virtual machine. )
见: Sample configuration of virtual machine (VM) VLAN Tagging (VGT Mode) in ESX (1004252)
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1004252
3)将物理网卡配置成混杂模式promisc, 步骤是:
Log into the ESXi/ESX host or vCenter Server using the vSphere Client.
Select the ESXi/ESX host in the inventory.
Click the Configuration tab.
In the Hardware section, click Networking.
Click Properties of the virtual switch for which you want to enable promiscuous mode.
Select the virtual switch or portgroup you wish to modify and click Edit.
Click the Security tab.
From the Promiscuous Mode dropdown menu, click Accept.