net.php¶
Network infrastructure management module: adding and removing IP addresses, blocking traffic, managing network port states, retrieving statistics, and displaying Cacti graphs.
API Methods¶
| Method | Action | Description |
|---|---|---|
add_ipv4 | add IPv4 addresses | Adds a specified number of IPv4 addresses to a server on a specific port and VLAN. Supports selecting specific addresses or automatic selection of free ones. |
block_ip | block IP address | Blocks a specified IP address on the server via BIRD or blackhole. Accepts a block reason and a blackhole flag. |
get_status | get network interface status | Returns the current status of the network interface (port) for the specified server. Automatically determines the port if not explicitly specified. |
port_off | disable network port | Disables the specified network port of the server. If the reason parameter is passed, a block tag with the specified reason is added. |
port_on | enable network port | Enables the specified network port of the server, removing the block (tag 'block') if it was applied by the user. |
remove_ipv4 | remove IPv4 addresses | Removes one or all IPv4 addresses from the specified server. Clears PTR records in DNS. |
show_cacti | get Cacti graphs | Returns Cacti monitoring graph data for the specified server and port. |
show_ipv4_free | get list of free IPv4 addresses | Returns a list of available free IPv4 addresses for the specified server, port, and VLAN. Supports filtering by tags and freshness period. |
unblock_ip | unblock IP address | Unblocks a specified IP address on the server, removing block rules in BIRD and clearing block tags. |
net/add_ipv4¶
Adds a specified number of IPv4 addresses to a server on a specific port and VLAN. Supports selecting specific addresses or automatic selection of free ones.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: add_ipv4 |
| token | ✅ | string | User authorization token |
| id | ✅ | int | Identifier of the server to which addresses are added |
| amount | ✅ | int | Number of IP addresses to add (if specific IPs are not specified) |
| port | ✅ | string | Name of the network interface (e.g., eth0, ipmi) |
| vlan | ❌ | int | VLAN ID for address assignment. If not specified, the interface VLAN is used or determined automatically |
| ip | ❌ | string | Specific IP address to add (if automatic selection is not used) |
| ips | ❌ | array<string> | Array of specific IP addresses to add. Accepts multiple values: ips[]=1.2.3.4&ips[]=1.2.3.5 |
| tag | ❌ | string | Tag for the network (e.g., ipmi, ovirt, bm). Used to determine the subnet during automatic selection |
| allow_tech_networks | ❌ | int | Flag to allow adding addresses from technical networks (for administrators) |
| fresh_period | ❌ | int | Period in days for filtering 'fresh' IP addresses |
Example Request
Example of a successful response
net/block_ip¶
Blocks a specified IP address on the server via BIRD or blackhole. Accepts a block reason and a blackhole flag.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: block_ip |
| token | ✅ | string | User authorization token |
| id | ✅ | int | ID of the server where the IP is located |
| ip | ✅ | string | IP address to block |
| description | ❌ | string | Reason for blocking (will be added to the description) |
| four_hours | ❌ | int | Flag for temporary blocking (4 hours) |
Example Request
Example of a successful response
net/get_status¶
Returns the current status of the network interface (port) for the specified server. Automatically determines the port if not explicitly specified.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: get_status |
| token | ✅ | string | User authorization token |
| id | ✅ | int | Server identifier (server_id) |
| port | ❌ | string | Port name (e.g., eth0, ipmi). If not specified, the primary interface is selected automatically. |
| vlan | ❌ | string | VLAN identifier |
| speed | ❌ | string | Port speed |
| port_security | ❌ | int | Port security settings (MAC limit) |
| trunc | ❌ | string | Traffic truncation parameter |
| status | ❌ | int | Interface status |
| duplex | ❌ | string | Duplex mode |
| port_virt_node | ❌ | string | Port virtual node identifier |
Example Request
Example of a successful response
Failure response
net/port_off¶
Disables the specified network port of the server. If the reason parameter is passed, a block tag with the specified reason is added.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: port_off |
| token | ✅ | string | Authorization token |
| id | ✅ | int | Server ID |
| port | ❌ | string | Port name (e.g., eth0). If not specified, the primary interface is used. |
| reason | ❌ | string | Reason for blocking. If specified, a 'block' tag is added with this reason. |
Example Request
Example of a successful response
Failure response
net/port_on¶
Enables the specified network port of the server, removing the block (tag 'block') if it was applied by the user.
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, ipmi). If not specified, the primary port is selected automatically |
Example Request
Example of a successful response
Failure response
net/remove_ipv4¶
Removes one or all IPv4 addresses from the specified server. Clears PTR records in DNS.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: remove_ipv4 |
| token | ✅ | string | Authorization token to perform the action |
| id | ✅ | int | Identifier of the server from which IPs are removed |
| ip | ✅ | string | IPv4 address to remove. If not specified, the action is not performed |
| remove_all | ❌ | int | Flag to remove all IP addresses from the server (1 - remove all, 0 - only the specified one) |
Example Request
Example of a successful response
net/show_cacti¶
Returns Cacti monitoring graph data for the specified server and port.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: show_cacti |
| token | ✅ | string | User authorization token |
| id | ✅ | int | Server identifier |
| port | ❌ | string | Port name (e.g., eth0, ipmi) |
| graph | ❌ | string | Flag to display the graph (default 1) |
Example Request
Example of a successful response
{
"result": "OK",
"action": "show_cacti",
"data": {
"id": 12345,
"port": "eth0",
"graphs": [
{
"title": "Traffic In/Out",
"url": "https://cacti.example.com/graph.php?id=5678",
"image": "data:image/png;base64,iVBORw0KGgoAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
}
]
}
}
net/show_ipv4_free¶
Returns a list of available free IPv4 addresses for the specified server, port, and VLAN. Supports filtering by tags and freshness period.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: show_ipv4_free |
| token | ✅ | string | User authorization token |
| id | ✅ | int | Server identifier |
| port | ✅ | string | Name of the network interface (e.g., eth0, ipmi) |
| vlan | ❌ | int | VLAN ID. If not specified, it is determined automatically from the server interface |
| tag | ❌ | string | Tag for subnet filtering (e.g., bm, ipmi, ovirt) |
| ip | ❌ | string | Partial IP match for search (e.g., 192.168.1.) |
| fresh_period | ❌ | int | IP freshness period in seconds (0 or -1 to disable filter) |
| show_all | ❌ | int | Show all available IPs (available only for administrators) |
Example Request
Example of a successful response
{
"result": "OK",
"action": "show_ipv4_free",
"id": 12345,
"ips": [
{
"ip": "192.168.1.10",
"vlan": 100,
"subnet": "192.168.1.0/24",
"location": "AMS",
"status": "free"
},
{
"ip": "192.168.1.11",
"vlan": 100,
"subnet": "192.168.1.0/24",
"location": "AMS",
"status": "free"
}
],
"subnets": [
{
"network": "192.168.1.0",
"mask": 24,
"broadcast": "192.168.1.255",
"total": 254,
"free": 2
}
],
"res": {
"total_found": 2,
"filtered": 0
},
"total_ips": 2,
"fresh": -1
}
net/unblock_ip¶
Unblocks a specified IP address on the server, removing block rules in BIRD and clearing block tags.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: unblock_ip |
| token | ✅ | string | User authorization token |
| id | ✅ | int | Identifier of the server where the IP is located |
| ip | ✅ | string | IP address to unblock |
Example Request