
我们希望使用 Microsoft Azure,并希望为客户提供虚拟机,同时拥有用于监控和 Active Directory 的后端。我们的网络将是这样的:
网络:10.0.0.0/23
子网:10.0.0.0/24(带监控的后端,...)
10.0.1.0/29 客户 1 网络(10.0.1.4 上的服务器 1 为客户 1)
10.0.1.8/29 网关 1(为客户 1)
10.0.1.16/29 客户 2 网络(10.0.1.12 上的服务器 2,用于客户 2)
10.0.1.24/29 网关 2(用于客户 2)
客户 1 将其路由器与网关 1 连接起来,这样他们就可以访问服务器 1 - 并且只能访问服务器 1。他们不允许直接访问服务器 2、网关 2 或后端网络。他们的服务器 1 是装有 Windows 的虚拟机,需要访问后端网络,但不能访问服务器 2 或网关 2。客户无法访问远程桌面,只能访问服务器 1 上的端口 443 和 5499。
因此问题是:
- 我可以将网关 1 绑定到客户 1 网络吗?
- 有没有什么方法可以限制客户之间的访问?
- 有没有提供使用 NAT 而不是通告内部网络的方法?
例如:Customer1 通过 VPN 连接到网关 1,仅获取互联网地址 (1.2.3.4),而不获取内部网络 10.0.1.0/29。因此,可以通过 1.2.3.4:443 和 1.2.3.4:5499 上的 VPN 访问 server1。
我发现的唯一与路线相关的内容是此网站:https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-udr-how-to/
但与限制访问/VPN 无关 :(
答案1
对于这样的细粒度限制,您需要创建网络安全组 (NSG)。所有配置都是通过 PowerShell 完成的,但如果你有使用控制台配置防火墙的经验,那么这些配置就不言自明了。
什么是网络安全组 (NSG)
https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-nsg/
基本上,您需要做的就是阻止所有内容,然后仅打开后端和网关之间的连接。
# Create NSG for Subnet1
New-AzureNetworkSecurityGroup -Name "myNSG1" -Location "East US"
# Deny entire Vnet
Get-AzureNetworkSecurityGroup -Name "myNSG1" | Set-AzureNetworkSecurityRule -Name "DENY VNET" -Type Inbound -Priority 1000 -Action Deny -SourceAddressPrefix 'VIRTUAL_NETWORK' -SourcePortRange '*' -DestinationAddressPrefix 'VIRTUAL_NETWORK' -DestinationPortRange '*' -Protocol *
# Allow Backend Vnet
Get-AzureNetworkSecurityGroup -Name "myNSG1" | Set-AzureNetworkSecurityRule -Name "ALLOW BACKEND" -Type Inbound -Priority 999 -Action Allow -SourceAddressPrefix '10.0.0.0/24' -SourcePortRange '*' -DestinationAddressPrefix 'VIRTUAL_NETWORK' -DestinationPortRange '*' -Protocol *
# Allow VMs in the same VNet to communicate
Get-AzureNetworkSecurityGroup -Name "myNSG1" | Set-AzureNetworkSecurityRule -Name "ALLOW SELF" -Type Inbound -Priority 998 -Action Allow -SourceAddressPrefix '10.0.1.0/29' -SourcePortRange '*' -DestinationAddressPrefix 'VIRTUAL_NETWORK' -DestinationPortRange '*' -Protocol *
# Allow Gateway
Get-AzureNetworkSecurityGroup -Name "myNSG1" | Set-AzureNetworkSecurityRule -Name "ALLOW GW" -Type Inbound -Priority 997 -Action Allow -SourceAddressPrefix '10.0.1.8/29' -SourcePortRange '*' -DestinationAddressPrefix 'VIRTUAL_NETWORK' -DestinationPortRange '*' -Protocol *
这只是入站连接。我没有测试这些规则,也没有根据您的场景完成设置,但应该可以让您知道从哪里开始。
您还需要将其应用于子网或一组虚拟机。对于子网:
Get-AzureNetworkSecurityGroup -Name "myNSG1" | Set-AzureNetworkSecurityGroupToSubnet -VirtualNetworkName 'myVnet' -SubnetName 'myVnetSubnet1'