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 free addresses available in this location. |
block_ip | block IP address | Blocks the specified IP address via BIRD or blackhole. If the description parameter is not provided, the system prefix of the owner is used. |
get_status | get port status | Returns network interface status information (port status, speed, duplex, etc.) for the specified server. |
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 | Activates the server's network port, removing associated blocking tags (e.g., 'block'), if permitted by security policy. |
remove_ipv4 | remove IPv4 address | Removes one or all IPv4 addresses from the server. If the remove_all parameter is specified, all assigned addresses are removed. |
show_cacti | get cacti graph | Returns data for displaying Cacti charts associated with the server's network interface. |
show_ipv4_free | get free IPv4 addresses | Returns a list of available IPv4 addresses for assignment in the specified VLAN, taking into account tags (tag) for a specific server. |
unblock_ip | unblock IP | Removes the block from the specified IP address on the server via BIRD or other network management mechanisms. |
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 free addresses 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 | IP address freshness period |
Example Request
Example of a successful response
Failure response
net/block_ip¶
Blocks the specified IP address via BIRD or blackhole. If the description parameter is not provided, the system prefix of the owner is used.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| token | ✅ | string | Authorization token |
| id | ❌ | integer | Server ID (if not specified, IP will be searched by address) |
| ip | ✅ | string | IP address to block |
| description | ❌ | string | Reason for blocking (added to the prefix) |
| four_hours | ❌ | integer | If > 0, sets a temporary 4-hour block via the block_expire tag |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "failed to send BIRD management command" }
```
net/get_status¶
Returns network interface status information (port status, speed, duplex, etc.) for the specified server.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| 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 | Fragmentation/truncation parameters |
| status | ❌ | integer | Port status (-1 by default) |
| duplex | ❌ | string | Duplex mode |
| port_virt_node | ❌ | integer | Virtual port node |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "Server not found or permission denied" }
```
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 | Reason for blocking (block_reason) |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "failed to send BIRD management command" }
```
net/port_on¶
Activates the server's network port, removing associated blocking tags (e.g., 'block'), if permitted by security policy.
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": "$module/port_on: admin ban could not be lifted this way, please contact support or abuse team." }
```
net/remove_ipv4¶
Removes one or all IPv4 addresses from the server. If the remove_all parameter is specified, all assigned addresses are removed.
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 |
| remove_all | ❌ | integer | Flag to remove all addresses (1 - remove all) |
Example Request
Example of a successful response
Failure response
net/show_cacti¶
Returns data for displaying Cacti charts associated with the server's network interface.
HTTP-method: POST|GET
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: show_cacti |
| token | ✅ | string | Authorization token |
| id | ✅ | integer | Server ID |
| port | ❌ | string | Port name (e.g., eth0) |
| graph | ❌ | integer | 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 in the specified VLAN, taking into account tags (tag) 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) |
| vlan | ❌ | integer | VLAN ID |
| ip | ❌ | string | Specific IP to search for (if not specified, searches all) |
| tag | ❌ | string | Tag (can be a string or an array) |
| 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": "show_ipv4_free: invalid request - invalid id 0" }
```
net/unblock_ip¶
Removes the block from the specified IP address on the server via BIRD or other network management mechanisms.
HTTP-method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| token | ✅ | string | Authorization token |
| id | ❌ | integer | Server ID |
| ip | ✅ | string | IP address to unblock |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "failed to send BIRD management command" }