保留的公共 IPv4 地址
Equinix Metal™ 支持订购额外的公共 IPv4 子网,以便您可以为每台服务器分配更多公共 IPv4 地址,或轻松地在服务器之间移动公共 IPv4 地址。这些子网在项目级别进行配置和使用,因此可以取消分配并重新分配给项目中的其他服务器。
公共 IPv4 地址也在特定的城市中配置,并且可以与同一城市中的任何服务器一起使用。
您可以订购从 /31 到 /24 的子网大小。
| Public IPv4 Subnet Size | Usable Addresses |
|---|---|
| /31 | 2 IPv4 addresses |
| /30 | 4 IPv4 addresses |
| /29 | 8 IPv4 addresses |
| /28 | 16 IPv4 addresses |
| /27 | 32 IPv4 Addresses |
| /26 | 64 IPv4 Addresses |
| /25 | 128 IPv4 Addresses |
| /24 | 256 IPv4 Addresses |
预留公共 IPv4 地址按使用量计费,每 IP 每小时固定费率。带宽按标准出站费率计费。费率可在Equinix Metal控制台中查看。
注意:一个项目默认最多可拥有 256 个公网 IPv4 地址。如有任何疑问或预计需要更多 IP 地址,请联系客服。
请求公共 IPv4 地址
- Console
- CLI
- API
在项目的“网络”部分,打开“IP地址”页面。您项目当前的IP地址应该会列出来。要申请其他IP地址,请点击**+ 添加新地址**。

从“请求 IP 地址”滑出菜单中,选择预留子网的“位置”和“数量”(大小)。此外,还有“标签”和“描述”字段供您使用。“自定义 JSON”字段用于输入您希望包含在服务器元数据中的自定义数据。
请使用“备注”栏提供与您的请求相关的任何信息,以便联系支持团队。如果您计划申请多个子网或多个大型子网,尤其需要注意,因为项目层面存在配额限制。支持团队可能会就您的请求与您联系。
要请求公共 IPv4 地址,请使用 metal ip request 命令,并将 --type 指定为 public_ipv4。
metal ip request --project-id <project_id> --type public_ipv4 --quantity <int>
您可以选择使用 --comments 标志联系支持团队,提供与您的请求相关的任何信息。如果您计划申请多个子网或多个大型子网,这一点尤为重要,因为项目层面存在配额限制。支持团队可能会就您的请求与您联系并提出问题。
要请求 API 中的其他 IP 地址,请向 /projects/{id}/ips 端点发送 POST 请求。
curl -X POST \
-H 'Content-Type: application/json' \
-H "X-Auth-Token: <API_TOKEN>" \
"https://api.equinix.com/metal/v1/projects/{id}/ips" \
-d '{
"type": "public_ipv4",
"quantity": 4,
"metro": "sv",
"fail_on_approval_required": "false"
}'
身体参数
"type"(required) - Your options are"public_ipv4"or"global_ipv4"."quantity"(required) - The quantity parameter should be the number of IPs in the subnet. Valid values are2,4,8, and16for Public IPv4 addresses and1,2, and4for Global Anycast IP addresses."metro"- The metro is required when requesting a public IPv4 address and specifies where the IP addresses will be allocated. If you are requesting a Global Anycast IP address, the metro is not required."fail_on_approval_required"(optional) - If you submit a request that exceeds the maximum number of IP addresses available to your project, you can automatically have the request fail with HTTP status 422 instead of triggering the review process by providing thefail_on_approval_requiredparameter set totruein the request.
完整的 body 参数字段和选项列表可在 API 参考 中找到。
使用预留的公共 IPv4 子网进行配置
如果您在已经具有公共 IPv4 保留子网的项目和大都市中配置新服务器,则可以在新服务器上使用这些子网的 IP 地址。
- Console
- API
在配置过程中,在“可选设置”下,单击“配置 IP 地址”。选择“从子网部署”,然后选择要分配给服务器的子网和 IP 地址数量。

如果您使用 API 来配置服务器,请将 "ip_address" 对象包含在发送到 projects/{id}/devices 端点的 POST 请求正文中。
curl -X POST \
-H "Content-Type: application/json" \
-H "X-Auth-Token: <API_TOKEN>" \
"https://api.equinix.com/metal/v1/projects/{id}/devices" \
-d '{
"plan": "c3.small.x86",
"operating_system": "ubuntu_20_10",
"metro": "sv",
"hostname": "reserved_ip_testing",
"ip_addresses": [
{
"type": "public_ipv4",
"address_family": 4,
"public": true,
"cidr": <subnet_size>,
"ip_reservations": ["<ip_reservation_uuid>"]
},
{
"type": "private_ipv4",
"address_family": 4,
"public": false
},
{
"type": "public_ipv6",
"address_family: 6,
"public": true
}
]
}'
身体参数
"metro"(required) - Location of the server and the IP reservation."plan"(required) - Server hardware plan slug."operating_system"(required) - The server's operating system slug."ip_addresses"(optional) - The object that specifies the IP address configuration of your server. To provision with your reserved subnet, modify the"type": "public_ipv4"data to include the subnet size and the UUID of the reserved subnet.
在 API 参考 中可以找到配置服务器时正文参数字段和选项的完整列表。
请记住,操作系统具有最小子网大小要求。
- Linux 发行版 -
/31 - Windows Server -
/30 - VMware ESXi -
/29
向服务器添加公有 IPv4 地址
如果您想将新的公共 IPv4 地址或子网添加到现有服务器,您有两种选择:将新的 IP 地址静态分配给服务器,作为 弹性 IP,或者通过 BGP 通告它们。
如果您选择将 IP 静态绑定为弹性 IP,则可以将单个地址和整个子网绑定到单个设备。
如果您选择使用 BGP 公布您的 IP 或子网,则需要设置和配置 本地 BGP。
删除 IPv4 预留
删除预留会将子网从您的项目中移除。您将无法再将 IP 地址用于您的服务器。
- Console
- CLI
- API
要从您的项目中删除预留,请打开 IPs 页面,选择要删除的 IP 预留,然后单击 删除。

要删除公共 IPv4 地址保留,请使用 metal ip remove 命令。
metal ip remove --id <reservation-id>
要通过 API 删除 IP 地址预留,请向 /ips/{id} 端点发送 DELETE 请求。id 是预留地址的 UUID。
curl -X DELETE -H "Content-Type: application/json" \
-H "X-Auth-Token: <API_TOKEN>" \
"https://api.equinix.com/metal/v1/ips/{id}"