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 IPs or automatic selection of free ones. |
block_ip | block IP | Blocks a specified IP address on the server via BIRD or blackhole. Requires a reason for the block. |
get_status | get port status | Returns the current status of the server's network interface (up/down, speed, duplex, MAC). |
port_off | disable port | Disables the server's network interface. Can add a block tag with a reason. |
port_on | enable port | Enables the server's network interface. Removes the block tag if it was not set by an administrator. |
remove_ipv4 | remove IPv4 addresses | Removes a specified IPv4 address or all addresses from the server. Clears PTR records in DNS. |
show_cacti | get Cacti graphs | Returns data or a link to a traffic graph for the specified server port from the Cacti monitoring system. |
show_ipv4_free | find free IPv4 | Returns a list of available free IPv4 addresses for the specified server, port, and VLAN. |
unblock_ip | unblock IP | Unblocks a previously blocked IP address on the server. Requires administrator privileges or matching the block reason. |
net/add_ipv4¶
Adds a specified number of IPv4 addresses to a server on a specific port and VLAN. Supports selecting specific IPs or automatic selection of free ones.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: add_ipv4 |
| token | ✅ | string | Authorization token |
| id | ✅ | int | Server ID |
| amount | ✅ | int | Number of IP addresses to add |
| port | ✅ | string | Network interface name (e.g., eth0) |
| vlan | ❌ | int | VLAN ID (optional, determined automatically for clients) |
| ip | ❌ | string | Specific IP address to add (if not specified, a free one is selected) |
| ips | ❌ | array | Array of specific IP addresses to add |
| tag | ❌ | string | Network tag (e.g., ipmi, ovirt, bm) |
| fresh_period | ❌ | int | IP freshness period (time in seconds) |
| allow_tech_networks | ❌ | int | Allow use of technical networks (for administrators) |
Example Request
Example of a successful response
net/block_ip¶
Blocks a specified IP address on the server via BIRD or blackhole. Requires a reason for the block.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: block_ip |
| token | ✅ | string | Authorization token |
| id | ✅ | int | Server ID |
| ip | ✅ | string | IP address to block |
| description | ✅ | string | Reason for blocking (description) |
| four_hours | ❌ | int | Set a temporary block for 4 hours (1 to enable) |
Example Request
Example of a successful response
net/get_status¶
Returns the current status of the server's network interface (up/down, speed, duplex, MAC).
HTTP Method: GET|POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: get_status |
| token | ✅ | string | Authorization token |
| id | ✅ | int | Server ID |
| port | ❌ | string | Interface name (e.g., eth0). If not specified, the primary interface is used. |
Example Request
Example of a successful response
Failure response
{
"code": -1,
"message": "net/get_status: invalid request for server 12345 with port eth0",
"description": "Parameter validation error or lack of access rights"
}
net/port_off¶
Disables the server's network interface. Can add a block tag with a reason.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: port_off |
| token | ✅ | string | Authorization token |
| id | ✅ | int | Server ID |
| port | ❌ | string | Interface name (e.g., eth0). If not specified, the primary interface is selected. |
| reason | ❌ | string | Reason for disabling (added to the block tag) |
Example Request
Example of a successful response
Failure response
{
"code": -1,
"message": "net/port_off: admin ban could not be lifted this way, please contact support or abuse team."
}
net/port_on¶
Enables the server's network interface. Removes the block tag if it was not set by an administrator.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: port_on |
| token | ✅ | string | Authorization token |
| id | ✅ | int | Server ID |
| port | ❌ | string | Interface name (e.g., eth0). If not specified, the primary interface or the first eth interface is used. |
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 a specified IPv4 address or all addresses from the server. Clears PTR records in DNS.
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 |
| remove_all | ❌ | int | Remove all IP addresses from the server (1 - yes, 0 - no) |
Example Request
Example of a successful response
net/show_cacti¶
Returns data or a link to a traffic graph for the specified server port from the Cacti monitoring system.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: show_cacti |
| token | ✅ | string | Authorization token |
| id | ✅ | int | Server ID |
| port | ❌ | string | Interface name (e.g., eth0) |
| graph | ❌ | string | Graph type (default 1) |
Example Request
Example of a successful response
net/show_ipv4_free¶
Returns a list of available free IPv4 addresses for the specified server, port, and VLAN.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: show_ipv4_free |
| token | ✅ | string | Authorization token |
| id | ✅ | int | Server ID |
| port | ✅ | string | Interface name (e.g., eth0) |
| vlan | ❌ | int | VLAN ID (optional, used for administrators) |
| tag | ❌ | string | Network tag (e.g., bm, ipmi, ovirt) |
| fresh_period | ❌ | int | IP freshness period (in seconds, -1 if not set) |
| allow_tech_networks | ❌ | int | Allow technical networks (0 or 1) |
Example Request
Example of a successful response
Failure response
net/unblock_ip¶
Unblocks a previously blocked IP address on the server. Requires administrator privileges or matching the block reason.
HTTP Method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: unblock_ip |
| token | ✅ | string | Authorization token |
| id | ✅ | int | Server ID |
| ip | ✅ | string | IP address to unblock |
Example Request