Attach Interface to Virtual Router
/v2.0/routers/{router_id}/add_router_interfaceAdds an internal interface to a virtual router by attaching a specified subnet or port.
- If you specify a subnet, the subnet's gateway IP is used as the interface IP by default. You may pass a custom IP within the subnet via
ip_address. - If you specify a port, the port's fixed IP is used as the interface IP.
- Only one of
subnet_idorport_idmust be provided.
When an IPv6 subnet is specified, it is added to an existing internal port on the same network, or a new port is created if none exists. A port can have multiple IPv6 subnets that share the same network, but only one IPv4 subnet per port is allowed.
Source: add-interface-to-router
Request
Parameters
router_idstringrequiredpathThe ID of the router.
subnet_idstringbodyThe ID of the subnet. One of subnet_id or port_id must be specified.
port_idstringbodyThe ID of the port. One of subnet_id or port_id must be specified.
ip_addressstringbodyCustom IP address from the subnet to use for the router interface. Only valid when subnet_id is specified.
Sample Request
- cURL
- HTTP
curl -ks -X PUT -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' -d '{
"subnet_id": "86c2b30c-8ee2-4a0c-828f-c7218dfa522c"
}' https://api.vietnix.cloud:9696/v2.0/routers/02542148-44cb-470d-a551-58f370c47b83/add_router_interface
PUT https://api.vietnix.cloud:9696/v2.0/routers/02542148-44cb-470d-a551-58f370c47b83/add_router_interface
Content-Type: application/json
X-Auth-Token: gAAAAA<...>
{
"subnet_id": "86c2b30c-8ee2-4a0c-828f-c7218dfa522c",
}
Response
Response Parameters
idstringrequiredThe ID of the router.
subnet_idstringrequiredThe ID of the subnet that the router interface belongs to.
subnet_idsarrayrequiredA list with the ID of the subnet that the router interface belongs to. Contains only one member.
network_idstringrequiredThe ID of the attached network.
port_idstringrequiredThe ID of the port that represents the router interface.
project_idstringrequiredThe ID of the project.
tenant_idstringrequiredThe ID of the project.
tagsarrayrequiredThe list of tags on the resource.
Sample Response
Response body
{
"id": "66d0c3df-8b49-45ee-b153-54817fa62be2",
"tenant_id": "f33507157a634f1cac71e06a70fb558e",
"port_id": "ce3ed34b-ecb4-4e9a-958c-374054ed0e5c",
"network_id": "4ca57e10-f17f-4609-b8e4-ece4193f0a4b",
"subnet_id": "86c2b30c-8ee2-4a0c-828f-c7218dfa522c",
"subnet_ids": [
"86c2b30c-8ee2-4a0c-828f-c7218dfa522c"
]
}
Status Codes
Success
| Status Code | Description |
|---|---|
| 200 - OK | Request was successful. |
Error
| Status Code | Description |
|---|---|
| 400 - Bad Request | Some content in the request was invalid. |
| 401 - Unauthorized | User must authenticate before making a request. |
| 404 - Not Found | The requested resource could not be found. |
| 409 - Conflict | This operation conflicted with another operation on this resource. |