An IP Pool is a collection of IPs which can be used to create VPS. You should create an IP Pool so that there are no connectivity issues for the VPSes that you create.
The Add IPv6 IP Pool API allows you to create an IPv6 IP pool on your server. You can define parameters like the netmask, gateways and name Servers for the IP pool using this API. The API response will return "done" as "1" on successful creation of the IP pool.
For more information, you can refer this Add IP Pool guide.
HTTP Request
https://hostname:4085/index.php?act=addippool
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | addippool | The action specified to carry out operation return success after ip pool has been added | Yes |
iptype | POST | Int | 4 for IPv4, 6 for IPv6 | Yes |
serid | POST | array | An array containing server IDs | Yes |
ippool_name | POST | text | The name for the IP Pool | Yes |
gateway | POST | Int | The ip of the gateway | Yes |
netmask | POST | Int | The netmask address | Yes |
ns1 | POST | Int | Name server address 1 | Yes |
ns2 | POST | Int | Name server address 2 if any | Yes |
ipv6_1 | POST | text | The first field of the Ipv6 address | Yes |
ipv6_2 | POST | text | The second field of the Ipv6 address | Yes |
ipv6_3 | POST | text | The third field of the Ipv6 address | Yes |
ipv6_4 | POST | text | The fourth field of the Ipv6 address | Yes |
ipv6_5 | POST | text | The fifth field of the Ipv6 address | Yes |
ipv6_6 | POST | text | The sixth field of the Ipv6 address | Yes |
ipv6_num | POST | Int | The number of Ipv6 addresses | Yes |
vlan | POST | 1/0 | If checked, vlan networking will be used | No |
vlan_bridge | POST | text | Name of the vlan bridge | No |
routing | POST | 1/0 | If set then the routing option for the ip pool will be enabled | No |
mtu | POST | Int | Specify the Maximum Transmission Unit in bytes | No |
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);
$post = array();
$post['iptype'] = 6;
$post['serid'] = 0;
$post['ippool_name'] = 'test_api_ipv6';
$post['gateway'] = '1234:0f:0f:1';
$post['netmask'] = '48';
$post['ns1'] = '2001:4860:4860::8888';
$post['ns2'] = '2001:4860:4860::8844';
$post['routing'] = 1;
$post['ipv6_1'] = '1234';
$post['ipv6_2'] = '0f0f';
$post['ipv6_3'] = '0f0f';
$post['ipv6_4'] = '0123';
$post['ipv6_5'] = '1000';
$post['ipv6_6'] = '0000';
$post['ipv6_num'] = 50;
$output = $admin->addippool($post);
print_r(json_encode($output));
?>
Output
{
"title": "Add IP Pool",
"done": {
"ippid": "10",
"range": {
"486": "1234:0f0f:0f0f:0123:1000:0000:dcce:c541",
"487": "1234:0f0f:0f0f:0123:1000:0000:14fe:e29b",
"488": "1234:0f0f:0f0f:0123:1000:0000:3223:fc89",
"489": "1234:0f0f:0f0f:0123:1000:0000:19c5:d4a1",
"490": "1234:0f0f:0f0f:0123:1000:0000:7c59:8f0f",
"491": "1234:0f0f:0f0f:0123:1000:0000:964e:e407",
"492": "1234:0f0f:0f0f:0123:1000:0000:c911:c013",
"493": "1234:0f0f:0f0f:0123:1000:0000:f3f2:ef9c",
"494": "1234:0f0f:0f0f:0123:1000:0000:25b0:b26a",
"495": "1234:0f0f:0f0f:0123:1000:0000:f1f3:b51d",
"496": "1234:0f0f:0f0f:0123:1000:0000:4956:fc04",
"497": "1234:0f0f:0f0f:0123:1000:0000:65ca:bcc3",
"498": "1234:0f0f:0f0f:0123:1000:0000:7ea8:769c"
},
"done": 1,
"ipv6_subnet": "10"
},
"timenow": 1535374529,
"time_taken": "0.227"
}