gpt4 book ai didi

azure - 保留子网范围内的私有(private)IP地址

转载 作者:行者123 更新时间:2023-12-05 01:45:16 28 4
gpt4 key购买 nike

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

摘 self 的模板:(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."

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

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

最佳答案

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

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

引用:https://learn.microsoft.com/en-us/azure/virtual-network/virtual-networks-faq

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

关于azure - 保留子网范围内的私有(private)IP地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42437906/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com