net.php¶
Network infrastructure management module: adding and removing IP addresses, blocking traffic, managing network port status, retrieving statistics, and displaying Cacti graphs.
API Methods¶
| Method | Action | Description |
|---|---|---|
add_ipv4 | adding IPv4 addresses | Adds the specified number of IPv4 addresses to a server or assigns specific IP addresses. Supports automatic search for free IPs in a VLAN or manual specification of a list. |
block_ip | blocking an IP address | Blocks the specified IP address on the server via BIRD or blackhole. Requires authentication. |
get_status | getting port status | Returns the current status and configuration of the server's network port. Requires authentication. |
port_off | disabling a network port | Disables the specified server network port and adds a block tag with the specified reason. |
port_on | enabling a network port | Enables the specified server network port, removing the block (tag 'block') if it was not set by an administrator. |
remove_ipv4 | removing an IPv4 address | Removes the specified IPv4 address from the server. If the remove_all flag is passed, all addresses are removed. |
show_cacti | getting a Cacti graph | Returns traffic monitoring graph data for the specified server and port from the Cacti system. |
show_ipv4_free | getting a list of free IPv4 addresses | Returns a list of available IPv4 addresses for the specified server and interface in a given VLAN. Requires authentication. |
unblock_ip | unblocking an IP | Removes the block from the specified IP address on the server. Requires access rights verification. |
net/add_ipv4¶
Adds the specified number of IPv4 addresses to a server or assigns specific IP addresses. Supports automatic search for free IPs in a VLAN or manual specification of a list.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: add_ipv4 |
| id | ✅ | int | ID of the server to which IP addresses are added |
| amount | ✅ | int | Number of IP addresses to add (if specific IPs are not specified) |
| port | ❌ | string | Network interface name (e.g., eth0, ipmi). If not specified, the primary interface is used. |
| vlan | ❌ | int | VLAN ID for IP assignment. For clients, it is determined automatically based on the interface. |
| ips | ❌ | array<string> | List of specific IP addresses to assign. If specified, amount is ignored. |
| ip | ❌ | string | A single IP address to assign (alternative to the ips array) |
| tag | ❌ | string | Subnet tag for selecting an IP pool (e.g., bm, ipmi, ovirt). Default is 'bm'. |
| fresh_period | ❌ | int | Freshness period for free IP data (in seconds). Default is -1. |
| allow_tech_networks | ❌ | int | Flag to allow the use of technical networks (administrators only). 0 or 1. |
| token | ✅ | string | User authentication token |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "net/add_ipv4: invalid request" }
```
net/block_ip¶
Blocks the specified IP address on the server via BIRD or blackhole. Requires authentication.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: block_ip |
| token | ✅ | string | User authentication token |
| id | ❌ | int | Server ID. If not specified by the client, the system will attempt to find the server by IP. |
| ip | ✅ | string | IP address to block |
| description | ❌ | string | Reason for blocking or comment |
| four_hours | ❌ | int | Flag for temporary blocking for 4 hours (1 - yes, 0 - no) |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "net/block_ip: Invalid IP" }
```
net/get_status¶
Returns the current status and configuration of the server's network port. Requires authentication.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: get_status |
| token | ✅ | string | User authentication token |
| id | ✅ | int | Server identifier |
| port | ❌ | string | Port name (e.g., eth0, ipmi). If not specified, the primary interface is used. |
| vlan | ❌ | string | VLAN identifier |
| speed | ❌ | string | Port speed |
| port_security | ❌ | string | Port security settings |
| trunc | ❌ | string | Data truncation parameter |
| status | ❌ | string | Status filter |
| duplex | ❌ | string | Duplex mode |
| port_virt_node | ❌ | string | Port virtual node identifier |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "net/get_status: authentication required" }
```
net/port_off¶
Disables the specified server network port and adds a block tag with the specified reason.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: port_off |
| token | ✅ | string | User authorization token |
| id | ✅ | int | Server identifier |
| port | ❌ | string | Port name (e.g., eth0). If not specified, the primary interface is used. |
| reason | ❌ | string | Reason for port blocking. If specified, it is added to the block tag. |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "net/port_off: authentication required" }
```
net/port_on¶
Enables the specified server network port, removing the block (tag 'block') if it was not set by an administrator.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: port_on |
| token | ✅ | string | User authorization token |
| id | ✅ | int | Server identifier |
| port | ❌ | string | Port name (e.g., eth0). If not specified, the primary interface is used. |
Example Request
Example of a successful response
Failure response
net/remove_ipv4¶
Removes the specified IPv4 address from the server. If the remove_all flag is passed, all addresses are removed.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: remove_ipv4 |
| token | ✅ | string | User authorization token |
| id | ✅ | int | Server identifier |
| ip | ✅ | string | IPv4 address to remove |
| remove_all | ❌ | int | Flag to remove all IP addresses (0 or 1) |
Example Request
Example of a successful response
Failure response
net/show_cacti¶
Returns traffic monitoring graph data for the specified server and port from the Cacti system.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: show_cacti |
| token | ✅ | string | User authentication token |
| id | ✅ | int | Server identifier |
| port | ❌ | string | Port name (e.g., eth0, ipmi). If not specified, the primary interface is used. |
| graph | ❌ | int | Graph identifier in Cacti. Default is 1. |
Example Request
Example of a successful response
net/show_ipv4_free¶
Returns a list of available IPv4 addresses for the specified server and interface in a given VLAN. Requires authentication.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: show_ipv4_free |
| token | ✅ | string | User authentication token |
| id | ✅ | int | Server ID for which free IPs are searched |
| port | ❌ | string | Interface name (e.g., eth0, ipmi). If not specified, the primary interface is used. |
| vlan | ❌ | int | VLAN ID. If not specified, it is determined automatically based on the interface. |
| ip | ❌ | string | Mask or specific IP for filtering the search |
| tag | ❌ | string | Network tag (e.g., bm, ipmi, ovirt). Default is 'bm' for physical servers. |
| fresh_period | ❌ | int | Freshness period for ARP/MAC data in seconds. 0 or -1 to reset to default. |
| show_all | ❌ | int | Flag to show all free IPs (1) or only suitable ones (0). For clients, always 0. |
Example Request
Example of a successful response
Failure response
``` { "code": -1, "message": "net/show_ipv4_free: invalid request - invalid id 0" }
```
net/unblock_ip¶
Removes the block from the specified IP address on the server. Requires access rights verification.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: unblock_ip |
| token | ✅ | string | User authorization token |
| id | ❌ | int | Server ID. If not specified, the system will attempt to find the server by IP (for clients). |
| ip | ✅ | string | IP address to unblock |
Example Request