Networks

Create a Network

Creates a Network.

The provided ip_range can only be extended later on, but not reduced.

Subnets can be added now or later on using the add subnet action. If you do not specify an ip_range for the subnet the first available /24 range will be used.

Routes can be added now or later by using the add route action.

post/networks

Request

  • Base URL: https://api.hetzner.cloud/v1
  • URL: https://api.hetzner.cloud/v1/networks
  • Auth: HTTP bearer

Request body

namestring required

Name of the Network.

ip_rangestring required

IP range of the Network.

Uses CIDR notation.

Must span all included subnets. Must be one of the private IPv4 ranges of RFC1918.

Minimum network size is /24. We highly recommend that you pick a larger Network with a /16 netmask.

labelsobject

User-defined labels (key/value pairs) for the Resource. For more information, see "Labels".

expose_routes_to_vswitchboolean

Toggle to expose routes to the Networks vSwitch.

Indicates if the routes from this Network should be exposed to the vSwitch in this Network. Only takes effect if a vSwitch is setup in this Network.

Example request

{
  "name": "mynet",
  "ip_range": "10.0.0.0/16",
  "labels": {
    "environment": "prod",
    "example.com/my": "label",
    "just-a-key": ""
  },
  "subnets": [
    {
      "ip_range": "10.0.1.0/24",
      "network_zone": "eu-central",
      "vswitch_id": 1000
    }
  ],
  "routes": [
    {
      "destination": "10.100.1.0/24",
      "gateway": "10.0.1.1"
    }
  ]
}

Response

Request succeeded.

Example response

{
  "network": {
    "id": 4711,
    "name": "mynet",
    "ip_range": "10.0.0.0/16",
    "subnets": [
      {
        "ip_range": "10.0.1.0/24",
        "network_zone": "eu-central",
        "gateway": "10.0.0.1",
        "vswitch_id": 1000
      }
    ],
    "routes": [
      {
        "destination": "10.100.1.0/24",
        "gateway": "10.0.1.1"
      }
    ],
    "servers": [
      42
    ],
    "load_balancers": [
      42
    ],
    "labels": {
      "environment": "prod",
      "example.com/my": "label",
      "just-a-key": ""
    },
    "created": "2016-01-30T23:55:00Z"
  }
}

Changes

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