net.php¶
Network infrastructure management module: adding and removing IP addresses, blocking traffic, managing network port states, retrieving statistics, and displaying Cacti charts.
API Methods¶
| Method | Action | Description |
|---|---|---|
add_ipv4 | add IPv4 addresses | Adds the specified number of IPv4 addresses to a server in a given port and VLAN. If no IP is specified, the system selects available free addresses from those available in this location. |
block_ip | block IP address | Blocks the specified IP address via BIRD or blackhole for a specific server. It can set an expiration period for the block if required. |
get_status | get port status | Returns information about the state of the server's network interface (port), including configuration parameters and current settings. |
port_off | disable port | Disables the server's network port. If a reason (block_reason) is provided, an administrative block tag is created. |
port_on | enable port | Enables the server's network port, removing associated blocking tags (e.g., 'block'). If the user has the customer role and there is an administrative ban on the port, the operation will be rejected. |
remove_ipv4 | remove IPv4 address | Removes one or more IPv4 addresses from the server. If the remove_all parameter is specified, all IPs are removed (depending on backend implementation). Upon successful execution, it returns a list of removed IPs and keys. |
show_cacti | display cacti graph | Returns data for constructing Cacti graphs for a specific server port. |
show_ipv4_free | get free IPv4 addresses | Returns a list of available IPv4 addresses for assignment in the specified VLAN and subnet for a specific server. |
unblock_ip | unblock IP | Removes the block from the specified IP address on the server. If the action is performed by a client, the presence of a corresponding entry in the port description is checked. |
net/add_ipv4¶
Adds the specified number of IPv4 addresses to a server in a given port and VLAN. If no IP is specified, the system selects available free addresses from those available in this location.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: add_ipv4 |
| token | ✅ | string | Authorization token |
| id | ✅ | integer | Server ID |
| port | ❌ | string | Port name (e.g., eth0, ipmi) |
| ips[] | ❌ | string[] | Array of IP addresses to add. If empty, selection is performed. |
| amount | ❌ | integer | Number of IP addresses to select (if ips is not specified) |
| allow_tech_networks | ❌ | integer | Allow the use of technical networks (for admins) |
| fresh_period | ❌ | integer | Freshness period of IP addresses |
Example Request
Example of a successful response
Failure response
net/block_ip¶
Blocks the specified IP address via BIRD or blackhole for a specific server. It can set an expiration period for the block if required.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Action: block_ip or blackhole_ip |
| token | ✅ | string | Authorization token |
| id | ❌ | integer | Server ID (if not specified, it will be found by IP) |
| ip | ✅ | string | IP address to block |
| description | ❌ | string | Reason for blocking (added to the tag) |
| four_hours | ❌ | integer | If > 0, sets a temporary 4-hour block |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "failed to send BIRD management command" }
```
net/get_status¶
Returns information about the state of the server's network interface (port), including configuration parameters and current settings.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: get_status |
| id | ✅ | integer | Server ID |
| port | ❌ | string | Port name (e.g., eth0, ipmi) |
| vlan | ❌ | string | VLAN ID |
| speed | ❌ | string | Port speed |
| port_security | ❌ | integer | Port security settings |
| trunc | ❌ | string | Truncation parameters |
| status | ❌ | integer | Port status (-1 by default) |
| duplex | ❌ | string | Duplex mode |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "Server not found or invalid port configuration" }
```
net/port_off¶
Disables the server's network port. If a reason (block_reason) is provided, an administrative block tag is created.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: port_off |
| token | ❌ | string | Authorization token |
| id | ✅ | integer | Server ID |
| port | ❌ | string | Port name (e.g., eth0) |
| reason | ❌ | string | Blocking reason (block_reason) |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "Port management command execution error" }
```
net/port_on¶
Enables the server's network port, removing associated blocking tags (e.g., 'block'). If the user has the customer role and there is an administrative ban on the port, the operation will be rejected.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: port_on |
| id | ✅ | int | Server ID |
| port | ❌ | string | Port name (e.g., eth0, ipmi) |
| token | ✅ | string | Authorization token |
Example Request
Failure response
``` { "code": -1, "message": "admin ban could not be lifted this way, please contact support or abuse team." }
```
net/remove_ipv4¶
Removes one or more IPv4 addresses from the server. If the remove_all parameter is specified, all IPs are removed (depending on backend implementation). Upon successful execution, it returns a list of removed IPs and keys.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: remove_ipv4 |
| token | ✅ | string | Authorization token |
| id | ✅ | int | Server ID |
| ip | ✅ | string | IP address to remove (valid IPv4) |
| remove_all | ❌ | int | Full removal flag for all IPs |
Example Request
Example of a successful response
Failure response
net/show_cacti¶
Returns data for constructing Cacti graphs for a specific server port.
HTTP-method: POST|GET
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| id | ✅ | int | Server ID |
| port | ❌ | string | Port name (e.g., eth0) |
| graph | ❌ | int | Cacti graph ID |
| token | ✅ | string | Authorization token |
Example Request
Failure response
``` { "code": -1, "message": "invalid request" }
```
net/show_ipv4_free¶
Returns a list of available IPv4 addresses for assignment in the specified VLAN and subnet for a specific server.
HTTP-method: POST|GET
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: show_ipv4_free |
| token | ❌ | string | Authorization token |
| id | ✅ | integer | Server ID |
| port | ❌ | string | Interface name (e.g., eth0, ipmi) |
| ip_tag | ❌ | string|array | Tag for IP search (can be a string or an array from add_ipv4) |
| show_all | ❌ | integer | Show all available addresses (0 or 1). For customers, it is always forced to 0. |
| fresh_period | ❌ | integer | Data freshness period |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "can't find appropriate free IP (vlan: 100 tag: bm amount: -1 at NL)" }
```
net/unblock_ip¶
Removes the block from the specified IP address on the server. If the action is performed by a client, the presence of a corresponding entry in the port description is checked.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: unblock_ip |
| id | ✅ | integer | Server ID |
| ip | ✅ | string | IP address to unblock |
| token | ✅ | string | API authentication token |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "failed to send BIRD management command" }