保留子网范围内的专用IP地址

时间:2017-02-24 11:49:28

标签: azure azure-resource-manager subnet static-ip-address arm-template

我有一个带有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."

所以这不起作用...... wtf

有什么想法吗?非常感谢!

1 个答案:

答案 0 :(得分:3)

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

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

参考:also new to CSS3

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

相关问题