在 Azure 中,我们使用负载平衡通过入站 NAT 规则将端口转发到我们的虚拟机。我们正在尝试为被动 FTP 端口设置端口转发,因此我们至少需要转发 100 个端口。在下图中,NAT 规则似乎只允许您一次转发一个端口。是否可以转发一系列端口?例如60000-62000
最佳答案
In the Image below, the NAT rules appear to only allow your to forward one port at a time. Is it possible to forward a range of ports?
目前不支持端口范围。
作为解决方法,我们可以使用 PowerShell 来更新此负载均衡器,并向其添加多个 NAT 规则。
$slb = Get-AzureRmLoadBalancer -Name NRPLB -ResourceGroupName NRP-RG
$slb | Add-AzureRmLoadBalancerInboundNatRuleConfig -Name ftp1 -FrontendIpConfiguration $slb.FrontendIpConfigurations[0] -FrontendPort 60000 -BackendPort 60000 -Protocol Tcp
$slb | Add-AzureRmLoadBalancerInboundNatRuleConfig -Name ftp2 -FrontendIpConfiguration $slb.FrontendIpConfigurations[0] -FrontendPort 60001 -BackendPort 60001 -Protocol Tcp
.
.
.
.
$slb | Add-AzureRmLoadBalancerInboundNatRuleConfig -Name ftp50 -FrontendIpConfiguration $slb.FrontendIpConfigurations[0] -FrontendPort 60050 -BackendPort 60050 -Protocol Tcp
$slb | Set-AzureRmLoadBalancer #save the new configure
当前负载均衡规则的限制是150,我们可以找到here 。
关于azure - Azure ARM 中负载均衡器的入站 NAT 规则,如何指定端口范围?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43615935/