An IP Pool is a collection of IP addresses which can be used to create VPS. You should create an IP Pool so that there are no connectivity issues within a VPS you create.
Use the List IP Pool API to list the IP pools present on your server.
The API response contains all the IP pool details which are listed according to the ID. You can limit the size of the list by passing the page and reslen parameters.
HTTP Request
https://hostname:4085/index.php?act=ippool&poolname=&poolgateway=&netmask=&nameserver=&page=&reslen=
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | ippool | The action specified to carry out the operation and return success after ip pool has been added | Yes |
page | GET | Int | If not specified, then only first 50 records are returned | Yes |
reslen | GET | Int | Number of records to be returned, default is 50 | Yes |
Sample Code
<?php
require_once('/usr/local/virtualizor/sdk/admin.php');
$key = 'your_api_key';
$pass = 'your_api_pass';
$ip = 'your_server_ip';
$admin = new Virtualizor_Admin_API($ip, $key, $pass);
$page = 1;
$reslen = 2;
$output = $admin->ippool($page, $reslen, $post);
print_r(json_encode($output));
?>
Output
{
"title": "IP Pool",
"ippools": {
"3": {
"ippid": "3",
"ipp_serid": "0",
"ippool_name": "Live IPv6",
"gateway": "2607:fa98:30:1::1",
"netmask": "64",
"ns1": "2001:4860:4860::8888",
"ns2": "2001:4860:4860::8844",
"ipv6": "1",
"nat": "0",
"nat_name": "",
"routing": "1",
"internal": "0",
"bridge": "",
"mtu": "0",
"vlan": "0",
"totalip": "50",
"freeip": "45"
},
"6": {
"ippid": "6",
"ipp_serid": "0",
"ippool_name": "Haproxy pool",
"gateway": "10.0.0.1",
"netmask": "255.0.0.0",
"ns1": "8.8.8.8",
"ns2": "8.8.4.4",
"ipv6": "0",
"nat": "0",
"nat_name": "",
"routing": "0",
"internal": "0",
"bridge": "HAProxy",
"mtu": "0",
"vlan": "1",
"totalip": "49",
"freeip": "44"
}
},
"timenow": 1535369009,
"time_taken": "0.211"
}