Virtualizor makes it possible to make and assign IPv6 Subnets to VPSes e.g. You can break a /64 IPv6 subnet (assigned to your dedicated server) into multiple /112 subnets and assign them to the VPSes. Use the Add IPv6 Subnet API to add the IPv6 subnet on your server. The API response will contain "done" as "1" on successful creation of the subnet.
For more information about IPv6 subnets, please refer this IPv6 Subnets guide.
HTTP Request
https://hostname:4085/index.php?act=addiprange
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
submitip | GET | addiprange | If set the IPv6 Subnet will be generated | Yes |
netmask | POST | Int | The Desired Netmask (48,64,80,96,112) | Yes |
input_netmask | POST | Int | The input netmask will be used to generate the subnet, valid values can be from 32 to 108 with increments of 4 | Yes |
ips6 | POST | array | The multidimensional array to generate single ipv6 subnets | No |
ipv6_1 | POST | text | The 1st ipv6 subnet bits | Yes |
ipv6_2 | POST | text | The 2nd ipv6 subnet bits | Yes |
ipv6_3 | POST | text | The 3rd ipv6 subnet bits (Required for input_netmask values 36-108) | No |
ipv6_4 | POST | text | The 4th ipv6 subnet bits (Required for input_netmask values 52-108) | No |
ipv6_5 | POST | text | The 5th ipv6 subnet bits (Required for input_netmask values 68-108) | No |
ipv6_6 | POST | text | The 6th ipv6 subnet bits (Required for input_netmask values 84-108) | No |
ipv6_7 | POST | text | The 7th ipv6 subnet bits (Required for input_netmask values 100-108) | No |
ipv6_num | POST | Int | The number of ipv6 subnets that will be generated | Yes |
ippid | POST | Int | The IP Pool ID to which the subnet has to be added | 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['submitip'] = 1;
$post['netmask'] = 48;
$post['input_netmask'] = 40;
$post['ips6'] = array(array('1234','0f0f','0f0f','0123','1000','0000','eca7','071f'));
$post['ipv6_1'] = '102f';
$post['ipv6_2'] = '4526';
$post['ipv6_3'] = '1f25';
$post['ipv6_4'] = '';
$post['ipv6_5'] = '';
$post['ipv6_6'] = '';
$post['ipv6_7'] = '';
$post['ipv6_num'] = 50;
$post['ippid'] = 750;
$output = $admin->addiprange($post);
print_r(json_encode($output));
?>
Output
{
"title": "Add IPv6 Subnet",
"done": {
"range": {
"539": "102f:4526:1f25be:0000:0000:0000:0000:0001",
"540": "102f:4526:1f250d:0000:0000:0000:0000:0001",
"541": "102f:4526:1f258b:0000:0000:0000:0000:0001",
"542": "102f:4526:1f2585:0000:0000:0000:0000:0001",
"543": "102f:4526:1f2570:0000:0000:0000:0000:0001",
"544": "102f:4526:1f25c5:0000:0000:0000:0000:0001",
"545": "102f:4526:1f2502:0000:0000:0000:0000:0001",
"546": "102f:4526:1f2591:0000:0000:0000:0000:0001",
"547": "102f:4526:1f2590:0000:0000:0000:0000:0001"
},
"done": 1
},
"timenow": 1535398935,
"time_taken": "0.216"
}