Private IP address in reserved subnet range

筅森魡賤 提交于 2019-12-11 02:21:50

问题


I have an arm template that has a vNet with 2 subnets. I am trying to deploy a Nic to one of these with a static private IP address. It used to be dynamic, and it worked fine. Now it is static, I have set the IP I want the nic to have, but when I deploy, it says the IP is invalid. I tried changing the IP I set, but it still doesn't work...

Extracts from my template: (subnetPart is a parameterised number as we have several vnets that will be connected, but the subnets need to not clash)

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'))]"
          }
        }
      }
    ]
  }
}

Here is the error message:

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.",

Hmm ok, so it can't be in the subnet range as those addresses are reserved? Ok so I will change the last digit of the IP to 16, outside of the subnet range.

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."

So that doesn't work either...

Any ideas? Thanks very much!


回答1:


Azure reserves a few IP's from each subnet for routing purposes:

Yes. Azure reserves some IP addresses within each subnet. The first and last IP addresses of the subnets are reserved for protocol conformance, along with 3 more addresses used for Azure services.

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

So you would need to account for that when assigning IP's. So in your case you have 10.100.8-15, substract reserved ips - 10.100.11-14.



来源:https://stackoverflow.com/questions/42437906/private-ip-address-in-reserved-subnet-range

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!