在C#中检索Azure VM的Azure负载平衡器NAT端口 [英] Retrieve Azure load balancer NAT port for Azure VM in C#
问题描述
我在Azure VM规模集(VMSS)前面有一个Azure负载平衡器.我还在负载均衡器上配置了一个NAT池,如下所示:
I have an Azure Load Balancer in front of a Azure VM Scale Set (VMSS). I also have a NAT pool configured on the Load Balancer like the following:
{
"name": "InstanceInputEndpointNatPool",
"properties": {
"backendPort": 10000,
"frontendIPConfiguration": {
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancers_01_name')), '/frontendIPConfigurations/LoadBalancerIPConfig')]"
},
"frontendPortRangeStart": 10100,
"frontendPortRangeEnd": 10500,
"protocol": "Tcp"
}
}
{
"name": "InstanceInputEndpointNatPool",
"properties": {
"backendPort": 10000,
"frontendIPConfiguration": {
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancers_01_name')), '/frontendIPConfigurations/LoadBalancerIPConfig')]"
},
"frontendPortRangeStart": 10100,
"frontendPortRangeEnd": 10500,
"protocol": "Tcp"
}
}
本质上,对于VMSS中的每个VM,负载平衡器会将在DNSName:PORT(10100-10500之间)收到的请求转发到其中一个VM:10000(后端端口相同).
Essentially, for each VM in the VMSS, the load balancer forwards a request received at DNSName:PORT(between 10100-10500) to one of the VMs:10000(same backend port).
是否可以通过C#以编程方式检索在该VM上运行的程序分配给该VM的PORT?这将帮助我直接定位该VM端口.
Is it possible to retrieve the PORT assigned to this VM, programmatically in C#, for a program running on that VM? This would help me directly target that VM port.
推荐答案
您可以参考 GitHub链接.
这篇关于在C#中检索Azure VM的Azure负载平衡器NAT端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!