Use the Bare Metal Cloud (BMC) API to connect a server to an existing private or public network, or remove it from a network.
All API requests in this guide are relative to:
https://api.phoenixnap.com/bmc/v1Code language: HTTP (http)
Prerequisites
BMC API access token with the bmc scope (see API credentials).
Note
Connecting the server to a private or public network does not automatically configure all network settings inside the operating system. Depending on your configuration, you may need to set the IP address, subnet mask, gateway, routes, and other parameters manually.
Add a Server to a Private or Public Network
When adding a server to a network, take the following considerations into account:
- Location. The server and network must be in the same location.
- Server status. You can add a network while the server is powered on, powered off, or rebooting.
- Configuration. Network assignment configures connectivity at the data-center level. Operating system configuration may still be required.
- IP address validity. When assigning IP addresses manually, ensure they are valid for the network and not reserved or already in use. Check the IP address requirements before continuing.
- Advanced configuration. For public or private IPv4 connections that use an empty
ipsarray, check advanced network configuration.
Private Network
Send a POST request to:
POST /servers/[SERVER_ID]/network-configuration/private-network-configuration/private-networksCode language: HTTP (http)
Replace [SERVER_ID] with your BMC server's ID.
The request body must include the private network ID. You can also specify IP addresses and configure DHCP. For example:
{
"id": "[PRIVATE_NETWORK_ID]",
"dhcp": false,
"ips": [
"[IP_ADDRESS]"
]
}Code language: JSON / JSON with Comments (json)
Replace [PRIVATE_NETWORK_ID] with the ID of the private network. If dhcp is set to true, omit ips.
When assigning private networks to BMC servers, keep the following in mind:
- Provisioning. If you don't specify a private network during server deployment, BMC assigns the server to the default private network for its location. If the network has a CIDR, BMC automatically assigns an available IP address.
- Multiple IP addresses. A server can have up to 10 private IP addresses, but all must belong to the same private network. Only one gateway is supported.
- Removing a network. You can remove a server from a private network even if it's the server's only private network. The server remains provisioned.
- Deleting a server. When you delete a server, BMC removes the server from its associated private networks and releases its IP address allocations.
- Network storage. If connecting a server to a storage network, provide the storage network ID.
Find out more
Public Network
To add a server to a public network, send a request to:
POST /servers/[SERVER_ID]/network-configuration/public-network-configuration/public-networksCode language: HTTP (http)
Replace [SERVER_ID] with your BMC server's ID.
The request body must include the public network ID and at least one IP address:
{
"id": "[PUBLIC_NETWORK_ID]",
"ips": [
"[IP_ADDRESS]"
]
}Code language: JSON / JSON with Comments (json)
Find out more
Remove a Server from a Private or Public Network
Warning
Removing a network connection makes the server inaccessible over that network. Before disconnecting from a server, ensure that another access method is available, such as the remote console.
To remove a server from a private network, use:
DELETE /servers/[SERVER_ID]/network-configuration/private-network-configuration/private-networks/[PRIVATE_NETWORK_ID]Code language: HTTP (http)
The request requires the server ID and private network ID.
For a public network, use:
DELETE /servers/[SERVER_ID]/network-configuration/public-network-configuration/public-networks/[PUBLIC_NETWORK_ID]Code language: HTTP (http)
Replace [SERVER_ID] and [PUBLIC_NETWORK_ID] with the actual values. Proceed with manual OS-level network configuration.
Find out more
BMC API - DELETE /servers/[SERVER_ID]/network-configuration/private-network-configuration/private-networks/[PRIVATE_NETWORK_ID]
BMC API - DELETE /servers/[SERVER_ID]/network-configuration/public-network-configuration/public-networks/[PUBLIC_NETWORK_ID]
Assign a Public IP Block
Send a request to the following endpoint:
POST /servers/[SERVER_ID]/network-configuration/ip-block-configurations/ip-blocks Code language: HTTP (http)
Replace [SERVER_ID] with your BMC server's ID.
The request body must include the public IP block ID you want to assign:
{
"id": "[PUBLIC_IP_BLOCK_ID]"
}Code language: JSON / JSON with Comments (json)
Only one IPv4 and one IPv6 block can be assigned to a server.
Remove a Public IP Block
Warning
Removing a public IP block can make the server inaccessible over the network. Before unassigning the block, ensure that another access method is available, such as the remote console.
Send a DELETE request:
DELETE /servers/[SERVER_ID]/network-configuration/ip-block-configurations/ip-blocks/[IP_BLOCK_ID]Code language: HTTP (http)
The request body must include the deleteIpBlocks property. To keep the IP block in your ownership, set the property to false:
{
"deleteIpBlocks": false
}Code language: JSON / JSON with Comments (json)
If the IP Block is BYO, the deleteIpBlocks property cannot be set to true.