3

我有一个带有 2 个子网的 vNet 的 arm 模板。我正在尝试使用静态私有 IP 地址将 Nic 部署到其中一个。它曾经是动态的,并且运行良好。现在它是静态的,我已经设置了我希望网卡拥有的 IP,但是当我部署时,它说 IP 无效。我尝试更改我设置的IP,但它仍然不起作用......

从我的模板中提取:(subnetPart 是一个参数化的数字,因为我们有几个要连接的 vnet,但子网不需要冲突)

variables
"virtualNetworkRange": "[concat('10.', parameters('subnetPart'), '.10.0/26')]",
"ssrsSubnetRange": "[concat('10.', parameters('subnetPart'), '.10.8/29')]",
"ssrsPrivateIP": "[concat('10.', parameters('subnetPart'), '.10.10')]",

resources
{
  "name": "[variables('ExternalServicesVNET')]",
  "type": "Microsoft.Network/virtualNetworks",
  "location": "[resourceGroup().location]",
  "apiVersion": "2015-05-01-preview",
  "properties": {
    "addressSpace": {
      "addressPrefixes": [
        "[variables('virtualNetworkRange')]"
      ]
    },
    "subnets": [
      {
        "name": "[variables('jumpSubnetName')]",
        "properties": {
          "addressPrefix": "[variables('jumpSubnetRange')]"
        }

      },
      {
        "name": "[variables('ssrsSubnetName')]",
        "properties": {
          "addressPrefix": "[variables('ssrsSubnetRange')]"
        }

      }
    ]
  }
},
{
  "name": "[variables('SSRSvmNicName')]",
  "type": "Microsoft.Network/networkInterfaces",
  "location": "[resourceGroup().location]",
  "apiVersion": "2015-06-15",
  "dependsOn": [
    "[concat('Microsoft.Network/virtualNetworks/', variables('ExternalServicesVNET'))]"
  ],
  "tags": {
    "displayName": "SSRSvmNic"
  },
  "properties": {
    "ipConfigurations": [
      {
        "name": "ipconfig1",
        "properties": {
          "privateIPAllocationMethod": "Static",
          "privateIPAddress": "[variables('ssrsPrivateIP')]",
          "subnet": {
            "id": "[variables('ssrsSubnetRef')]"
          },
          "networkSecurityGroup": {
            "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]"
          }
        }
      }
    ]
  }
}

这是错误消息:

Resource Microsoft.Network/networkInterfaces 'hub2e40SsrsNic' failed with message '{
"error": {
 "code": "PrivateIPAddressInReservedRange",
 "message": "Private static IP address 10.100.10.10 falls within reserved IP range of subnet prefix 10.100.10.8/29.",

嗯好的,所以它不能在子网范围内,因为这些地址是保留的?好的,所以我将 IP 的最后一位更改为 16,超出子网范围。

Resource Microsoft.Network/networkInterfaces 'hub2e40SsrsNic' failed with message '{
  "error": {
    "code": "PrivateIPAddressNotInSubnet",
    "message": "Private static IP address 10.100.10.16 does not belong to the range of subnet prefix 10.100.10.8/29."

所以这也行不通...

有任何想法吗?非常感谢!

4

1 回答 1

5

Azure 为每个子网保留一些 IP 用于路由目的:

是的。Azure 在每个子网中保留一些 IP 地址。子网的第一个和最后一个 IP 地址保留用于协议一致性,另外还有 3 个地址用于 Azure 服务。

参考:https ://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-faq

因此,您在分配 IP 时需要考虑到这一点。因此,在您的情况下,您有 10.100.8-15,减去保留的 ips - 10.100.11-14。

于 2017-02-24T12:06:49.573 回答