0

我正在使用azure的新资源管理器安装程序与几个虚拟机,我试图找到将多个IP关联到单个虚拟机的最佳方法。多个公有IP到Azure虚拟机

我读过几篇不同的文章,ILPIP(实例级公共IP),负载平衡池和多个NIC。

我不确定最佳选择。我的虚拟机已经设置和配置,所以我不想再次通过加载新虚拟机来启用某些功能(有些人提到多个虚拟机仅适用于新虚拟机)。

我查看了Load Balanced解决方案,但它似乎从新的管理门户中缺失。您可以查看您的负载均衡器,但不能添加新的负载均衡器(如果它们仍可用)。

我需要每个虚拟机多个IP地址,因为我们的网站具有SSL,由于较早的浏览器限制,无法通过SNI提供SSL。

我很茫然,因为大多数文章都提到老的设置而不是资源管理器方法。

如果任何人有一个坚实的方式来执行此操作,我将不胜感激任何帮助。

回答

2

在ARM(Azure资源管理器)模型中,实现具有不同公有IP的多个SSL站点的最佳方式是通过负载平衡器。

  • 创建负载平衡器,其中一个backendpool,多个前端IP配置(每一个为公共-IP),多发性LB规则(每一个为公共IP:443 - > backendpool :)。
  • 将所有虚拟机的网卡配置为后端池的一部分。一个网卡就够了,不需要多网卡。

请注意,您可以create a load-balancer through Powershell, Azure CLI or ARM templates。目前,门户支持不可用。

另请参阅此sample template with multiple public IPs on a load-balancer

相关命令(从上面的Azure的官方文档的链接)的PowerShell来实现这一目标:

 
# Two public IP addresses 
$publicIP1 = New-AzureRmPublicIpAddress -Name PublicIp1 -ResourceGroupName NRP-RG -Location "West US" –AllocationMethod Static -DomainNameLabel loadbalancernrp 
$publicIP2 = New-AzureRmPublicIpAddress -Name PublicIp2 -ResourceGroupName NRP-RG -Location "West US" –AllocationMethod Static -DomainNameLabel loadbalancernrp 

# Two frontend IP configurations 
$frontendIP1 = New-AzureRmLoadBalancerFrontendIpConfig -Name LB-Frontend1 -PublicIpAddress $publicIP1 
$frontendIP2 = New-AzureRmLoadBalancerFrontendIpConfig -Name LB-Frontend2 -PublicIpAddress $publicIP2 

# One backend pool. 
# Note that Name parameter value 
$beaddresspool= New-AzureRmLoadBalancerBackendAddressPoolConfig -Name "LB-backend" 

# Two LB rules 
# Note that backend port is 444 for the second rule. 
$lbrule1 = New-AzureRmLoadBalancerRuleConfig -Name "HTTPS1" -FrontendIpConfiguration $frontendIP1 -BackendAddressPool $beAddressPool -Probe $healthProbe -Protocol Tcp -FrontendPort 443 -BackendPort 443 
$lbrule2 = New-AzureRmLoadBalancerRuleConfig -Name "HTTPS2" -FrontendIpConfiguration $frontendIP2 -BackendAddressPool $beAddressPool -Probe $healthProbe -Protocol Tcp -FrontendPort 443 -BackendPort 444 

# Two NICs 
# Use the specific backendpool referenced in the LB rules 
$backendnic1 = New-AzureRmNetworkInterface -Name lb-nic1-be -ResourceGroupName NRP-RG -Location "West US" -Subnet $backendSubnet -LoadBalancerBackendAddressPool $beaddresspool 
$backendnic2 = New-AzureRmNetworkInterface -Name lb-nic2-be -ResourceGroupName NRP-RG -Location "West US" -Subnet $backendSubnet -LoadBalancerBackendAddressPool $beaddresspool 
0

如果已经设置了负载平衡器,你可以添加一个公网IP和前端IP配置到您现有的负载平衡器与以下PowerShell:

$IPName = "PublicIp2" 
#domain name lable must be lower case 
$DomainName = "public2" 
$frontendConfigName = "LB-" + $DomainName 

$slb = get-AzureRmLoadBalancer -Name my-web-loadbalancer -ResourceGroupName RGN01 
$publicIP2 = New-AzureRmPublicIpAddress -Name $IPName -ResourceGroupName RGN01 -Location "West Europe" –AllocationMethod Static -DomainNameLabel $DomainName 
$frontendIP2 = New-AzureRmLoadBalancerFrontendIpConfig -Name $frontendConfigName -PublicIpAddress $publicIP2 
$slb | Add-AzureRmLoadBalancerFrontendIpConfig -PublicIpAddress $publicIP2 -Name $frontendConfigName 
$slb | Set-AzureRmLoadBalancer 

$HTTPSName = $DomainName + "HTTPS" 
$HTTPName = $DomainName + "HTTP" 
$healthProbe = $slb.Probes[0] 

#You need to get a backend port that's not being used. Use #Get-AzureRmLoadBalancerRuleConfig -LoadBalancer $slb to see the config rules that are currently on the load balancer 
#don't use 445 - it's used by Active directory 
#You need to open the ports you've chosen on your webservers firewalls 
$slb | Add-AzureRmLoadBalancerRuleConfig -Name $HTTPSName -FrontendIpConfiguration $frontendIP2 -BackendAddressPool $slb.BackendAddressPools[0] -Probe $healthProbe -Protocol Tcp -FrontendPort 443 -BackendPort 446 
$slb | Set-AzureRmLoadBalancer 
$slb | Add-AzureRmLoadBalancerRuleConfig -Name $HTTPName -FrontendIpConfiguration $frontendIP2 -BackendAddressPool $slb.BackendAddressPools[0] -Probe $healthProbe -Protocol Tcp -FrontendPort 80 -BackendPort 82 
$slb | Set-AzureRmLoadBalancer