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