Aller au contenu
NimbusNexus

Sous-réseaux

Un sous-réseau est un bloc d’adresses IP à l’intérieur d’un réseau. Une VM s’attache au réseau par l’intermédiaire d’un port, et le port prend son adresse dans l’un des sous-réseaux du réseau.

Dimensionnement du CIDR

Vous choisissez le CIDR à la création. Tailles typiques :

Cas d’usageCIDR
Test avec une seule VM/29
Petite application (≤ 20 VM)/27
Application moyenne (≤ 100 VM)/25
Grande application/24
VPC à l’échelle du projet/16

Toutes les adresses du bloc ne vont pas aux VM : les ports prennent les leurs dans les allocation_pools du sous-réseau.

Le CIDR d’un sous-réseau est fixé une fois le sous-réseau créé. PUT /api/v1/subnet/{subnet_id} modifie son name, ses dns_nameservers, ses allocation_pools, sa gateway_ip et son enable_dhcp, pas sa taille ; pour obtenir plus d’adresses, ajoutez un autre sous-réseau au réseau. Vous ne pouvez pas réduire un sous-réseau sans le recréer ; il faudrait renuméroter les IP des VM existantes.

DHCP, SLAAC et comportement de la passerelle

  • Les sous-réseaux IPv4 utilisent DHCP par défaut. Chaque VM reçoit une adresse fixe dans la plage disponible du sous-réseau. Vous pouvez pré-allouer des IP précises via l’endpoint des ports quand vous avez besoin d’une adresse stable (par exemple pour un backend de LB inscrit dans le DNS).
  • Les sous-réseaux IPv6 prennent les mêmes champs que les sous-réseaux IPv4, avec ip_version: 6. Aucun champ ne permet de choisir entre SLAAC et DHCPv6.
  • La passerelle se définit par sous-réseau. Pour les sous-réseaux tenant qui ont besoin d’un accès à internet, la passerelle pointe vers le routeur attaché au sous-réseau.

Plusieurs sous-réseaux par réseau

Vous pouvez attacher plusieurs sous-réseaux à un même réseau. C’est ainsi que vous mettez en place le dual-stack IPv4 + IPv6 : un sous-réseau v4 et un sous-réseau v6 sur le même réseau.

Étapes suivantes

  • Réseaux — le parent des sous-réseaux.
  • Routeurs — ce à quoi attacher un sous-réseau tenant pour qu’il puisse atteindre internet.
  • Machines virtuelles — les VM s’attachent aux réseaux via des ports.

Reference

GET/api/v1/subnet/

List Subnets

Lists subnets visible to the project.

Parameters

NameInTypeDescription
admin_domainquerystring | null—
admin_projectquerystring | null—
network_idquerystring | null—
ip_versionqueryinteger | null—
cidrquerystring | null—
scope_current_projectqueryboolean | null—

Responses

  • 200Successful Response
  • 401Unauthorized
  • 403Forbidden
  • 422Validation Error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X GET "https://api.nimbusnexus.net/api/v1/subnet/" \
  -H "Authorization: Bearer $NIMBUS_KEY"
POST/api/v1/subnet/

Create Subnet

Creates a subnet on an existing virtual network.

Request body

FieldTypeDescription
admin_domainstring | null—
admin_projectstring | null—
namestring | null—
dns_nameserversarray of string | null—
allocation_poolsarray of object | null—
gateway_ipstring | null—
enable_dhcpboolean | null—
project_idstring | null—
network_id*string—
ip_version*integer—
cidrstring | null—
subnetpool_idstring | null—
prefixleninteger | null—

Responses

  • 201Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 409Conflict
  • 422Validation Error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X POST "https://api.nimbusnexus.net/api/v1/subnet/" \
  -H "Authorization: Bearer $NIMBUS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "network_id": "<network_id>",
    "ip_version": 1
  }'
GET/api/v1/subnet/artifacts

Subnet Artifacts

Returns the subnet's existing interfaces with networks and subnet pools that may be attached.

Responses

  • 200Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 422Validation error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X GET "https://api.nimbusnexus.net/api/v1/subnet/artifacts" \
  -H "Authorization: Bearer $NIMBUS_KEY"
GET/api/v1/subnet/{subnet_id}

Get Subnet

Returns the details of a single subnet by ID.

Parameters

NameInTypeDescription
subnet_id*pathstring—

Responses

  • 200Successful Response
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 422Validation Error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X GET "https://api.nimbusnexus.net/api/v1/subnet/<subnet_id>" \
  -H "Authorization: Bearer $NIMBUS_KEY"
PUT/api/v1/subnet/{subnet_id}

Update Subnet

Updates the mutable attributes of an existing subnet.

Parameters

NameInTypeDescription
subnet_id*pathstring—

Request body

FieldTypeDescription
admin_domainstring | null—
admin_projectstring | null—
namestring | null—
dns_nameserversarray of string | null—
allocation_poolsarray of object | null—
gateway_ipstring | null—
enable_dhcpboolean | null—
project_idstring | null—

Responses

  • 200Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 422Validation Error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X PUT "https://api.nimbusnexus.net/api/v1/subnet/<subnet_id>" \
  -H "Authorization: Bearer $NIMBUS_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
DELETE/api/v1/subnet/{subnet_id}

Delete Subnet

Deletes a subnet by ID.

Parameters

NameInTypeDescription
subnet_id*pathstring—

Responses

  • 204Successful Response
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 409Conflict
  • 422Validation Error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X DELETE "https://api.nimbusnexus.net/api/v1/subnet/<subnet_id>" \
  -H "Authorization: Bearer $NIMBUS_KEY"
GET/api/v1/subnet_pool/

List Subnet Pools

Lists subnet pools visible to the project.

Parameters

NameInTypeDescription
namequerystring | null—
is_defaultqueryboolean | null—
min_prefixlenqueryinteger | null—
max_prefixlenqueryinteger | null—
default_prefixlenqueryinteger | null—
sharedqueryboolean | null—
scope_current_projectqueryboolean | null—

Responses

  • 200Successful Response
  • 401Unauthorized
  • 403Forbidden
  • 422Validation Error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X GET "https://api.nimbusnexus.net/api/v1/subnet_pool/" \
  -H "Authorization: Bearer $NIMBUS_KEY"
POST/api/v1/subnet_pool/

Create Subnet Pool

Creates a subnet pool from which subnets can allocate CIDRs.

Request body

FieldTypeDescription
admin_domainstring | null—
admin_projectstring | null—
namestring—
project_idstring—
prefixes*array of string—
descriptionstring | null—
is_defaultboolean—
min_prefixleninteger | null—
max_prefixleninteger | null—
default_prefixleninteger | null—
sharedboolean | null—
address_scope_idstring | null—

Responses

  • 201Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 409Conflict
  • 422Validation Error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X POST "https://api.nimbusnexus.net/api/v1/subnet_pool/" \
  -H "Authorization: Bearer $NIMBUS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prefixes": [
      "example"
    ]
  }'
GET/api/v1/subnet_pool/{subnet_pool_id}

Get Subnet Pool

Returns the details of a single subnet pool by ID.

Parameters

NameInTypeDescription
subnet_pool_id*pathstring—

Responses

  • 200Successful Response
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 422Validation Error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X GET "https://api.nimbusnexus.net/api/v1/subnet_pool/<subnet_pool_id>" \
  -H "Authorization: Bearer $NIMBUS_KEY"
PUT/api/v1/subnet_pool/{subnet_pool_id}

Update Subnet Pool

Updates the mutable attributes of an existing subnet pool.

Parameters

NameInTypeDescription
subnet_pool_id*pathstring—

Request body

FieldTypeDescription
namestring | null—
descriptionstring | null—
prefixesarray of string | null—
default_prefixleninteger | null—
min_prefixleninteger | null—
max_prefixleninteger | null—
default_quotainteger | null—
address_scope_idstring | null—
is_defaultboolean | null—

Responses

  • 200Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 409Conflict
  • 422Validation Error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X PUT "https://api.nimbusnexus.net/api/v1/subnet_pool/<subnet_pool_id>" \
  -H "Authorization: Bearer $NIMBUS_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
DELETE/api/v1/subnet_pool/{subnet_pool_id}

Delete Subnet Pool

Deletes a subnet pool by ID.

Parameters

NameInTypeDescription
subnet_pool_id*pathstring—

Responses

  • 204Successful Response
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 409Conflict
  • 422Validation Error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X DELETE "https://api.nimbusnexus.net/api/v1/subnet_pool/<subnet_pool_id>" \
  -H "Authorization: Bearer $NIMBUS_KEY"

Need to make a real call? Try these endpoints in the live Swagger UI →