A permanent API token is required, along with a project ID and region ID.
To find the values for each variable:
- INSTANCE_ID: the UUID of the virtual machine whose port you want to configure. To create a VM or find its ID, see Create a virtual machine.
- PORT_ID: the UUID of the VM’s private network interface port. The external (public) interface does not support allowed address pairs. See the Find the port ID section below for how to retrieve it.
Find the port ID
Each VM network interface has aport_id. Allowed address pairs are applied per port, and only ports on private (non-external) networks support this feature.
- Python
- Go
- curl
port_id of the private interface (the one with a private IP range such as 10.x.x.x or 192.168.x.x) as PORT_ID. The external interface with a public IP does not support allowed address pairs. The same endpoint also shows allowed_address_pairs on each interface, so you can use it to verify the result after setting pairs.
Set allowed address pairs
ThePUT request replaces the entire list of allowed address pairs for the port. To add one pair without losing existing ones, include all current pairs in the request body alongside the new entry.
| Parameter | Required | Description |
|---|---|---|
ip_address | Yes | IP address or CIDR range to allow (e.g. 192.168.1.10 or 10.0.0.0/24) |
mac_address | No | MAC address to associate; defaults to the port’s own MAC when omitted |
- Python
- Go
- curl
mac_address is omitted, the API assigns the port’s default MAC address to that entry automatically.
Remove allowed address pairs
To remove all allowed address pairs from a port, send the samePUT request with an empty allowed_address_pairs array. The operation is asynchronous — poll the returned task until state is FINISHED.
- Python
- Go
- curl