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 address | Adds the specified number of IPv4 addresses to a server in the selected port and VLAN. If no IP is specified, the system selects available free addresses from those available in the current location. |
block_ip | block IP address | Blocks the specified IP address for the server via BIRD or blackhole. If the description parameter is not provided, the system's owner prefix is used. |
get_status | get port status | Returns the current state and parameters of the server's network interface (speed, VLAN, status, security settings). |
port_off | disable port | Disables the server's network port by adding an administrative block with a reason specified in the interface tags. |
port_on | enable port | Enables the server's network port by removing associated blocking tags (e.g., 'block'). If an administrative ban is set on the port, the action 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 IP addresses are removed (depending on backend implementation logic). Upon successful execution, the PTR record in DNS is cleared. |
show_cacti | get cacti chart | Returns data for displaying Cacti charts for a specific port and graph ID. |
show_ipv4_free | get free IPv4 addresses | Returns a list of available IPv4 addresses for assignment to a specific server, port, and VLAN, taking into account location and tags. |
unblock_ip | unblock IP | Removes the block from the specified IP address via BIRD. If the action is performed by a client, it checks for the presence of a corresponding entry in the interface description. |
net/add_ipv4¶
Adds the specified number of IPv4 addresses to a server in the selected port and VLAN. If no IP is specified, the system selects available free addresses from those available in the current 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 | Network interface name (e.g., eth0, ipmi) |
| ips[] | ❌ | array | List 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 administrators) |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "failed to add IPv4: error message from service" }
```
net/block_ip¶
Blocks the specified IP address for the server via BIRD or blackhole. If the description parameter is not provided, the system's owner prefix is used.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Action (block_ip or blackhole_ip) |
| token | ❌ | string | Authorization token |
| id | ❌ | integer | Server ID |
| ip | ✅ | string | IP address to block |
| description | ❌ | string | Reason for blocking (added to the prefix) |
| four_hours | ❌ | integer | Set a time limit (4 hours) |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "failed to send BIRD management command" }
```
net/get_status¶
Returns the current state and parameters of the server's network interface (speed, VLAN, status, security settings).
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: get_status |
| token | ✅ | string | Authorization token |
| id | ✅ | integer | Server ID |
| port | ❌ | string | Port name (e.g., eth0) |
| vlan | ❌ | string | VLAN ID |
| speed | ❌ | string | Port speed |
| port_security | ❌ | string | Port security settings |
| trunc | ❌ | string | Traffic parameters (truncation) |
| status | ❌ | string | Port status |
| duplex | ❌ | string | Duplex mode |
| port_virt_node | ❌ | mixed | Virtual port node |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "invalid request for server id 0 with port eth0" }
```
net/port_off¶
Disables the server's network port by adding an administrative block with a reason specified in the interface tags.
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 | Reason for blocking the port |
Example Request
Failure response
``` { "code": -1, "message": "net: action required" }
```
net/port_on¶
Enables the server's network port by removing associated blocking tags (e.g., 'block'). If an administrative ban is set on the port, the action will be rejected.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: port_on |
| id | ✅ | integer | Server ID |
| port | ❌ | string | Port name (e.g., eth0) |
| token | ✅ | string | Authorization token |
Example Request
Example of a successful response
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 IP addresses are removed (depending on backend implementation logic). Upon successful execution, the PTR record in DNS is cleared.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: remove_ipv4 |
| token | ✅ | string | Authorization token |
| id | ✅ | integer | Server ID |
| ip | ✅ | string | IP address to remove (in IPv4 format) |
| remove_all | ❌ | integer | Full removal flag for all IPs (0 or 1) |
Example Request
Example of a successful response
Failure response
net/show_cacti¶
Returns data for displaying Cacti charts for a specific port and graph ID.
HTTP-method: POST|GET
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: show_cacti |
| token | ✅ | string | Authorization token |
| id | ✅ | int | Server/device ID |
| port | ❌ | string | Port name (e.g., eth0) |
| graph | ❌ | int | Cacti graph ID |
Example Request
Failure response
``` { "code": -1, "message": "invalid request" }
```
net/show_ipv4_free¶
Returns a list of available IPv4 addresses for assignment to a specific server, port, and VLAN, taking into account location and tags.
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 | ❌ | string | Base IP for search |
| tag | ❌ | string | Tag (can be an array or a string) |
| show_all | ❌ | integer | Show all available addresses (0 or 1) |
| fresh_period | ❌ | integer | Data freshness period |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "can't find approppriate free IP (vlan: 100 tag: bm amount: -1 at US)" }
```
net/unblock_ip¶
Removes the block from the specified IP address via BIRD. If the action is performed by a client, it checks for the presence of a corresponding entry in the interface description.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: unblock_ip |
| token | ✅ | string | Authorization token |
| id | ❌ | integer | Server ID (if known) |
| ip | ✅ | string | IP address to unblock |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "failed to send BIRD management command", "context": { "id": 123, "ip": "1.2.3.4" } }