虚拟网络中的出口计量Egress metering in a virtual network

适用于:Windows Server 2019Applies to: Windows Server 2019

云网络盈利的一个重要方面是能够按网络带宽的使用情况进行计费。A fundamental aspect of cloud networking monetization is being able to bill by network bandwidth utilization. 根据在给定计费周期内通过 Internet 移出数据中心的数据总量对出站数据收费。Outbound data is charged based on the total amount of data moving out of the data center via the Internet in a given billing cycle.

Windows Server 2019 中 SDN 网络流量的出口计量功能可以提供出站数据传输的使用情况计量。Egress metering for SDN network traffic in Windows Server 2019 enables the ability to offer usage meters for outbound data transfers. 离开每个虚拟网络的网络流量可以单独进行跟踪,使其可以从计费计算中排除。Network traffic that leaves each virtual network, but remains within the data center can by tracked separately so it can be excluded from billing calculations. 对于未包含在其中一个未开票地址范围内的目标 IP 地址绑定的数据包,将作为计费的出站数据传输进行跟踪。Packets bound for destination IP addresses that are not included in one of the unbilled address ranges are tracked as billed outbound data transfers.

虚拟网络未开票地址范围 (IP 范围的允许列表) Virtual network unbilled address ranges (allowlist of IP ranges)

可以在现有虚拟网络的 UnbilledAddressRanges 属性下找到未开票地址范围。You can find unbilled address ranges under the UnbilledAddressRanges property of an existing virtual Network. 默认情况下,不会添加任何地址范围。By default, there are no address ranges added.

import-module NetworkController
$uri = "https://sdn.contoso.com"

(Get-NetworkControllerVirtualNetwork -ConnectionURI $URI -ResourceId "VNet1").properties

输出如下所示:Your output will look similar to this:

 AddressSpace           : Microsoft.Windows.NetworkController.AddressSpace
 DhcpOptions            :
 UnbilledAddressRanges  :
 ConfigurationState     :
 ProvisioningState      : Succeeded
 Subnets                : {21e71701-9f59-4ee5-b798-2a9d8c2762f0, 5f4758ef-9f96-40ca-a389-35c414e996cc,
                      29fe67b8-6f7b-486c-973b-8b9b987ec8b3}
 VirtualNetworkPeerings :
 EncryptionCredential   :
 LogicalNetwork         : Microsoft.Windows.NetworkController.LogicalNetwork

示例:管理虚拟网络的未开票地址范围Example: Manage the unbilled address ranges of a virtual network

你可以通过设置虚拟网络的 UnbilledAddressRange 属性来管理从计费的出口计量中排除的 IP 子网前缀集。You can manage the set of IP subnet prefixes to exclude from billed egress metering by setting the UnbilledAddressRange property of a virtual network. 虚拟网络上的网络接口发送的任何流量与其中一个前缀相匹配的目标 IP 地址都不会包含在 BilledEgressBytes 属性中。Any traffic sent by network interfaces on the virtual network with a destination IP address that matches one of the prefixes will not be included in the BilledEgressBytes property.

  1. 更新 UnbilledAddressRanges 属性,使其包含不会进行访问计费的子网。Update the UnbilledAddressRanges property to contain the subnets that will not be billed for access.

    $vnet = Get-NetworkControllerVirtualNetwork -ConnectionUri $uri -ResourceID "VNet1"
    $vnet.Properties.UnbilledAddressRanges = "10.10.2.0/24,10.10.3.0/24"
    

    提示

    如果要添加多个 IP 子网,请在每个 IP 子网之间使用逗号。If adding multiple IP subnets, use a comma between each of the IP subnets. 不要包含逗号前后的任何空格。Do not include any spaces before or after the comma.

  2. 用修改后的 UnbilledAddressRanges 属性更新虚拟网络资源。Update the Virtual Network resource with the modified UnbilledAddressRanges property.

    New-NetworkControllerVirtualNetwork -ConnectionUri $uri -ResourceId "VNet1" -Properties $unbilled.Properties -PassInnerException
    

    输出如下所示:Your output will look similar to this:

       Confirm
       Performing the operation 'New-NetworkControllerVirtualNetwork' on entities of type
       'Microsoft.Windows.NetworkController.VirtualNetwork' via
       'https://sdn.contoso.com/networking/v3/virtualNetworks/VNet1'. Are you sure you want to continue?
       [Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): y
    
    
       Tags             :
       ResourceRef      : /virtualNetworks/VNet1
       InstanceId       : 29654b0b-9091-4bed-ab01-e172225dc02d
       Etag             : W/"6970d0a3-3444-41d7-bbe4-36327968d853"
       ResourceMetadata :
       ResourceId       : VNet1
       Properties       : Microsoft.Windows.NetworkController.VirtualNetworkProperties
    
  3. 检查虚拟网络以查看配置的 UnbilledAddressRangesCheck the Virtual Network to see the configured UnbilledAddressRanges.

    (Get-NetworkControllerVirtualNetwork -ConnectionUri $uri -ResourceID "VNet1").properties
    

    你的输出现在将如下所示:Your output will now look similar to this:

    AddressSpace           : Microsoft.Windows.NetworkController.AddressSpace
    DhcpOptions            :
    UnbilledAddressRanges  : 10.10.2.0/24,192.168.2.0/24
    ConfigurationState     :
    ProvisioningState      : Succeeded
    Subnets                : {21e71701-9f59-4ee5-b798-2a9d8c2762f0, 5f4758ef-9f96-40ca-a389-35c414e996cc,
                         29fe67b8-6f7b-486c-973b-8b9b987ec8b3}
    VirtualNetworkPeerings :
    EncryptionCredential   :
    LogicalNetwork         : Microsoft.Windows.NetworkController.LogicalNetwork
    

检查虚拟网络的未开票出口使用情况Check the billed the unbilled egress usage of a virtual network

配置 UnbilledAddressRanges 属性后,可以检查虚拟网络中每个子网的计费和未开票出口使用情况。After you configure the UnbilledAddressRanges property, you can check the billed and unbilled egress usage of each subnet within a virtual network. 出口流量将每四分钟更新一次,并提供计费和未开票范围的总字节数。Egress traffic updates every four minutes with the total bytes of the billed and unbilled ranges.

以下属性可用于每个虚拟子网:The following properties are available for each virtual subnet:

  • UnbilledEgressBytes 显示连接到此虚拟子网的网络接口发送的未开票字节数。UnbilledEgressBytes shows the number of unbilled bytes sent by network interfaces connected to this virtual subnet. 未开票 bytes 是发送到作为父虚拟网络 UnbilledAddressRanges 属性一部分的地址范围的字节数。Unbilled bytes are bytes sent to address ranges that are part of the UnbilledAddressRanges property of the parent virtual network.

  • BilledEgressBytes 显示连接到此虚拟子网的网络接口发送的计费字节数。BilledEgressBytes shows Number of billed bytes sent by network interfaces connected to this virtual subnet. 计费字节数是发送到不属于父虚拟网络的 UnbilledAddressRanges 属性的地址范围的字节数。Billed bytes are bytes sent to address ranges that are not part of the UnbilledAddressRanges property of the parent virtual network.

使用以下示例查询出口使用:Use the following example to query egress usage:

(Get-NetworkControllerVirtualNetwork -ConnectionURI $URI -ResourceId "VNet1").properties.subnets.properties | ft AddressPrefix,BilledEgressBytes,UnbilledEgressBytes

输出如下所示:Your output will look similar to this:

AddressPrefix BilledEgressBytes UnbilledEgressBytes
------------- ----------------- -------------------
10.0.255.8/29          16827067                   0
10.0.2.0/24           781733019                   0
10.0.4.0/24                   0                   0