Server Actions

Attach a Server to a Network

Attaches a Server to a network. This will complement the fixed public Server interface by adding an additional ethernet interface to the Server which is connected to the specified network.

The Server will get an IP auto assigned from a subnet of type server in the same network_zone.

Using the alias_ips attribute you can also define one or more additional IPs to the Servers. Please note that you will have to configure these IPs by hand on your Server since only the primary IP will be given out by DHCP.

Operation specific errors

StatusCodeDescription
422server_already_attachedThe server is already attached to the network
422ip_not_availableThe provided Network IP is not available
422no_subnet_availableNo Subnet or IP is available for the Server within the network
422networks_overlapThe network IP range overlaps with one of the server networks
post/servers/{id}/actions/attach_to_network

Request

  • Base URL: https://api.hetzner.cloud/v1
  • URL: https://api.hetzner.cloud/v1/servers/{id}/actions/attach_to_network
  • Auth: HTTP bearer

Path parameters

idinteger required

ID of the Server.

Example:42

ID of the Server.

Request body

networkinteger required

ID of an existing network to attach the Server to.

ipstring

IP to request to be assigned to this Server; if you do not provide this then you will be auto assigned an IP address.

alias_ipsstring[]

Additional IPs to be assigned to this Server.

ip_rangestring

IP range in CIDR block notation of the subnet to attach to.

This allows for auto assigning an IP address for a specific subnet. Providing ip that is not part of ip_range will result in an error.

Example request

{
  "network": 4711,
  "ip": "10.0.1.1",
  "alias_ips": [
    "10.0.1.2"
  ],
  "ip_range": "10.0.1.0/24"
}

Response

Request succeeded.

Example response

{
  "action": {
    "id": 42,
    "command": "start_resource",
    "started": "2016-01-30T23:55:00Z",
    "finished": "2016-01-30T23:55:00Z",
    "progress": 100,
    "resources": [
      {
        "id": 42,
        "type": "server"
      }
    ],
    "error": {
      "code": "action_failed",
      "message": "Action failed"
    }
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.