A tool to enable VMQ in windows 2008 R2 machine.
2010-01-04 15:26
375 查看
什么是VMQ:
全称为Virtual Machine Queue,虚拟机队列 (VMQ)。是Windows 2008 R2提供的一个网络优化功能。支持 VMQ 功能的网络适配器能够为各个虚拟网络适配器创建唯一的网络队列,然后将队列直接连接到虚拟机的内存。此连接可以将数据包直接从系统管理程序发送到虚拟机,跳过虚拟化堆栈中的多个处理。不过因为目前只有Intel才能提供支持VMQ的硬件,所以默认也是禁用的。
VMQ Tool:
Code logic:
1. Find the VMQ capable NICs.
2. Register some info.
3. Disable/enable VMQ capable NICs.
Find the VMQ capable NICs:
// Find the NIC with device name "Intel(R) Gigabit ET Dual Port*"
// It's hard code here, in my machine, the NICs support VMQ all with name like "Intel(R) Gigabit ET Dual Port".Should
// you got any better method to find the VMQ capable NICs, please share with me.
string nicString = " select * from win32_networkadapter where (name like '%Intel(R) Gigabit ET Dual Port%') and (NetConnectionStatus =2) ";
ManagementObjectSearcher mos = new ManagementObjectSearcher(nicString);
ManagementObjectCollection moc = mos.Get();
Register some info.---------关键部分,通过写注册表来启用VMQ.
private
static void RegInfo()
{
RegistryKey hkml = Registry.LocalMachine;
RegistryKey system = hkml.OpenSubKey("SYSTEM", true);
RegistryKey currentControlSet = system.OpenSubKey("CurrentControlSet", true);
RegistryKey services = currentControlSet.OpenSubKey("services", true);
RegistryKey VMSMP = services.OpenSubKey("VMSMP", true);
RegistryKey Parameters = VMSMP.OpenSubKey("Parameters", true);
Parameters.SetValue(
"BelowTenGigVmqEnabled", "00000001", RegistryValueKind.DWord);
Parameters.SetValue(
"10GigVmqEnabled", "00000001", RegistryValueKind.DWord);
RegistryKey Control = currentControlSet.OpenSubKey("Control", true);
RegistryKey Class = Control.OpenSubKey("Class", true);
RegistryKey deviceID = Class.OpenSubKey("{4D36E972-E325-11CE-BFC1-08002BE10318}", true);
foreach (string index in indexList)
{
RegistryKey indexid = deviceID.OpenSubKey(index, true);
indexid.SetValue(
"*VMQLookaheadSplit", 1);
indexid.SetValue(
"*VMQVlanFiltering", 1);
indexid.SetValue(
"*VMQ", 1);
}
}
Disable/enable VMQ capable NICs:
//Diable NIC:
ManagementObject network
network.InvokeMethod(
"Disable", null);
// Enable NIC:
ManagementObject
network
network.InvokeMethod(
"Enable", null);
下载VMQTool
工具使用时,请用最高管理员账户打开cmd运行。
关于源码,其实关键部分都已经包含在文章中。如果还需要全部源码,请留下email,仅供学习之用。
全称为Virtual Machine Queue,虚拟机队列 (VMQ)。是Windows 2008 R2提供的一个网络优化功能。支持 VMQ 功能的网络适配器能够为各个虚拟网络适配器创建唯一的网络队列,然后将队列直接连接到虚拟机的内存。此连接可以将数据包直接从系统管理程序发送到虚拟机,跳过虚拟化堆栈中的多个处理。不过因为目前只有Intel才能提供支持VMQ的硬件,所以默认也是禁用的。
VMQ Tool:
Code logic:
1. Find the VMQ capable NICs.
2. Register some info.
3. Disable/enable VMQ capable NICs.
Find the VMQ capable NICs:
// Find the NIC with device name "Intel(R) Gigabit ET Dual Port*"
// It's hard code here, in my machine, the NICs support VMQ all with name like "Intel(R) Gigabit ET Dual Port".Should
// you got any better method to find the VMQ capable NICs, please share with me.
string nicString = " select * from win32_networkadapter where (name like '%Intel(R) Gigabit ET Dual Port%') and (NetConnectionStatus =2) ";
ManagementObjectSearcher mos = new ManagementObjectSearcher(nicString);
ManagementObjectCollection moc = mos.Get();
Register some info.---------关键部分,通过写注册表来启用VMQ.
private
static void RegInfo()
{
RegistryKey hkml = Registry.LocalMachine;
RegistryKey system = hkml.OpenSubKey("SYSTEM", true);
RegistryKey currentControlSet = system.OpenSubKey("CurrentControlSet", true);
RegistryKey services = currentControlSet.OpenSubKey("services", true);
RegistryKey VMSMP = services.OpenSubKey("VMSMP", true);
RegistryKey Parameters = VMSMP.OpenSubKey("Parameters", true);
Parameters.SetValue(
"BelowTenGigVmqEnabled", "00000001", RegistryValueKind.DWord);
Parameters.SetValue(
"10GigVmqEnabled", "00000001", RegistryValueKind.DWord);
RegistryKey Control = currentControlSet.OpenSubKey("Control", true);
RegistryKey Class = Control.OpenSubKey("Class", true);
RegistryKey deviceID = Class.OpenSubKey("{4D36E972-E325-11CE-BFC1-08002BE10318}", true);
foreach (string index in indexList)
{
RegistryKey indexid = deviceID.OpenSubKey(index, true);
indexid.SetValue(
"*VMQLookaheadSplit", 1);
indexid.SetValue(
"*VMQVlanFiltering", 1);
indexid.SetValue(
"*VMQ", 1);
}
}
Disable/enable VMQ capable NICs:
//Diable NIC:
ManagementObject network
network.InvokeMethod(
"Disable", null);
// Enable NIC:
ManagementObject
network
network.InvokeMethod(
"Enable", null);
下载VMQTool
工具使用时,请用最高管理员账户打开cmd运行。
关于源码,其实关键部分都已经包含在文章中。如果还需要全部源码,请留下email,仅供学习之用。
相关文章推荐
- How to enable Hibernate option in windows 2008 R2 server?
- How to enable javascript in windows server 2008 R2 enterprise
- How to set up Hyper-V virtual machine in Windows 2012R2
- Windows 2008 R2上安装Visual Studio 2008:you must use the role management tool to install configure .net
- Server 2008 R2: “You must use the Role Management Tool to install or configure Microsoft .NET”
- Setup Microsoft Windows 2008 R2 Failover Cluster in VMware Workstation
- How to Enable Concurrent Sessions for Remote Desktop in Windows 7 RTM
- [zz]How to disable the password complexity in Windows Server 2008?
- Windows下启动eclipse出现JRE or JDK must be available in order to run Eclipse.No Java virtual machine was
- How to enable BitLocker on Windows Server 2012 R2
- How to use ntrights.exe tool to assign user right in windows server env
- Enable Ping in Windows 2008 server
- How to Enable or Disable Hibernate in Windows 7
- How to install an SSH Server in Windows Server 2008
- How to enable ping response in windows 7?
- To enable integrated Windows authentication in Windows Vista/IIS 7
- How to configure FTP Adapter based on IIS7.5 on a WINDOWS 2008 R2 OS
- Strong Authentication with One-Time Passwords in Windows 7 and Windows Server 2008 R2
- How To Configure NTP On Windows 2008 R2 (zt)
- How to install an SSH Server in Windows Server 2008