使用單一網路介面卡的聚合型的 NIC 設定Converged NIC Configuration with a Single Network Adapter

適用於:Windows Server(以每年次管道)、Windows Server 2016Applies To: Windows Server (Semi-Annual Channel), Windows Server 2016

下列章節提供匯集 NIC 設定在您的 HYPER-V 主機單一 NIC 的指示操作。The following sections provide instructions for configuring Converged NIC with a single NIC in your Hyper-V host.

本指南範例設定描述兩個 HYPER-V 主機,HYPER-V 主機 A,以及HYPER-V 主機 BThe example configuration in this guide depicts two Hyper-V hosts, Hyper-V Host A, and Hyper-V Host B.

測試連接之間來源和目的地資訊Test Connectivity Between Source and Destination

本節測試連接之間來源和目的地 HYPER-V 主機時所需的步驟。This section provides the steps required to test connectivity between source and destination Hyper-V Hosts.

下圖描述兩個 HYPER-V 主機,HYPER-V 主機 AHYPER-V 主機 BThe following illustration depicts two Hyper-V Hosts, Hyper-V Host A and Hyper-V Host B.

這兩部伺服器已安裝的單一實體 NIC (pNIC) 和 Nic 連接到頂端架 (ToR) 實體切換。Both servers have a single physical NIC (pNIC) installed, and the NICs are connected to a top of rack (ToR) physical switch. 此外,伺服器位於上相同的子網路,也就是 192.168.1.x/24。In addition, the servers are located on the same subnet, which is 192.168.1.x/24.

HYPER-V 主機

測試 NIC 連接 Hyper\ HYPER-V Virtual 開關切換至Test NIC Connectivity to the Hyper-V Virtual Switch

您可以使用此步驟,來確保實體而的您稍後將會建立 Hyper\ HYPER-V Virtual 參數,可連接目的主機。By using this step, you can ensure that the physical NIC, for which you will later create a Hyper-V Virtual Switch, can connect to the destination host.

這項測試使用層級 3 (L3)-或 IP 層級-以及層級 2 (L2) 示範連接。This test demonstrates connectivity by using Layer 3 (L3) - or the IP layer - as well as Layer 2 (L2).

您可以使用下列 Windows PowerShell 命令,以取得的網路介面卡的屬性。You can use the following Windows PowerShell command to obtain the properties of the network adapter.

Get-NetAdapter

以下是此命令的範例結果。Following are example results of this command.

名稱Name InterfaceDescriptionInterfaceDescription ifIndexifIndex 狀態Status MacAddressMacAddress LinkSpeedLinkSpeed
M1M1 Mellanox ConnectX-3 Pro...Mellanox ConnectX-3 Pro ... 44 向上Up 7C-FE-90-93-8F-A17C-FE-90-93-8F-A1 40 Gbps40 Gbps

您可以使用其中一項下列命令,以取得額外的介面卡屬性,包括的 IP 位址。You can use one of the following commands to obtain additional adapter properties, including the IP address.

Get-NetAdapter M1 | fl *

以下是此命令的編輯的範例結果。Following are edited example results of this command.

MacAddress   : 7C-FE-90-93-8F-A1
Status   : Up
LinkSpeed: 40 Gbps
MediaType: 802.3
PhysicalMediaType: 802.3
AdminStatus  : Up
MediaConnectionState : Connected
DriverInformation: Driver Date 2016-08-28 Version 5.25.12665.0 NDIS 6.60
DriverFileName   : mlx4eth63.sys
NdisVersion  : 6.60
ifOperStatus : Up
ifAlias  : M1
InterfaceAlias   : M1
ifIndex  : 4
ifDesc   : Mellanox ConnectX-3 Pro Ethernet Adapter
ifName   : ethernet_32773
DriverVersion: 5.25.12665.0
LinkLayerAddress : 7C-FE-90-93-8F-A1
Caption  :
Description  :
ElementName  :
InstanceID   : {39B58B4C-8833-4ED2-A2FD-E105E7146D43}
CommunicationStatus  :
DetailedStatus   :
HealthState  :
InstallDate  :
Name : M1
OperatingStatus  :
OperationalStatus:
PrimaryStatus:
StatusDescriptions   :
AvailableRequestedStates :
EnabledDefault   : 2
EnabledState : 5
OtherEnabledState:
RequestedState   : 12
TimeOfLastStateChange:
TransitioningToState : 12
AdditionalAvailability   :
Availability :
CreationClassName: MSFT_NetAdapter

確保能通訊來源和目的地資訊Ensure that Source and Destination Can Communicate

您可以使用此步驟以確認雙向通訊 \ (ping 來源目的地和這兩個 systems\ 上反之亦然)。You can use this step to verify bi-directional communication (ping from source to destination and vice-versa on both systems). 下列範例中,測試-NetConnection使用 Windows PowerShell 命令時,但如果您想要您可以使用ping命令。In the following example, the Test-NetConnection Windows PowerShell command is used, but if you prefer you can use the ping command.

注意

如果您不確定您的主機可以彼此,您可以略過此步驟。If you're certain that your hosts can communicate with each other, you can skip this step.

Test-NetConnection 192.168.1.5

以下是此命令的範例結果。Following are example results of this command.

參數Parameter 值。Value
電腦名稱ComputerName 192.168.1.5192.168.1.5
RemoteAddressRemoteAddress 192.168.1.5192.168.1.5
InterfaceAliasInterfaceAlias M1M1
SourceAddressSourceAddress 192.168.1.3192.168.1.3
PingSucceededPingSucceeded 為 trueTrue
PingReplyDetails (RTT)PingReplyDetails (RTT) 0 ms0 ms

有時候,您可能需要使用進階安全性順利執行這項測試 Windows 防火牆停用。In some cases, you might need to disable Windows Firewall with Advanced Security to successfully perform this test. 如果防火牆停用,記住安全性,請確定您的設定符合您組織的安全性的需求。If you disable the firewall, keep security in mind and ensure that your configuration meets your organization's security requirements.

下列範例命令可讓您要停用所有防火牆設定檔。The following example command allows you to disable all firewall profiles.

Set-NetFirewallProfile -All -Enabled False

停用防火牆之後,您可以使用下列命令以測試連接。After you disable the firewall, you can use the following command to test the connection.

Test-NetConnection 192.168.1.5

以下是此命令的範例結果。Following are example results of this command.

參數Parameter 值。Value
電腦名稱ComputerName 192.168.1.5192.168.1.5
RemoteAddressRemoteAddress 192.168.1.5192.168.1.5
InterfaceAliasInterfaceAlias --1 測試 40 GTest-40G-1
SourceAddressSourceAddress 192.168.1.3192.168.1.3
PingSucceededPingSucceeded FalseFalse
PingReplyDetails (RTT)PingReplyDetails (RTT) 0 ms0 ms

設定 Vlan (Optional)Configure VLANs (Optional)

許多網路設定,請使用 Vlan。Many network configurations make use of VLANs. 如果您打算使用 Vlan 您網路中,您必須使用 Vlan 設定重複之前測試。If you are planning to use VLANs in your network, you must repeat the previous test with VLANs configured. \ (如果您打算 RoCE RDMA 服務使用您必須讓 Vlan。)(If you are planning to use RoCE for RDMA services you must enable VLANs.)

針對此步驟,Nic 可在存取模式。For this step, the NICs are in ACCESS mode. 但是當您在本文稍後建立 HYPER-V Virtual 切換 (vSwitch),VLAN 屬性會套用到 vSwitch 連接埠層級。However when you create a Hyper-V Virtual Switch (vSwitch) later in this guide, the VLAN properties are applied at the vSwitch port level.

切換可以主機多個 Vlan,因為它是所需的最上方的架 (ToR) 實體切換主機已連接到設定主幹模式中的連接埠。Because a switch can host multiple VLANs, it is necessary for the Top of Rack (ToR) physical switch to have the port that the host is connected to configured in Trunk mode.

注意

如需如何設定主幹模式開關切換至上的指示,請洽詢您 ToR 切換文件。Consult your ToR switch documentation for instructions on how to configure Trunk mode on the switch.

下圖描述兩個 HYPER-V 主機,每一個實體網路介面卡,與每個設定的 VLAN 101 使用。The following illustration depicts two Hyper-V hosts, each with one physical network adapter, and each configured to communicate on VLAN 101.

設定的區域網路

設定 VLAN IDConfigure the VLAN ID

您可以使用此步驟來設定 VLAN Id Nic 安裝在您的 HYPER-V 主機。You can use this step to configure the VLAN IDs for NICs installed in your Hyper-V hosts.

設定 NIC M1Configure NIC M1

使用下列命令,設定 VLAN ID 的第一個而 M1,然後檢視 [顯示設定。With the following commands, configure the VLAN ID for the first NIC, M1, then view the resulting configuration.

重要

無法執行此命令如果您連接至主機遠端透過這個介面,因為有這樣做,會導致的存取權限主機。Do not run this command if you are connected to the host remotely over this interface, because doing so will result in loss of access to the host.

Set-NetAdapterAdvancedProperty -Name M1 -RegistryKeyword VlanID -RegistryValue "101"
Get-NetAdapterAdvancedProperty -Name M1 | Where-Object {$_.RegistryKeyword -eq "VlanID"} 

以下是此命令的範例結果。Following are example results of this command.

名稱Name 顯示名稱DisplayName DisplayValueDisplayValue RegistryKeywordRegistryKeyword RegistryValueRegistryValue
M1M1 VLAN IDVLAN ID 101101 VlanIDVlanID {101}{101}

請確定該 VLAN ID 生效的網路介面卡實作獨立使用下列命令重新開機網路介面卡。Ensure that the VLAN ID takes effect independent of the network adapter implementation by using the following command to restart the network adapter.

Restart-NetAdapter -Name "M1"

您可以使用下列命令,以確保您的網路介面卡狀態的是再繼續。You can use the following command to ensure that the network adapter status is Up before proceeding.

Get-NetAdapter -Name "M1"

以下是此命令的範例結果。Following are example results of this command.

名稱Name InterfaceDescriptionInterfaceDescription ifIndexifIndex 狀態Status MacAddressMacAddress LinkSpeedLinkSpeed
M1M1 Mellanox ConnectX-3 Pro 乙太網路草原...Mellanox ConnectX-3 Pro Ethernet Ada... 44 向上Up 7C-FE-90-93-8F-A17C-FE-90-93-8F-A1 40 Gbps40 Gbps

請確定您在本機和目的地的伺服器上執行此步驟。Ensure that you perform this step on both the local and destination servers. 如果目的伺服器並未設定為 [本機伺服器相同的 VLAN ID,這兩個無法通訊。If the destination server is not configured with the same VLAN ID as the local server, the two cannot communicate.

請確認連接Verify Connectivity

您可以使用本節之後重新啟動網路介面卡,請確認連接。You can use this section to verify connectivity after the network adapters are restarted. 您可以確認連接之後申請這兩個介面卡的 VLAN 標記。You can confirm connectivity after applying the VLAN tag to both adapters. 如果連接失敗,您可以檢查 VLAN 設定或目的參與相同 VLAN 切換。If connectivity fails, you can inspect the switch VLAN configuration or destination participation in the same VLAN.

重要

您上一節中執行步驟後,可能需要幾秒鐘的裝置重新開機,並在網路上推出。After you perform the steps in the previous section, it might take several seconds for the device to restart and become available on the network.

請確認連接的 NIC 測試-40 G-1Verify connectivity for NIC Test-40G-1

請確認連接的第一個而,您可以執行下列命令。To verify connectivity for the first NIC, you can run the following command.

Test-NetConnection 192.168.1.5

設定資料中心橋接 (DCB)Configure Data Center Bridging (DCB)

下一個步驟是設定 DCB 和服務品質 (QoS),需要先安裝 Windows Server 2016 功能 DCB。The next step is to configure DCB and Quality of Service (QoS), which requires that you first install the Windows Server 2016 feature DCB.

注意

您必須是為了讓彼此所有伺服器上執行的所有下列 DCB 和 QoS 設定步驟。You must perform all of the following DCB and QoS configuration steps on all servers that are intended to communicate with each other.

安裝資料中心橋接 (DCB)Install Data Center Bridging (DCB)

您可以使用此步驟,安裝以及 DCB。You can use this step to install and enable DCB.

重要

  • 安裝和設定 DCB 是選擇性的 [網路設定中,使用 iWarp RDMA 服務。Installing and configuring DCB is optional for network configurations that use iWarp for RDMA services.
  • 安裝和設定 DCB 是需要的 [網路設定中,使用 RoCE (any version) RDMA 服務。Installing and configuring DCB is required for network configurations that use RoCE (any version) for RDMA services.

您可以在每個您的 HYPER-V 主機上安裝 DCB 使用下列命令。You can use the following command to install DCB on each of your Hyper-V hosts.

Install-WindowsFeature Data-Center-Bridging

設定 SMB 直接 QoS 原則Set the QoS policies for SMB-Direct

您可以使用下列命令來設定 SMB 直接 QoS 原則。You can use the following command to configure QoS policies for SMB Direct.

重要

  • 這個步驟可使用 iWarp 網路設定為選擇性。This step is optional for network configurations that use iWarp.
  • 需要的網路設定中,使用 RoCE 此步驟。This step is required for network configurations that use RoCE.
  • 以下的範例指令,在 [值] 3 [為任意。In the example command below, the value “3” is arbitrary. 只要您持續使用相同的整個 QoS 原則的設定值,您可以使用任何介於 1 與 7。You can use any value between 1 and 7 as long as you consistently use the same value throughout the configuration of QoS policies.
New-NetQosPolicy "SMB" -NetDirectPortMatchCondition 445 -PriorityValue8021Action 3

以下是此命令的範例結果。Following are example results of this command.

參數Parameter 值。Value
名稱Name SMBSMB
擁有者Owner 群組原則 (Machine)Group Policy (Machine)
NetworkProfileNetworkProfile 所有All
優先順序Precedence 127127
JobObjectJobObject  
NetDirectPortNetDirectPort 445445
PriorityValuePriorityValue 33

適用於 RoCE 部署打開 SMB 流量高優先順序傳送控制項For RoCE Deployments Turn on Priority Flow Control for SMB traffic

如果您使用 RoCE RDMA 服務,您可以使用下列命令,可讓 SMB 流量控制,並檢視結果。If you are using RoCE for your RDMA services, you can use the following commands to enable SMB flow control and to view the results. 高優先順序傳送控制需要 RoCE,但您使用 iWarp 時的非必要。Priority Flow Control is required for RoCE, but is unnecessary when you are using iWarp.

Enable-NetQosFlowControl -priority 3
Get-NetQosFlowControl

以下是範例結果的取得-NetQosFlowControl命令。Following are example results of the Get-NetQosFlowControl command.

高優先順序Priority 支援Enabled PolicySetPolicySet IfIndexIfIndex IfAliasIfAlias
00 FalseFalse 全球Global    
11 FalseFalse 全球Global    
22 FalseFalse 全球Global    
33 為 trueTrue 全球Global    
44 FalseFalse 全球Global    
55 FalseFalse 全球Global    
66 FalseFalse 全球Global    
77 FalseFalse 全球Global    

讓 QoS 本機和目的地的網路介面卡Enable QoS for the local and destination network adapters

這個步驟中,您可以讓 DCB 特定網路介面卡上。With this step you can enable DCB on specific network adapters.

重要

  • 這個步驟就不需要的網路設定中,使用 iWarp。This step is not needed for network configurations that use iWarp.
  • 需要的網路設定中,使用 RoCE 此步驟。This step is required for network configurations that use RoCE.

適用於 NIC M1 讓 QoSEnable QoS for NIC M1

您可以使用下列命令,讓 QoS 並檢視您的設定的結果。You can use the following commands to enable QoS and view the results of your configuration.

Enable-NetAdapterQos -InterfaceAlias "M1"
Get-NetAdapterQos -Name "M1"

以下是此命令的範例結果。Following are example results of this command.

名稱: M1支援: True功能:Name: M1 Enabled: True Capabilities:

參數Parameter 硬體Hardware 目前Current
MacSecBypassMacSecBypass NotSupportedNotSupported NotSupportedNotSupported
DcbxSupportDcbxSupport None None
NumTCs(Max/ETS/PFC)NumTCs(Max/ETS/PFC) 8/8/88/8/8 8/8/88/8/8

OperationalTrafficClasses:OperationalTrafficClasses:

TCTC TSATSA 頻寬Bandwidth 優先順序Priorities
00 ETSETS 70%70% 0-2,4-70-2,4-7
11 ETSETS 30%30% 33

OperationalFlowControl:優先順序 3 功能的OperationalClassifications:OperationalFlowControl: Priority 3 Enabled OperationalClassifications:

通訊協定Protocol 連接埠日類型Port/Type 高優先順序Priority
預設值Default   00
NetDirectNetDirect 445445 33

適用於 SMB 直接 (RDMA) 保留百分比的頻寬Reserve a percentage of the Bandwidth for SMB Direct (RDMA)

您可以使用下列命令來為 SMB 直接保留百分比的頻寬。You can use the following command to reserve a percentage of the bandwidth for SMB Direct.

在此範例中,使用 30%頻寬保留。In this example, a 30% bandwidth reservation is used. 您應該選取,表示您預期會要求您儲存的流量的值。You should select a value that represents what you expect your storage traffic will require. -bandwidthpercentage參數必須多 10%。The value of the -bandwidthpercentage parameter must be a multiple of 10%.

New-NetQosTrafficClass "SMB" -Priority 3 -BandwidthPercentage 30 -Algorithm ETS

以下是此命令的範例結果。Following are example results of this command.

名稱Name 演算法Algorithm Bandwidth(%)Bandwidth(%) 高優先順序Priority PolicySetPolicySet IfIndexIfIndex IfAliasIfAlias
SMBSMB ETSETS 3030 33 全球Global    

您可以使用下列命令,以檢視頻寬保留的資訊。You can use the following command to view bandwidth reservation information.

Get-NetQosTrafficClass

以下是此命令的範例結果。Following are example results of this command.

名稱Name 演算法Algorithm Bandwidth(%)Bandwidth(%) 高優先順序Priority PolicySetPolicySet IfIndexIfIndex IfAliasIfAlias
[預設值][Default] ETSETS 7070 0-2,4-70-2,4-7 全球Global    
SMBSMB ETSETS 3030 33 全球Global    

移除偵錯工具衝突 (Mellanox adapter only)Remove Debugger Conflict (Mellanox adapter only)

如果您使用介面卡 Mellanox 從您要執行此步驟進行偵錯工具。If you are using an adapter from Mellanox you need to perform this step to configure the debugger. 根據預設,使用 Mellanox 介面卡時,附加偵錯工具會封鎖 NetQos。By default, when a Mellanox adapter is used, the attached debugger blocks NetQos. 您可以使用下列命令,若要覆寫偵錯工具。You can use the following command to override the debugger.

Set-ItemProperty HKLM:"\SYSTEM\CurrentControlSet\Services\NDIS\Parameters" AllowFlowControlUnderDebugger -type DWORD -Value 1 –Force

測試 RDMA(原生主機)Test RDMA (Native host)

您可以使用此步驟,以確保建立 vSwitch 和轉換為 RDMA (Converged NIC) 之前 fabric 已正確設定。You can use this step to ensure that the fabric is correctly configured prior to creating a vSwitch and transitioning to RDMA (Converged NIC).

下圖描述目前 HYPER-V 主機的狀態。The following illustration depicts the current state of the Hyper-V hosts.

測試 RDMA

若要確認 RDMA 設定,您可以執行下列命令。To verify the RDMA configuration, you can run the following command.

Get-NetAdapterRdma

以下是此命令的範例結果。Following are example results of this command.

名稱Name InterfaceDescriptionInterfaceDescription 支援Enabled
M1M1 Mellanox ConnectX-3 Pro 乙太網路卡Mellanox ConnectX-3 Pro Ethernet Adapter 為 trueTrue

下載 DiskSpd.exe 和 PowerShell 指令碼Download DiskSpd.exe and a PowerShell Script

若要繼續時,您必須先下載下列項目。To continue, you must first download the following items.

判斷您的目標介面卡的 ifIndex 值Determine the ifIndex value of your target adapter

您可以使用下列命令來探索 ifIndex 目標介面卡的值。You can use the following command to discover the ifIndex value of the target adapter. 您已下載的指令碼執行時,您可以使用此值後續步驟。You can use this value in subsequent steps when you are running the script you've downloaded.

Get-NetIPConfiguration -InterfaceAlias "M*" | ft InterfaceAlias,InterfaceIndex,IPv4Address

以下是此命令的範例結果。Following are example results of this command.

InterfaceAliasInterfaceAlias InterfaceIndexInterfaceIndex IPv4AddressIPv4Address
M2M2 1414 {192.168.1.5}{192.168.1.5}

執行 PowerShell 指令碼Run the PowerShell script

當您執行的 Windows PowerShell 指令碼 Test-Rdma.ps1 時,您可以傳送 ifIndex 值指令碼,以及遠端相同的 VLAN 上介面卡的 IP 位址。When you run the Test-Rdma.ps1 Windows PowerShell script, you can pass the ifIndex value to the script, along with the IP address of the remote adapter on the same VLAN.

您可以使用下列命令範例為 14 ifIndex 指令碼執行的網路介面卡 192.168.1.5。You can use the following example command to run the script with an ifIndex of 14 on the network adapter 192.168.1.5.

C:\TEST\Test-RDMA.PS1 -IfIndex 14 -IsRoCE $true -RemoteIpAddress 192.168.1.5 -PathToDiskspd C:\TEST\Diskspd-v2.0.17\amd64fre\

VERBOSE: Diskspd.exe found at C:\TEST\Diskspd-v2.0.17\amd64fre\\diskspd.exe
VERBOSE: The adapter M2 is a physical adapter
VERBOSE: Underlying adapter is RoCE. Checking if QoS/DCB/PFC is configured on each physical adapter(s)
VERBOSE: QoS/DCB/PFC configuration is correct.
VERBOSE: RDMA configuration is correct.
VERBOSE: Checking if remote IP address, 192.168.1.5, is reachable.
VERBOSE: Remote IP 192.168.1.5 is reachable.
VERBOSE: Disabling RDMA on adapters that are not part of this test. RDMA will be enabled on them later.
VERBOSE: Testing RDMA traffic now for. Traffic will be sent in a parallel job. Job details:
VERBOSE: 0 RDMA bytes written per second
VERBOSE: 0 RDMA bytes sent per second
VERBOSE: 662979201 RDMA bytes written per second
VERBOSE: 37561021 RDMA bytes sent per second
VERBOSE: 1023098948 RDMA bytes written per second
VERBOSE: 8901349 RDMA bytes sent per second
VERBOSE: Enabling RDMA on adapters that are not part of this test. RDMA was disabled on them prior to sending RDMA traffic.
VERBOSE: RDMA traffic test SUCCESSFUL: RDMA traffic was sent to 192.168.1.5

注意

如果 RDMA 流量失敗,RoCE 案例具體而言,洽詢您 ToR 切換設定適當的必須符合的主機設定 PFC 日 ETS 設定。If the RDMA traffic fails, for the RoCE case specifically, consult your ToR Switch configuration for proper PFC/ETS settings that should match the Host settings. 請參考 QoS 參考值本文件。Refer to the QoS section in this document for reference values.

移除存取 VLAN 設定Remove the Access VLAN setting

建立 HYPER-V 開關切換至準備您必須移除您安裝上方的 VLAN 設定。In preparation for creating the Hyper-V switch you must remove the VLAN settings you installed above. 您可以使用下列命令來移除實體 NIC 存取 VLAN 設定You can use the following command to remove the ACCESS VLAN Setting from the physical NIC. 這個動作會防止自動標記輸出資料傳輸與不正確的 VLAN ID,而,並也會防止它篩選輸入流量不符合存取 VLAN id。This action prevents the NIC from auto-tagging the egress traffic with the incorrect VLAN ID, and also prevents it from filtering ingress traffic that doesn’t match the ACCESS VLAN ID.

Set-NetAdapterAdvancedProperty -Name M1 -RegistryKeyword VlanID -RegistryValue "0"

您可以使用下列命令的範例,確認 VlanID 設定,並檢視結果,顯示的 VLAN ID 值為零。You can use the following example command to confirm the VlanID setting and view the results, which show that the VLAN ID value is zero.

Get-NetAdapterAdvancedProperty -name m1 | Where-Object {$_.RegistryKeyword -eq 'VlanID'} 

建立 HYPER-V Virtual 開關切換至Create a Hyper-V Virtual Switch

建立 HYPER-V Virtual 切換 (vSwitch) 在您的 HYPER-V 主機上,您可以使用此一節。You can use this section to create a Hyper-V Virtual Switch (vSwitch) on your Hyper-V hosts.

下圖與 vSwitch 描述 HYPER-V 主機 1。The following illustration depicts Hyper-V Host 1 with a vSwitch.

建立 HYPER-V Virtual 開關切換至

建立 HYPER-V Virtual 切換外部Create an External Hyper-V Virtual Switch

您可以使用本節外部 vSwitch 建立 HYPER-V HYPER-V 主機消失。You can use this section to create an external vSwitch in Hyper-V on Hyper-V Host A.

您可以使用下列範例命令,以建立名稱為 VMSTEST 切換。You can use the following example command to create a switch named VMSTEST.

注意

參數AllowManagementOS下列命令中建立主機但 vNIC 繼承的 MAC 地址和實體 NIC IP 位址The parameter AllowManagementOS in the following command creates a Host vNIC that inherits the MAC address and IP address of the physical NIC.

New-VMSwitch -Name VMSTEST -NetAdapterName "M1" -AllowManagementOS $true

以下是此命令的範例結果。Following are example results of this command.

名稱Name SwitchTypeSwitchType NetAdapterInterfaceDescriptionNetAdapterInterfaceDescription
VMSTESTVMSTEST 外部External Mellanox ConnectX-3 Pro 乙太網路卡Mellanox ConnectX-3 Pro Ethernet Adapter

您可以使用下列命令,以檢視網路介面卡的屬性。You can use the following command to view the properties of the network adapter.

Get-NetAdapter | ft -AutoSize

以下是此命令的範例結果。Following are example results of this command.

名稱Name InterfaceDescriptionInterfaceDescription ifIndexifIndex 狀態Status MacAddressMacAddress LinkSpeedLinkSpeed
vEthernet (VMSTEST)vEthernet (VMSTEST) HYPER-V Virtual 乙太網路卡 #2Hyper-V Virtual Ethernet Adapter #2 2727 向上Up E4-1D-2D-07-40-71E4-1D-2D-07-40-71 40 Gbps40 Gbps

您可以管理主機但 vNIC 兩種方式。You can manage a Host vNIC in two ways. 其中一個方法是NetAdapter檢視中,它的運作方式根據」vEthernet (VMSTEST)」的名稱。One method is the NetAdapter view, which operates based upon the "vEthernet (VMSTEST)" name.

其他方法是VMNetworkAdapter檢視中,會捨棄」vEthernet「前置詞,只要使用 vmswitch 名稱。The other method is the VMNetworkAdapter view, which drops the "vEthernet" prefix and simply uses the vmswitch name.

VMNetworkAdapter檢視中,會顯示不會顯示的一些網路介面卡屬性NetAdapter命令。The VMNetworkAdapter view displays some network adapter properties that are not displayed with the NetAdapter command.

您可以使用下列命令,以檢視的VMNetworkAdapter方法。You can use the following command to view the results of the VMNetworkAdapter method.

Get-VMNetworkAdapter –ManagementOS | ft -AutoSize

以下是此命令的範例結果。Following are example results of this command.

名稱Name IsManagementOsIsManagementOs VMNameVMName SwitchNameSwitchName MacAddressMacAddress 狀態Status IPAddressesIPAddresses
CORP-外部開關切換至CORP-External-Switch 為 trueTrue CORP-外部開關切換至CORP-External-Switch 001B785768AA001B785768AA {確定}{Ok}  
VMSTESTVMSTEST 為 trueTrue VMSTESTVMSTEST E41D2D074071E41D2D074071 {確定}{Ok}  

測試連接Test the connection

您可以使用下列命令範例測試連接和檢視結果。You can use the following example command to test the connection and view the results.

Test-NetConnection 192.168.1.5

ComputerName   : 192.168.1.5
RemoteAddress  : 192.168.1.5
InterfaceAlias : vEthernet (CORP-External-Switch)
SourceAddress  : 192.168.1.3
PingSucceeded  : True
PingReplyDetails (RTT) : 0 ms

您可以使用下列命令範例指派,以及檢視網路介面卡 VLAN 設定。You can use the following example commands to assign and view network adapter VLAN settings.

Set-VMNetworkAdapterVlan -VMNetworkAdapterName "VMSTEST" -VlanId "101" -Access -ManagementOS
Get-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "VMSTEST"
VMNameVMName VMNetworkAdapterNameVMNetworkAdapterName 模式Mode VlanListVlanList
  VMSTESTVMSTEST 存取Access 101101

測試連接Test the connection

重新叫用,可能需要變更完成之前您成功可以 ping 到另一個介面卡幾秒鐘。Recall that the change may take a few seconds to complete before you can successfully ping the other adapter.

您可以使用下列命令範例測試連接和檢視結果。You can use the following example command to test the connection and view the results.

Test-NetConnection 192.168.1.5

ComputerName   : 192.168.1.5
RemoteAddress  : 192.168.1.5
InterfaceAlias : vEthernet (VMSTEST)
SourceAddress  : 192.168.1.3
PingSucceeded  : True
PingReplyDetails (RTT) : 0 ms

測試 HYPER-V Virtual 切換 RDMA(2 模式)Test Hyper-V Virtual Switch RDMA (Mode 2)

下圖描述您的 HYPER-V 主機,包括 HYPER-V 主機 1 vSwitch 目前狀態。The following illustration depicts the current state of your Hyper-V hosts, including the vSwitch on Hyper-V Host 1.

測試 HYPER-V Virtual 開關切換至

在主機但 vNIC 標記設定優先順序Set Priority tagging on the Host vNIC

您可以使用下列命令範例設定優先順序主機但 vNIC 上標記,並檢視您的動作的結果。You can use the following example commands to set priority tagging on the Host vNIC and view the results of your actions.

Set-VMNetworkAdapter -ManagementOS -Name "VMSTEST" -IeeePriorityTag on
Get-VMNetworkAdapter -ManagementOS -Name "VMSTEST" | fl Name,IeeePriorityTag

Name: VMSTEST
IeeePriorityTag : On

若要檢視 RDMA 資訊的網路介面卡,您可以使用下列命令範例。You can use the following example command to view network adapter RDMA information. 在結果中,當參數啟用的值\ [false],表示該 RDMA 不支援。In the results, when the parameter Enabled has the value False, it means that RDMA is not enabled.

Get-NetAdapterRdma
名稱Name InterfaceDescriptionInterfaceDescription 支援Enabled
vEthernet (VMSTEST)vEthernet (VMSTEST) HYPER-V Virtual 乙太網路卡 #2Hyper-V Virtual Ethernet Adapter #2 FalseFalse

在主機但 vNIC 讓 RDMAEnable RDMA on the Host vNIC

若要檢視網路介面卡屬性,讓 RDMA 介面卡,然後檢視 [網路介面卡 RDMA 資訊,您可以使用下列命令範例。You can use the following example commands to view network adapter properties, enable RDMA for the adapter, and then view the network adapter RDMA information.

Get-NetAdapter
名稱Name InterfaceDescriptionInterfaceDescription ifIndexifIndex 狀態Status MacAddressMacAddress LinkSpeedLinkSpeed
vEthernet (VMSTEST)vEthernet (VMSTEST) HYPER-V Virtual 乙太網路卡 #2Hyper-V Virtual Ethernet Adapter #2 2727 向上Up E4-1D-2D-07-40-71E4-1D-2D-07-40-71 40 Gbps40 Gbps
Enable-NetAdapterRdma -Name "vEthernet (VMSTEST)"
Get-NetAdapterRdma -Name "vEthernet (VMSTEST)"

在下列結果中,當參數啟用的值為 True,表示可以 RDMA。In the following results, when the parameter Enabled has the value True, it means that RDMA is enabled.

名稱Name InterfaceDescriptionInterfaceDescription 支援Enabled
vEthernet (VMSTEST)vEthernet (VMSTEST) HYPER-V Virtual 乙太網路卡 #2Hyper-V Virtual Ethernet Adapter #2 為 trueTrue
Get-NetAdapter 
名稱Name InterfaceDescriptionInterfaceDescription ifIndexifIndex 狀態Status MacAddressMacAddress LinkSpeedLinkSpeed
vEthernet (VMSTEST)vEthernet (VMSTEST) HYPER-V Virtual 乙太網路卡 #2Hyper-V Virtual Ethernet Adapter #2 2727 向上Up E4-1D-2D-07-40-71E4-1D-2D-07-40-71 40 Gbps40 Gbps

使用指令碼執行 RDMA 流量測試Perform RDMA traffic test by using the script

您可以使用下列命令來執行您下載的指令碼,並檢視結果。You can use the following command to run the script you downloaded and view the results.

C:\TEST\Test-RDMA.PS1 -IfIndex 27 -IsRoCE $true -RemoteIpAddress 192.168.1.5 -PathToDiskspd C:\TEST\Diskspd-v2.0.17\amd64fre\
VERBOSE: Diskspd.exe found at C:\TEST\Diskspd-v2.0.17\amd64fre\\diskspd.exe
VERBOSE: The adapter vEthernet (VMSTEST) is a virtual adapter
VERBOSE: Retrieving vSwitch bound to the virtual adapter
VERBOSE: Found vSwitch: VMSTEST
VERBOSE: Found the following physical adapter(s) bound to vSwitch: TEST-40G-1
VERBOSE: Underlying adapter is RoCE. Checking if QoS/DCB/PFC is configured on each physical adapter(s)
VERBOSE: QoS/DCB/PFC configuration is correct.
VERBOSE: RDMA configuration is correct.
VERBOSE: Checking if remote IP address, 192.168.1.5, is reachable.
VERBOSE: Remote IP 192.168.1.5 is reachable.
VERBOSE: Disabling RDMA on adapters that are not part of this test. RDMA will be enabled on them later.
VERBOSE: Testing RDMA traffic now for. Traffic will be sent in a parallel job. Job details:
VERBOSE: 0 RDMA bytes written per second
VERBOSE: 0 RDMA bytes sent per second
VERBOSE: 0 RDMA bytes written per second
VERBOSE: 0 RDMA bytes sent per second
VERBOSE: 0 RDMA bytes written per second
VERBOSE: 0 RDMA bytes sent per second
VERBOSE: 0 RDMA bytes written per second
VERBOSE: 9162492 RDMA bytes sent per second
VERBOSE: 938797258 RDMA bytes written per second
VERBOSE: 34621865 RDMA bytes sent per second
VERBOSE: 933572610 RDMA bytes written per second
VERBOSE: 35035861 RDMA bytes sent per second
VERBOSE: Enabling RDMA on adapters that are not part of this test. RDMA was disabled on them prior to sending RDMA traffic.
VERBOSE: RDMA traffic test SUCCESSFUL: RDMA traffic was sent to 192.168.1.5

最後一列在此輸出中,「RDMA 流量測試成功:RDMA 流量已傳送至 192.168.1.5,「示範,您已成功在您的介面卡設定匯集 NIC。The final line in this output, "RDMA traffic test SUCCESSFUL: RDMA traffic was sent to 192.168.1.5," demonstrates that you have successfully configured Converged NIC on your adapter.

本指南所有主題All topics in this guide

本指南包含下列主題。This guide contains the following topics.